|
|
@@ -423,19 +423,8 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
return R.error("店铺不存在或未启用");
|
|
|
}
|
|
|
|
|
|
- //基础信息
|
|
|
- ProductAttrCountDto countDto = computedProductCount(param.getValues());
|
|
|
- FsStoreProductScrm product = new FsStoreProductScrm();
|
|
|
- BeanUtils.copyProperties(param, product);
|
|
|
-
|
|
|
- //数据转换和提取
|
|
|
- populateBasicInfo(product, countDto, param);
|
|
|
- populateDateRanges(product, param);
|
|
|
- setDefaultBarcodeIfAvailable(product, param);
|
|
|
- product.setBusinessLink(param.getBusinessLink());
|
|
|
-
|
|
|
//验证资质
|
|
|
- switch (product.getProductType()) {
|
|
|
+ switch (param.getProductType()) {
|
|
|
case 1://非处方
|
|
|
break;
|
|
|
case 2://处方
|
|
|
@@ -457,6 +446,17 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
return R.error("商品类型错误");
|
|
|
}
|
|
|
|
|
|
+ //基础信息
|
|
|
+ ProductAttrCountDto countDto = computedProductCount(param.getValues());
|
|
|
+ FsStoreProductScrm product = new FsStoreProductScrm();
|
|
|
+ BeanUtils.copyProperties(param, product);
|
|
|
+
|
|
|
+ //数据转换和提取
|
|
|
+ populateBasicInfo(product, countDto, param);
|
|
|
+ populateDateRanges(product, param);
|
|
|
+ setDefaultBarcodeIfAvailable(product, param);
|
|
|
+ product.setBusinessLink(param.getBusinessLink());
|
|
|
+
|
|
|
// 根据经营范围校验商品类型
|
|
|
if (com.fs.common.utils.StringUtils.isNotEmpty(store.getSelectableProductTypes())) {
|
|
|
String productTypeName = getProductTypeName(product.getCateId());
|
|
|
@@ -508,25 +508,24 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
} catch (IllegalAccessException e) {
|
|
|
log.error("获取diff出错", e);
|
|
|
}
|
|
|
- fsStoreProductMapper.updateFsStoreProduct(product);
|
|
|
- if (param.getSpecType().equals(0)) {
|
|
|
- ProductArrtDTO fromatDetailDto = ProductArrtDTO.builder()
|
|
|
- .value("规格")
|
|
|
- .detail(ListUtil.toList("默认"))
|
|
|
- .build();
|
|
|
- List<ProductArrtDTO> items=new ArrayList<>();
|
|
|
- items.add(fromatDetailDto);
|
|
|
- param.getValues().get(0).setSku("默认");
|
|
|
- addProductAttr(product.getProductId(),items,param.getValues(),storeId);
|
|
|
- } else {
|
|
|
- addProductAttr(product.getProductId(),param.getItems(),param.getValues(),storeId);
|
|
|
+ //避免重复审核时第一次审核结果为不通过,第二次申请重新上架导致无法在审核列表中查询到
|
|
|
+ if(oldFsStoreProduct.getIsAudit() != null && "2".equals(oldFsStoreProduct.getIsAudit())){
|
|
|
+ product.setIsAudit("0");
|
|
|
}
|
|
|
+ fsStoreProductMapper.updateFsStoreProduct(product);
|
|
|
+// else外面也会调用这个方法,为啥会在if中调用执行handleProductAttributes
|
|
|
+// handleProductAttributes(param, product, storeId);
|
|
|
} else{
|
|
|
//新添加的商品默认都应该不是上架状态,流程都是需要先审核。即使你新增时候选择了上架状态,也应该是上架并待审核才对。
|
|
|
product.setIsShow(0);
|
|
|
fsStoreProductMapper.insertFsStoreProduct(product);
|
|
|
}
|
|
|
storeAuditLogUtil.addOperLog(product.getProductId());
|
|
|
+ handleProductAttributes(param, product, storeId); //统一调用handleProductAttributes
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void handleProductAttributes(FsStoreProductAddEditParam param, FsStoreProductScrm product, Long storeId) {
|
|
|
if (param.getSpecType().equals(0)) {
|
|
|
ProductArrtDTO fromatDetailDto = ProductArrtDTO.builder()
|
|
|
.value("规格")
|
|
|
@@ -535,11 +534,10 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
List<ProductArrtDTO> items=new ArrayList<>();
|
|
|
items.add(fromatDetailDto);
|
|
|
param.getValues().get(0).setSku("默认");
|
|
|
- addProductAttr(product.getProductId(),items,param.getValues(),storeId);
|
|
|
+ addProductAttr(product.getProductId(),items, param.getValues(), storeId);
|
|
|
} else {
|
|
|
- addProductAttr(product.getProductId(),param.getItems(),param.getValues(),storeId);
|
|
|
+ addProductAttr(product.getProductId(), param.getItems(), param.getValues(), storeId);
|
|
|
}
|
|
|
- return R.ok();
|
|
|
}
|
|
|
|
|
|
/**
|