|
|
@@ -20,6 +20,7 @@ import com.fs.company.cache.ICompanyCacheService;
|
|
|
import com.fs.erp.domain.ErpGoods;
|
|
|
import com.fs.erp.service.IErpGoodsService;
|
|
|
import com.fs.his.config.FsSysConfig;
|
|
|
+import com.fs.his.domain.FsStoreProductAttrValue;
|
|
|
import com.fs.his.param.FsStoreProductListSParam;
|
|
|
import com.fs.his.utils.ConfigUtil;
|
|
|
import com.fs.his.vo.FsStoreProductExcelVO;
|
|
|
@@ -38,6 +39,7 @@ import com.fs.hisStore.service.IFsStoreProductAttrValueScrmService;
|
|
|
import com.fs.hisStore.vo.*;
|
|
|
import com.fs.statis.dto.ProductAuditDTO;
|
|
|
import com.fs.store.vo.FsStoreProductScrmQueryVO;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -63,7 +65,8 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
private FsStoreProductAttrValueScrmMapper fsStoreProductAttrValueMapper;
|
|
|
@Autowired
|
|
|
private FsStoreProductAttrScrmMapper fsStoreProductAttrMapper;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private FsStoreCartScrmMapper fsStoreCartScrmMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private IFsStoreProductAttrValueScrmService attrValueService;
|
|
|
@@ -158,10 +161,22 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
* @param productIds 需要删除的商品ID
|
|
|
* @return 结果
|
|
|
*/
|
|
|
+
|
|
|
@Override
|
|
|
public int deleteFsStoreProductByIds(Long[] productIds)
|
|
|
{
|
|
|
storeAuditLogUtil.addBatchAuditArray(productIds, "", "");
|
|
|
+ for (Long productId : productIds) {
|
|
|
+ //查出商品属性所有ID;
|
|
|
+ List<FsStoreProductAttrValueScrm> attrValues = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(productId);
|
|
|
+ if (CollectionUtils.isNotEmpty(attrValues)){
|
|
|
+ attrValues.forEach(e->{
|
|
|
+ fsStoreCartScrmMapper.deleteFsStoreCartByProDuctValueId(e.getId());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ fsStoreProductAttrValueMapper.deleteFsStoreProductAttrValueByProductId(productId);
|
|
|
+ }
|
|
|
+
|
|
|
return fsStoreProductMapper.deleteFsStoreProductByIds(productIds);
|
|
|
}
|
|
|
|
|
|
@@ -319,7 +334,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
public R addOrEdit(FsStoreProductAddEditParam param) {
|
|
|
ProductAttrCountDto countDto=computedProductCount(param.getValues());
|
|
|
|
|
|
- if(param.getProductId()>0){
|
|
|
+ if(ObjectUtil.isNotEmpty(param.getProductId())&¶m.getProductId()>0){
|
|
|
FsStoreProductScrm product=new FsStoreProductScrm();
|
|
|
BeanUtils.copyProperties(param,product);
|
|
|
product.setPrice(countDto.getMinPrice());
|
|
|
@@ -377,6 +392,11 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
//清空values
|
|
|
//查出商品属性所有ID;
|
|
|
List<FsStoreProductAttrValueScrm> attrValues=fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(productId);
|
|
|
+ if (CollectionUtils.isNotEmpty(attrValues)){
|
|
|
+ attrValues.forEach(e->{
|
|
|
+ fsStoreCartScrmMapper.deleteFsStoreCartByProDuctValueId(e.getId());
|
|
|
+ });
|
|
|
+ }
|
|
|
fsStoreProductAttrValueMapper.deleteFsStoreProductAttrValueByProductId(productId);
|
|
|
//写入attr
|
|
|
for(ProductArrtDTO vo:items){
|