更新商品信息时,删除分享图

This commit is contained in:
LIONCITYS\lioncity
2020-09-10 15:11:03 +08:00
parent 5c4448eb7c
commit 0a38192b27
3 changed files with 256 additions and 245 deletions

View File

@ -143,4 +143,9 @@ public interface YxStoreProductService extends BaseService<YxStoreProduct>{
*/
void insertAndEditYxStoreProduct(StoreProductDto storeProductDto);
/**+
* 删除商品转发海报
* @param id
*/
void deleteForwardImg(Long id);
}

View File

@ -76,7 +76,6 @@ import java.util.*;
import java.util.stream.Collectors;
/**
* @author hupeng
* @date 2020-05-12
@ -107,9 +106,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
private YxShippingTemplatesService shippingTemplatesService;
/**
* 增加库存 减少销量
*
* @param num 数量
* @param productId 商品id
* @param unique sku唯一值
@ -133,6 +132,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
/**
* 减少库存与增加销量
*
* @param num 数量
* @param productId 商品id
* @param unique sku
@ -165,7 +165,6 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
}
@Override
public YxStoreProduct getProductInfo(int id) {
QueryWrapper<YxStoreProduct> wrapper = new QueryWrapper<>();
@ -181,6 +180,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
/**
* 获取单个商品
*
* @param id 商品id
* @return YxStoreProductQueryVo
*/
@ -192,6 +192,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
/**
* 返回普通商品库存
*
* @param productId 商品id
* @param unique sku唯一值
* @return int
@ -218,6 +219,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
/**
* 商品列表
*
* @param productQueryParam YxStoreProductQueryParam
* @return list
*/
@ -271,6 +273,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
/**
* 商品详情
*
* @param id 商品id
* @param uid 用户id
* @param latitude 纬度
@ -376,6 +379,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
/**
* 商品列表
*
* @param page 页码
* @param limit 条数
* @param order ProductEnum
@ -416,10 +420,6 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
}
//============ 分割线================//
@ -490,10 +490,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
}
/**
* 商品上架下架
*
* @param id 商品id
* @param status ShopCommonEnum
*/
@ -508,14 +507,13 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
}
/**
* 新增/保存商品
*
* @param storeProductDto 商品
*/
@Override
public void insertAndEditYxStoreProduct(StoreProductDto storeProductDto)
{
public void insertAndEditYxStoreProduct(StoreProductDto storeProductDto) {
ProductResultDto resultDTO = this.computedProduct(storeProductDto.getAttrs());
@ -532,7 +530,10 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
yxStoreProduct.setStock(resultDTO.getStock());
yxStoreProduct.setSliderImage(String.join(",", storeProductDto.getSliderImage()));
if (storeProductDto.getId() != null) {
//清空商品转发图
deleteForwardImg(storeProductDto.getId());
}
this.saveOrUpdate(yxStoreProduct);
@ -559,15 +560,12 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
}
}
/**
* 获取生成的属性
*
* @param id 商品id
* @param jsonStr jsonStr
* @return map
@ -585,7 +583,6 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
}
List<FromatDetailDto> fromatDetailDTOList = JSON.parseArray(jsonObject.get("attrs").toString(),
FromatDetailDto.class);
@ -690,12 +687,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
}
/**
* 计算产品数据
*
* @param attrs attrs
* @return ProductResultDto
*/
@ -739,6 +733,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
/**
* mapTobean
*
* @param listMap listMap
* @return list
*/
@ -753,6 +748,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
/**
* 增加表头
*
* @param headerMap headerMap
* @param headerMapList headerMapList
* @param align align
@ -840,6 +836,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
/**
* 组合规则属性算法
*
* @param fromatDetailDTOList
* @return DetailDto
*/
@ -925,4 +922,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
return detailDto;
}
@Override
public void deleteForwardImg(Long id) {
baseMapper.deleteForwardImg(id, "_product_detail_wap");
}
}

View File

@ -10,6 +10,7 @@ package co.yixiang.modules.product.service.mapper;
import co.yixiang.common.mapper.CoreMapper;
import co.yixiang.modules.product.domain.YxStoreProduct;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
@ -96,4 +97,7 @@ public interface StoreProductMapper extends CoreMapper<YxStoreProduct> {
@Update("update yx_store_product set browse=browse+1 " +
"where id=#{productId}")
int incBrowseNum(@Param("productId") Long productId);
@Delete("DELETE from yx_system_attachment where name like CONCAT(#{id},'_%',#{name}, '%')")
void deleteForwardImg(@Param("id") Long id,@Param("name") String name);
}