产品 excel导入
This commit is contained in:
parent
c5e78f8521
commit
70f355232e
|
|
@ -375,7 +375,6 @@ public class ProductInfoServiceImpl implements ProductInfoService {
|
|||
ProductInfoDO dos = productInfoMapper.selectOne(lambdaQueryWrapper);
|
||||
if(FuncUtil.isNotEmpty(dos)){
|
||||
|
||||
|
||||
// 合并属性
|
||||
BeanUtil.copyProperties(dos, productInfo);
|
||||
productInfo.setName(excelVO.getName());
|
||||
|
|
@ -389,8 +388,11 @@ public class ProductInfoServiceImpl implements ProductInfoService {
|
|||
productInfo.setSpecMaterial(FuncUtil.toStr(excelVO.getMaterial(),null));
|
||||
productInfo.setRemark(FuncUtil.toStr(excelVO.getRemarks(),null));
|
||||
|
||||
Long productTypeId = toProductTypeId(excelVO.getProductType());
|
||||
productInfo.setProductTypeId(productTypeId);
|
||||
if(FuncUtil.isNotEmpty(excelVO.getProductType())){
|
||||
Long productTypeId = toProductTypeId(excelVO.getProductType());
|
||||
productInfo.setProductTypeId(productTypeId);
|
||||
}
|
||||
|
||||
|
||||
if(FuncUtil.isNotEmpty(brandName)){
|
||||
Long brandId = brandIdCache.get(brandName);
|
||||
|
|
@ -417,44 +419,43 @@ public class ProductInfoServiceImpl implements ProductInfoService {
|
|||
if(FuncUtil.isEmpty(code)){
|
||||
return "第"+(i+1)+"行编码 不能为空:"+code;
|
||||
}
|
||||
String brandName = excelVO.getBrandName();
|
||||
String brandName = FuncUtil.toStr(excelVO.getBrandName(),"").trim();
|
||||
if(FuncUtil.isEmpty(brandName)){
|
||||
|
||||
return "第"+(i+1)+"行品牌名称 不能为空:"+brandName;
|
||||
}
|
||||
String productType = excelVO.getProductType();
|
||||
String productType = FuncUtil.toStr(excelVO.getProductType(),"").trim();
|
||||
if(FuncUtil.isEmpty(productType)){
|
||||
return "第"+(i+1)+"行品类(尺码唛,价钱卡,纸盒,主唛,挂卡,洗水唛) 不能为空:"+brandName;
|
||||
return "第"+(i+1)+"行品类(尺码唛,价钱卡,纸盒,主唛,挂卡,洗水唛) 不能为空:"+productType;
|
||||
}
|
||||
Long typeId = toProductTypeId(excelVO.getProductType().trim());
|
||||
Long typeId = toProductTypeId(productType);
|
||||
|
||||
if(FuncUtil.isEmpty(typeId)){
|
||||
ProductTypeIdCache.clear();
|
||||
return "第"+(i+1)+"行品类(尺码唛,价钱卡,纸盒,主唛,挂卡,洗水唛) 请维护该分类的的资料:"+excelVO.getProductType();
|
||||
return "第"+(i+1)+"行品类(尺码唛,价钱卡,纸盒,主唛,挂卡,洗水唛) 请维护该分类的的资料:"+productType;
|
||||
}
|
||||
productInfo.setProductTypeId(typeId);
|
||||
|
||||
productInfo.setCode(code);
|
||||
productInfo.setTemplateType("2");
|
||||
|
||||
productInfo.setSpecSizeWidth(FuncUtil.toDouble(excelVO.getSpecWidth()));
|
||||
productInfo.setSpecSizeHeight(FuncUtil.toDouble(excelVO.getSpecHeight()));
|
||||
productInfo.setSpecSizeThk(FuncUtil.toDouble(excelVO.getSpecThickness()));
|
||||
productInfo.setSpecSizeWidth(FuncUtil.toDouble(excelVO.getSpecWidth(),null));
|
||||
productInfo.setSpecSizeHeight(FuncUtil.toDouble(excelVO.getSpecHeight(),null));
|
||||
productInfo.setSpecSizeThk(FuncUtil.toDouble(excelVO.getSpecThickness(),null));
|
||||
productInfo.setSpecMaterial(excelVO.getMaterial());
|
||||
productInfo.setRemark(excelVO.getRemarks());
|
||||
|
||||
|
||||
if(FuncUtil.isNotEmpty(brandName)){
|
||||
Long brandId = brandIdCache.get(brandName);
|
||||
if(FuncUtil.isNotEmpty(brandId)){
|
||||
productInfo.setBrandId(brandId);
|
||||
}else {
|
||||
BrandDO brandDO = brandService.getBrandByName(brandName);
|
||||
if(FuncUtil.isEmpty(brandDO)){
|
||||
return "第"+(i+1)+"行品牌不存在,请维护该品牌的资料:"+brandName;
|
||||
}
|
||||
productInfo.setBrandId(brandDO.getId());
|
||||
brandIdCache.put(brandName,brandDO.getId());
|
||||
Long brandId = brandIdCache.get(brandName);
|
||||
if(FuncUtil.isNotEmpty(brandId)){
|
||||
productInfo.setBrandId(brandId);
|
||||
}else {
|
||||
BrandDO brandDO = brandService.getBrandByName(brandName);
|
||||
if(FuncUtil.isEmpty(brandDO)){
|
||||
return "第"+(i+1)+"行品牌不存在,请维护该品牌的资料:"+brandName;
|
||||
}
|
||||
productInfo.setBrandId(brandDO.getId());
|
||||
brandIdCache.put(brandName,brandDO.getId());
|
||||
}
|
||||
newList.add(productInfo);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue