|
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableBiMap;
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Maps;
|
|
import com.kmall.admin.dao.*;
|
|
import com.kmall.admin.dao.*;
|
|
import com.kmall.admin.dao.mk.dist.MkDistSellAllocationDao;
|
|
import com.kmall.admin.dao.mk.dist.MkDistSellAllocationDao;
|
|
|
|
+import com.kmall.admin.dto.StoreGoodsDto;
|
|
import com.kmall.admin.entity.*;
|
|
import com.kmall.admin.entity.*;
|
|
import com.kmall.admin.entity.mk.dist.MkDistSellAllocationEntity;
|
|
import com.kmall.admin.entity.mk.dist.MkDistSellAllocationEntity;
|
|
import com.kmall.admin.service.ProductStoreRelaService;
|
|
import com.kmall.admin.service.ProductStoreRelaService;
|
|
@@ -17,10 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
-import java.util.Date;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Service实现类
|
|
* Service实现类
|
|
@@ -60,7 +58,13 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
@Autowired
|
|
@Autowired
|
|
private StoreDao storeDao;
|
|
private StoreDao storeDao;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private MerchDao merchDao;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ThirdMerchantBizDao thirdMerchantBizDao;
|
|
|
|
+ @Autowired
|
|
private MerchUserDao merchUserDao;
|
|
private MerchUserDao merchUserDao;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ExportExceptionDataDao exportExceptionDataDao;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ProductStoreRelaEntity queryObject(Integer id) {
|
|
public ProductStoreRelaEntity queryObject(Integer id) {
|
|
@@ -128,7 +132,7 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
builder.put("specification", "规格");
|
|
builder.put("specification", "规格");
|
|
}
|
|
}
|
|
builder.put("retailPrice", "零售价");
|
|
builder.put("retailPrice", "零售价");
|
|
- builder.put("marketPrice", "市场价");
|
|
|
|
|
|
+// builder.put("marketPrice", "市场价");
|
|
r = ValidatorUtil.isEmpty(builder.build(), valideDate);
|
|
r = ValidatorUtil.isEmpty(builder.build(), valideDate);
|
|
if (Integer.valueOf(r.get("code").toString()) != 0) {
|
|
if (Integer.valueOf(r.get("code").toString()) != 0) {
|
|
throw new RRException(r.get("msg").toString());
|
|
throw new RRException(r.get("msg").toString());
|
|
@@ -171,12 +175,6 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
SysUserEntity user = ShiroUtils.getUserEntity();
|
|
SysUserEntity user = ShiroUtils.getUserEntity();
|
|
ProductEntity product = productDao.queryObjectByGoodsIdAndStoreId(goodsId, "");
|
|
ProductEntity product = productDao.queryObjectByGoodsIdAndStoreId(goodsId, "");
|
|
|
|
|
|
-// 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())) {
|
|
if (Dict.orderBizType.item_11.getItem().equals(goodsEntity.getGoodsBizType())) {
|
|
GoodsSpecificationEntity goodsSpecificationEntity = goodsSpecificationDao.queryByGoodsId(goodsEntity.getId());
|
|
GoodsSpecificationEntity goodsSpecificationEntity = goodsSpecificationDao.queryByGoodsId(goodsEntity.getId());
|
|
if(goodsSpecificationEntity != null){
|
|
if(goodsSpecificationEntity != null){
|
|
@@ -204,10 +202,7 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
|
|
product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
|
|
productDao.update(product);
|
|
productDao.update(product);
|
|
}
|
|
}
|
|
- }/* else {
|
|
|
|
- productStoreRela.setRetailPrice(goodsEntity.getRetailPrice());
|
|
|
|
- productStoreRela.setMarketPrice(goodsEntity.getMarketPrice());
|
|
|
|
- }*/
|
|
|
|
|
|
+ }
|
|
|
|
|
|
// 添加商品参数
|
|
// 添加商品参数
|
|
List<GoodsAttributeEntity> attributeEntityList = productStoreRela.getAttributeEntityList();
|
|
List<GoodsAttributeEntity> attributeEntityList = productStoreRela.getAttributeEntityList();
|
|
@@ -303,7 +298,7 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
builder.put("specification", "规格");
|
|
builder.put("specification", "规格");
|
|
}
|
|
}
|
|
builder.put("retailPrice", "零售价");
|
|
builder.put("retailPrice", "零售价");
|
|
- builder.put("marketPrice", "市场价");
|
|
|
|
|
|
+// builder.put("marketPrice", "市场价");
|
|
r = ValidatorUtil.isEmpty(builder.build(), valideDate);
|
|
r = ValidatorUtil.isEmpty(builder.build(), valideDate);
|
|
if (Integer.valueOf(r.get("code").toString()) != 0) {
|
|
if (Integer.valueOf(r.get("code").toString()) != 0) {
|
|
throw new RRException(r.get("msg").toString());
|
|
throw new RRException(r.get("msg").toString());
|
|
@@ -401,6 +396,9 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if(productStoreRela.getMarketPrice()==null){
|
|
|
|
+ productStoreRela.setMarketPrice(Constant.ZERO);
|
|
|
|
+ }
|
|
Map cartMap = Maps.newHashMap();
|
|
Map cartMap = Maps.newHashMap();
|
|
cartMap.put("goodsId",goodsEntity.getId());
|
|
cartMap.put("goodsId",goodsEntity.getId());
|
|
List<CartEntity> cartList = cartDao.queryList(cartMap);
|
|
List<CartEntity> cartList = cartDao.queryList(cartMap);
|
|
@@ -531,4 +529,292 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
return productStoreRelaDao.queryGoodsRealListByTopicIdTotal(map);
|
|
return productStoreRelaDao.queryGoodsRealListByTopicIdTotal(map);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public int uploadExcel(List<StoreGoodsDto> storeGoodsDtoList){
|
|
|
|
+ GoodsEntity goodsEntity = null;
|
|
|
|
+ String isStockShare = "";
|
|
|
|
+ SysUserEntity user = ShiroUtils.getUserEntity();
|
|
|
|
+ String merchSn = user.getMerchSn();
|
|
|
|
+ boolean isFail = false;
|
|
|
|
+ List<String> failThirdMerchSnList = new ArrayList<>(),
|
|
|
|
+ failGoodsSnList = new ArrayList<>(), failHaveNameList = new ArrayList<>(), failHaveGoodsSnList = new ArrayList<>()
|
|
|
|
+ , failParentCateList = new ArrayList<>(), failCateList = new ArrayList<>(), failHaveStoreNameList = new ArrayList<>()
|
|
|
|
+ , failBrandList = new ArrayList<>(), failFreightList = new ArrayList<>();
|
|
|
|
+ if (storeGoodsDtoList != null && storeGoodsDtoList.size() > 0) {
|
|
|
|
+ for (int i = 0; i < storeGoodsDtoList.size(); i++) {
|
|
|
|
+ StoreGoodsDto storeGoodsDto = storeGoodsDtoList.get(i);
|
|
|
|
+ ProductStoreRelaEntity storeRelaEntity = new ProductStoreRelaEntity();
|
|
|
|
+ Map<String, Object> valideDate = MapBeanUtil.fromObject(storeGoodsDto);
|
|
|
|
+ ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
|
|
|
|
+ builder.put("storeName", "门店名称");
|
|
|
|
+ builder.put("goodsSn", "商品编码");
|
|
|
|
+ builder.put("categoryName", "一级分类");
|
|
|
|
+ builder.put("attributeCategory", "二级分类");
|
|
|
|
+ builder.put("brandName", "品牌");
|
|
|
|
+ builder.put("freightName", "运费");
|
|
|
|
+
|
|
|
|
+ R r = ValidatorUtil.isEmpty(builder.build(), valideDate);
|
|
|
|
+ if (Integer.valueOf(r.get("code").toString()) != 0) {
|
|
|
|
+ throw new RRException(r.get("msg").toString());
|
|
|
|
+ }
|
|
|
|
+ StoreEntity store = storeDao.queryObjectByName(storeGoodsDto.getStoreName().trim());
|
|
|
|
+ if (store != null) {
|
|
|
|
+ storeRelaEntity.setStoreId(store.getId());
|
|
|
|
+ storeRelaEntity.setMerchSn(store.getMerchSn());
|
|
|
|
+ MerchEntity merchEntity = merchDao.findByMerchSn(store.getMerchSn());
|
|
|
|
+ if(merchEntity != null){
|
|
|
|
+ storeRelaEntity.setMerchName(merchEntity.getMerchName());
|
|
|
|
+ }
|
|
|
|
+ goodsEntity = goodsDao.queryGoodsByGoodsSnAndStoreId(storeGoodsDto.getGoodsSn(), store.getId());
|
|
|
|
+ if(goodsEntity == null){//商品不存在
|
|
|
|
+ isFail = true;
|
|
|
|
+ failGoodsSnList.add(storeGoodsDto.getStoreName());
|
|
|
|
+ }else {
|
|
|
|
+ storeRelaEntity.setSku(goodsEntity.getSku());
|
|
|
|
+ storeRelaEntity.setGoodsId(goodsEntity.getId());
|
|
|
|
+ storeRelaEntity.setGoodsBizType(goodsEntity.getGoodsBizType());
|
|
|
|
+ isStockShare = StockUtil.getIsStockShareByGoodsEntity(goodsEntity.getIsSupplierGoods(),
|
|
|
|
+ goodsEntity.getIsStockShare(), goodsEntity.getIsStockShareBySuppler());
|
|
|
|
+
|
|
|
|
+ if(goodsEntity.getIsSupplierGoods().equalsIgnoreCase(Dict.isSupplierGoods.item_1.getItem())) {
|
|
|
|
+ builder.put("supplierThirdName", "商品供货商所属第三方商户");
|
|
|
|
+ }
|
|
|
|
+ if(Dict.orderBizType.item_00.getItem().equalsIgnoreCase(goodsEntity.getGoodsBizType())){
|
|
|
|
+ if(Dict.isStockShare.item_0.getItem().equalsIgnoreCase(isStockShare)){
|
|
|
|
+ builder.put("stockNum", "库存");
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ builder.put("stockNum", "库存");
|
|
|
|
+ }
|
|
|
|
+ if (Dict.orderBizType.item_11.getItem().equals(goodsEntity.getGoodsBizType())) {
|
|
|
|
+ // 普通商品校验商品规格
|
|
|
|
+ builder.put("specification", "产品规格");
|
|
|
|
+ }
|
|
|
|
+ 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());
|
|
|
|
+ }
|
|
|
|
+ //商品配置校验
|
|
|
|
+ if(!StringUtils.isNotEmpty(goodsEntity.getListPicUrl())){
|
|
|
|
+ throw new RRException("该商品列表图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品列表图信息,再来操作门店商品数据");
|
|
|
|
+ }
|
|
|
|
+ if(!StringUtils.isNotEmpty(goodsEntity.getPrimaryPicUrl())){
|
|
|
|
+ throw new RRException("该商品主图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品主图信息,再来操作门店商品数据");
|
|
|
|
+ }
|
|
|
|
+ List<GoodsGalleryEntity> galleryEntityList = goodsGalleryDao.queryObjectByGoodId(goodsEntity.getId());
|
|
|
|
+ if (galleryEntityList == null || galleryEntityList.size() <= 0) {
|
|
|
|
+ throw new RRException("该商品轮播图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品详情轮播图信息,再来操作门店商品数据");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(goodsEntity.getIsSupplierGoods().equalsIgnoreCase(Dict.isSupplierGoods.item_1.getItem())) {
|
|
|
|
+ builder.put("supplierThirdCode", "商品供货商所属第三方商户");
|
|
|
|
+ ThirdMerchantBizEntity thirdMerchantBizEntity = thirdMerchantBizDao.getThirdMerchangByCode(storeGoodsDto.getSupplierThirdCode());
|
|
|
|
+ if(thirdMerchantBizEntity != null){
|
|
|
|
+ storeRelaEntity.setThirdPartyMerchCode(thirdMerchantBizEntity.getThirdPartyMerchCode());
|
|
|
|
+ storeRelaEntity.setSupplierThirdId(thirdMerchantBizEntity.getThirdMerchSn());
|
|
|
|
+ }else{//第三方商户不存在
|
|
|
|
+ isFail = true;
|
|
|
|
+ failThirdMerchSnList.add(storeGoodsDto.getStoreName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ CategoryEntity parentCategoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getAttributeCategory(), store.getMerchSn());
|
|
|
|
+ if(parentCategoryEntity == null){
|
|
|
|
+ isFail = true;
|
|
|
|
+ failParentCateList.add(storeGoodsDto.getStoreName());
|
|
|
|
+ }else {
|
|
|
|
+ storeRelaEntity.setAttributeCategory(parentCategoryEntity.getParentId());
|
|
|
|
+ }
|
|
|
|
+ CategoryEntity categoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getCategoryName(), store.getMerchSn());
|
|
|
|
+ if(categoryEntity == null){
|
|
|
|
+ isFail = true;
|
|
|
|
+ failCateList.add(storeGoodsDto.getStoreName());
|
|
|
|
+ }else {
|
|
|
|
+ storeRelaEntity.setCategoryId(categoryEntity.getId());
|
|
|
|
+ }
|
|
|
|
+ BrandEntity brandEntity = brandDao.queryBrandByBrandNameAndStoreId(storeGoodsDto.getBrandName(), store.getId());
|
|
|
|
+ if(brandEntity == null){
|
|
|
|
+ isFail = true;
|
|
|
|
+ failBrandList.add(storeGoodsDto.getStoreName());
|
|
|
|
+ }else {
|
|
|
|
+ storeRelaEntity.setBrandId(brandEntity.getId());
|
|
|
|
+ }
|
|
|
|
+ FreightEntity freightEntity = freightDao.queryFreightByDefaultFreightAndStoreId(storeGoodsDto.getBrandName(), store.getId());
|
|
|
|
+ if(freightEntity == null){
|
|
|
|
+ isFail = true;
|
|
|
|
+ failFreightList.add(storeGoodsDto.getStoreName());
|
|
|
|
+ }else {
|
|
|
|
+ storeRelaEntity.setFreightId(freightEntity.getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //校验总库存
|
|
|
|
+ if(goodsEntity.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_00.getItem()) && isStockShare.equalsIgnoreCase(Dict.isStockShare.item_1.getItem())){
|
|
|
|
+ Integer stockNum = Integer.parseInt(storeGoodsDto.getStockNum());
|
|
|
|
+ Integer goodsNumber = goodsEntity.getGoodsNumber();//商品总库存
|
|
|
|
+ if (stockNum.intValue() != goodsNumber.intValue()) {
|
|
|
|
+ throw new RRException("门店【" + store.getStoreName() + "】商品编码【" + storeGoodsDto.getGoodsSn()
|
|
|
|
+ + "】的门店商品分配库存不等于商品总库存!当前门店属于共享库存,需与总库存一致,该商品总库存【" + goodsNumber + "】");
|
|
|
|
+ } else {
|
|
|
|
+ storeRelaEntity.setStockNum(goodsEntity.getGoodsNumber());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if((!goodsEntity.getGoodsBizType().equalsIgnoreCase(Dict.orderBizType.item_00.getItem()) && isStockShare.equalsIgnoreCase(Dict.isStockShare.item_1.getItem())) ||
|
|
|
|
+ isStockShare.equalsIgnoreCase(Dict.isStockShare.item_0.getItem())){
|
|
|
|
+ Integer stockNum = Integer.parseInt(storeGoodsDto.getStockNum());
|
|
|
|
+ Integer goodsNumber = goodsEntity.getGoodsNumber();//商品总库存
|
|
|
|
+ Integer storeTotalStockNum = 0;//商品分配库存
|
|
|
|
+ List<ProductStoreRelaEntity> proStoreList = productStoreRelaDao.queryByGoodsId(goodsEntity.getId());
|
|
|
|
+ for(ProductStoreRelaEntity relaEntity: proStoreList){
|
|
|
|
+ if(relaEntity.getStoreId().intValue() != store.getId().intValue()) {
|
|
|
|
+ storeTotalStockNum = storeTotalStockNum + relaEntity.getStockNum();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Integer totalStockNum = storeTotalStockNum + stockNum;
|
|
|
|
+ if(goodsNumber < totalStockNum){
|
|
|
|
+ throw new RRException("门店【" + store.getStoreName() + "】商品编码【" + storeGoodsDto.getGoodsSn()
|
|
|
|
+ + "】的门店商品分配库存已超过商品总库存!当前门店商品分配库存【" + stockNum + "】,已在各门店分配库存总额【"+
|
|
|
|
+ storeTotalStockNum + "】,该商品总库存【" + goodsNumber + "】");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String storeId = String.valueOf(store.getId());
|
|
|
|
+ String goodsId = String.valueOf(goodsEntity.getId());
|
|
|
|
+ Map<String, Object> map = Maps.newHashMap();
|
|
|
|
+ map.put("goodsId", goodsId);
|
|
|
|
+ map.put("storeId", storeId);
|
|
|
|
+ List<ProductStoreRelaEntity> storeRelaList = querySameList(map);
|
|
|
|
+ if (storeRelaList != null && storeRelaList.size() > 0) {
|
|
|
|
+// throw new RRException("该门店已存在此商品!");
|
|
|
|
+ isFail = true;
|
|
|
|
+ failHaveNameList.add(storeGoodsDto.getStoreName());
|
|
|
|
+ failHaveGoodsSnList.add(storeGoodsDto.getGoodsSn());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ProductEntity product = productDao.queryObjectByGoodsIdAndStoreId(goodsId, "");
|
|
|
|
+ if (Dict.orderBizType.item_11.getItem().equals(goodsEntity.getGoodsBizType())) {
|
|
|
|
+ GoodsSpecificationEntity goodsSpecificationEntity = goodsSpecificationDao.queryByGoodsId(goodsEntity.getId());
|
|
|
|
+ if(goodsSpecificationEntity != null){
|
|
|
|
+ goodsSpecificationDao.delete(goodsSpecificationEntity.getId());
|
|
|
|
+ }
|
|
|
|
+ // 添加商品规格
|
|
|
|
+ GoodsSpecificationEntity goodsSpecification = new GoodsSpecificationEntity();
|
|
|
|
+ goodsSpecification.setGoodsId(goodsEntity.getId());
|
|
|
|
+ goodsSpecification.setValue(storeGoodsDto.getSpecification());
|
|
|
|
+ goodsSpecification.setSpecificationId(1);
|
|
|
|
+ goodsSpecificationDao.save(goodsSpecification);
|
|
|
|
+
|
|
|
|
+ // 修改产品
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 批量导入不添加商品参数
|
|
|
|
+ //新增库存操作记录
|
|
|
|
+ StoreMngChangeEntity storeMngChangeEntity = new StoreMngChangeEntity();
|
|
|
|
+ storeMngChangeEntity.setChangeType(Dict.changeType.item_2.getItem());
|
|
|
|
+ storeMngChangeEntity.setChangeReason("新增门店商品");
|
|
|
|
+ storeMngChangeEntity.setGoodsId(Integer.parseInt(String.valueOf(goodsEntity.getId())));
|
|
|
|
+ storeMngChangeEntity.setStoreId(Integer.parseInt(String.valueOf(store.getId())));
|
|
|
|
+ storeMngChangeEntity.setMerchSn(store.getMerchSn());
|
|
|
|
+ storeMngChangeEntity.setCreateTime(new Date());
|
|
|
|
+ storeMngChangeEntity.setModTime(new Date());
|
|
|
|
+ storeMngChangeEntity.setStoreChangeNum(Integer.parseInt(storeGoodsDto.getStockNum()));
|
|
|
|
+ storeMngChangeEntity.setStoreOriginalNum(0);
|
|
|
|
+ storeMngChangeEntity.setStoreValidNum(Integer.parseInt(storeGoodsDto.getStockNum()));
|
|
|
|
+ storeMngChangeEntity.setCreaterSn(user.getUsername());
|
|
|
|
+ storeMngChangeEntity.setModerSn(user.getUsername());
|
|
|
|
+ storeMngChangeEntity.setIsValid(0);
|
|
|
|
+ storeMngChangeDao.save(storeMngChangeEntity);
|
|
|
|
+
|
|
|
|
+ //更新门店商品是否有修改字段
|
|
|
|
+ updateLoadGoodsByStoreId(storeId, user);
|
|
|
|
+
|
|
|
|
+ storeRelaEntity.setProductId(product.getId());
|
|
|
|
+// storeRelaEntity.setGoodsBizType(goodsEntity.getGoodsBizType());
|
|
|
|
+// storeRelaEntity.setSku(goodsEntity.getSku());
|
|
|
|
+ storeRelaEntity.setRetailPrice(BigDecimal.valueOf(Long.valueOf(storeGoodsDto.getRetailPrice())));
|
|
|
|
+ storeRelaEntity.setMarketPrice(BigDecimal.valueOf(Long.valueOf(storeGoodsDto.getMarketPrice())));
|
|
|
|
+ storeRelaEntity.setCreaterSn(user.getUserId().toString());
|
|
|
|
+ storeRelaEntity.setCreateTime(new Date());
|
|
|
|
+ storeRelaEntity.setModerSn(user.getUserId().toString());
|
|
|
|
+ storeRelaEntity.setModTime(new Date());
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ isFail = true;
|
|
|
|
+ failHaveStoreNameList.add(storeGoodsDto.getStoreName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(!isFail){
|
|
|
|
+ productStoreRelaDao.save(storeRelaEntity);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ExportExceptionDataEntity exportExceptionDataEntity = new ExportExceptionDataEntity();
|
|
|
|
+ exportExceptionDataEntity.setCreaterSn(user.getUserId().toString());
|
|
|
|
+ exportExceptionDataEntity.setUserId(user.getUserId().intValue());
|
|
|
|
+ exportExceptionDataEntity.setCreateTime(new Date());
|
|
|
|
+ exportExceptionDataEntity.setModTime(new Date());
|
|
|
|
+ exportExceptionDataEntity.setMerchSn(merchSn);
|
|
|
|
+ exportExceptionDataEntity.setStoreId(user.getStoreId());
|
|
|
|
+ exportExceptionDataEntity.setExportDataType(Dict.exportDataType.item_3.getItem());
|
|
|
|
+
|
|
|
|
+ if(failHaveStoreNameList != null && failHaveStoreNameList.size() > 0){
|
|
|
|
+ exportExceptionDataEntity.setExportExceptionData("门店名称不存在,请检查门店名称【"+failHaveStoreNameList+"】的门店名称信息!");
|
|
|
|
+ exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
|
+ throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
|
|
|
|
+ }
|
|
|
|
+ if(failThirdMerchSnList != null && failThirdMerchSnList.size() > 0){
|
|
|
|
+ exportExceptionDataEntity.setExportExceptionData("第三方商户代码不存在,请在商城配置》第三方商户管理中维护,请检查门店名称【"+failThirdMerchSnList+"】的第三方商户代码信息,请先维护再继续操作!");
|
|
|
|
+ exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
|
+ throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
|
|
|
|
+ }
|
|
|
|
+ if(failHaveNameList != null && failHaveNameList.size() > 0){
|
|
|
|
+ exportExceptionDataEntity.setExportExceptionData("门店商品已存在!请检查门店名称【" + failHaveNameList + "】商品编码【" + failHaveGoodsSnList + "】的门店商品信息");
|
|
|
|
+ exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
|
+ throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
|
|
|
|
+ }
|
|
|
|
+ if(failGoodsSnList != null && failGoodsSnList.size() > 0){
|
|
|
|
+ exportExceptionDataEntity.setExportExceptionData("商户编码不存在,请检查门店名称【"+failGoodsSnList+"】的商户编码信息,请先维护再继续操作!");
|
|
|
|
+ exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
|
+ throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
|
|
|
|
+ }
|
|
|
|
+ if(failParentCateList != null && failParentCateList.size() > 0){
|
|
|
|
+ exportExceptionDataEntity.setExportExceptionData("一级分类不存在,请检查门店名称【"+failParentCateList+"】的一级分类信息,请先维护再继续操作!");
|
|
|
|
+ exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
|
+ throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
|
|
|
|
+ }
|
|
|
|
+ if(failCateList != null && failCateList.size() > 0){
|
|
|
|
+ exportExceptionDataEntity.setExportExceptionData("二级分类不存在,请检查门店名称【"+failCateList+"】的二级分类信息,请先维护再继续操作!");
|
|
|
|
+ exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
|
+ throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
|
|
|
|
+ }
|
|
|
|
+ if(failBrandList != null && failBrandList.size() > 0){
|
|
|
|
+ exportExceptionDataEntity.setExportExceptionData("品牌不存在,请检查门店名称【"+failBrandList+"】的品牌信息,请先维护再继续操作!");
|
|
|
|
+ exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
|
+ throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
|
|
|
|
+ }
|
|
|
|
+ if(failFreightList != null && failFreightList.size() > 0){
|
|
|
|
+ exportExceptionDataEntity.setExportExceptionData("运费模板不存在,请检查门店名称【"+failFreightList+"】的运费模板信息,请先维护再继续操作!");
|
|
|
|
+ exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
|
+ throw new RRException("导入数据异常,异常信息请在商品管理》》导入异常数据中查看检查");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ throw new RRException("导入数据为空,或者检查数据是否为空");
|
|
|
|
+ }
|
|
|
|
+ throw new RRException("导入成功!");
|
|
|
|
+// return 1;
|
|
|
|
+ }
|
|
}
|
|
}
|