更新商品信息时,删除分享图
This commit is contained in:
@ -143,4 +143,9 @@ public interface YxStoreProductService extends BaseService<YxStoreProduct>{
|
||||
*/
|
||||
void insertAndEditYxStoreProduct(StoreProductDto storeProductDto);
|
||||
|
||||
/**+
|
||||
* 删除商品转发海报
|
||||
* @param id
|
||||
*/
|
||||
void deleteForwardImg(Long id);
|
||||
}
|
||||
|
@ -76,11 +76,10 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2020-05-12
|
||||
*/
|
||||
* @author hupeng
|
||||
* @date 2020-05-12
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMapper, YxStoreProduct> implements YxStoreProductService {
|
||||
@ -107,56 +106,57 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
private YxShippingTemplatesService shippingTemplatesService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 增加库存 减少销量
|
||||
* @param num 数量
|
||||
*
|
||||
* @param num 数量
|
||||
* @param productId 商品id
|
||||
* @param unique sku唯一值
|
||||
* @param unique sku唯一值
|
||||
*/
|
||||
@Override
|
||||
public void incProductStock(Integer num, Long productId, String unique,Long activityId, String type) {
|
||||
public void incProductStock(Integer num, Long productId, String unique, Long activityId, String type) {
|
||||
//处理属性sku
|
||||
if(StrUtil.isNotEmpty(unique)){
|
||||
yxStoreProductAttrService.incProductAttrStock(num,productId,unique,type);
|
||||
if (StrUtil.isNotEmpty(unique)) {
|
||||
yxStoreProductAttrService.incProductAttrStock(num, productId, unique, type);
|
||||
}
|
||||
//先处理商品库存,活动商品也要处理,因为共享库存
|
||||
storeProductMapper.incStockDecSales(num, productId);
|
||||
//处理商品外层显示的库存
|
||||
if("combination".equals(type)){
|
||||
storeProductMapper.incCombinationStockIncSales(num,productId,activityId);
|
||||
}else if("seckill".equals(type)){
|
||||
storeProductMapper.incSeckillStockIncSales(num,productId,activityId);
|
||||
if ("combination".equals(type)) {
|
||||
storeProductMapper.incCombinationStockIncSales(num, productId, activityId);
|
||||
} else if ("seckill".equals(type)) {
|
||||
storeProductMapper.incSeckillStockIncSales(num, productId, activityId);
|
||||
}
|
||||
//todo 处理砍价商品库存
|
||||
}
|
||||
|
||||
/**
|
||||
* 减少库存与增加销量
|
||||
* @param num 数量
|
||||
*
|
||||
* @param num 数量
|
||||
* @param productId 商品id
|
||||
* @param unique sku
|
||||
* @param unique sku
|
||||
*/
|
||||
@Override
|
||||
public void decProductStock(int num, Long productId, String unique,Long activityId,String type) {
|
||||
public void decProductStock(int num, Long productId, String unique, Long activityId, String type) {
|
||||
//处理属性sku
|
||||
if(StrUtil.isNotEmpty(unique)){
|
||||
yxStoreProductAttrService.decProductAttrStock(num,productId,unique, type);
|
||||
if (StrUtil.isNotEmpty(unique)) {
|
||||
yxStoreProductAttrService.decProductAttrStock(num, productId, unique, type);
|
||||
}
|
||||
//先处理商品库存,活动商品也要处理,因为共享库存
|
||||
int product = storeProductMapper.decStockIncSales(num,productId);
|
||||
if(product == 0) {
|
||||
int product = storeProductMapper.decStockIncSales(num, productId);
|
||||
if (product == 0) {
|
||||
throw new YshopException("共享商品库存不足");
|
||||
}
|
||||
//处理商品外层显示的库存
|
||||
if("combination".equals(type)){
|
||||
int combinationRes = storeProductMapper.decCombinationStockIncSales(num,productId,activityId);
|
||||
if(combinationRes == 0) {
|
||||
if ("combination".equals(type)) {
|
||||
int combinationRes = storeProductMapper.decCombinationStockIncSales(num, productId, activityId);
|
||||
if (combinationRes == 0) {
|
||||
throw new YshopException("拼团商品库存不足");
|
||||
}
|
||||
}else if("seckill".equals(type)){
|
||||
int seckillRes = storeProductMapper.decSeckillStockIncSales(num,productId,activityId);
|
||||
if(seckillRes == 0) {
|
||||
} else if ("seckill".equals(type)) {
|
||||
int seckillRes = storeProductMapper.decSeckillStockIncSales(num, productId, activityId);
|
||||
if (seckillRes == 0) {
|
||||
throw new YshopException("秒杀商品库存不足");
|
||||
}
|
||||
}
|
||||
@ -165,13 +165,12 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public YxStoreProduct getProductInfo(int id) {
|
||||
QueryWrapper<YxStoreProduct> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("is_del",0).eq("is_show",1).eq("id",id);
|
||||
wrapper.eq("is_del", 0).eq("is_show", 1).eq("id", id);
|
||||
YxStoreProduct storeProduct = this.baseMapper.selectOne(wrapper);
|
||||
if(ObjectUtil.isNull(storeProduct)){
|
||||
if (ObjectUtil.isNull(storeProduct)) {
|
||||
throw new ErrorRequestException("商品不存在或已下架");
|
||||
}
|
||||
|
||||
@ -181,19 +180,21 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
|
||||
/**
|
||||
* 获取单个商品
|
||||
*
|
||||
* @param id 商品id
|
||||
* @return YxStoreProductQueryVo
|
||||
*/
|
||||
@Override
|
||||
public YxStoreProductQueryVo getStoreProductById(Long id) {
|
||||
return generator.convert(this.baseMapper.selectById(id),YxStoreProductQueryVo.class);
|
||||
return generator.convert(this.baseMapper.selectById(id), YxStoreProductQueryVo.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回普通商品库存
|
||||
*
|
||||
* @param productId 商品id
|
||||
* @param unique sku唯一值
|
||||
* @param unique sku唯一值
|
||||
* @return int
|
||||
*/
|
||||
@Override
|
||||
@ -206,9 +207,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
if (storeProductAttrValue == null) {
|
||||
return 0;
|
||||
}
|
||||
if("pink".equals(type)){
|
||||
if ("pink".equals(type)) {
|
||||
return storeProductAttrValue.getPinkStock();
|
||||
}else if ("seckill".equals(type)){
|
||||
} else if ("seckill".equals(type)) {
|
||||
return storeProductAttrValue.getSeckillStock();
|
||||
}
|
||||
return storeProductAttrValue.getStock();
|
||||
@ -218,6 +219,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*
|
||||
* @param productQueryParam YxStoreProductQueryParam
|
||||
* @return list
|
||||
*/
|
||||
@ -225,35 +227,35 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
public List<YxStoreProductQueryVo> getGoodsList(YxStoreProductQueryParam productQueryParam) {
|
||||
|
||||
QueryWrapper<YxStoreProduct> wrapper = new QueryWrapper<>();
|
||||
wrapper.lambda().eq(YxStoreProduct::getIsShow,CommonEnum.SHOW_STATUS_1.getValue());
|
||||
wrapper.lambda().eq(YxStoreProduct::getIsShow, CommonEnum.SHOW_STATUS_1.getValue());
|
||||
|
||||
//分类搜索
|
||||
if(StrUtil.isNotBlank(productQueryParam.getSid()) &&
|
||||
!ShopConstants.YSHOP_ZERO.equals(productQueryParam.getSid())){
|
||||
wrapper.lambda().eq(YxStoreProduct::getCateId,productQueryParam.getSid());
|
||||
if (StrUtil.isNotBlank(productQueryParam.getSid()) &&
|
||||
!ShopConstants.YSHOP_ZERO.equals(productQueryParam.getSid())) {
|
||||
wrapper.lambda().eq(YxStoreProduct::getCateId, productQueryParam.getSid());
|
||||
}
|
||||
//关键字搜索
|
||||
if(StrUtil.isNotEmpty(productQueryParam.getKeyword())){
|
||||
wrapper.lambda().like(YxStoreProduct::getStoreName,productQueryParam.getKeyword());
|
||||
if (StrUtil.isNotEmpty(productQueryParam.getKeyword())) {
|
||||
wrapper.lambda().like(YxStoreProduct::getStoreName, productQueryParam.getKeyword());
|
||||
}
|
||||
|
||||
//新品搜索
|
||||
if(StrUtil.isNotBlank(productQueryParam.getNews()) &&
|
||||
!ShopConstants.YSHOP_ZERO.equals(productQueryParam.getNews())){
|
||||
wrapper.lambda().eq(YxStoreProduct::getIsNew,ShopCommonEnum.IS_NEW_1.getValue());
|
||||
if (StrUtil.isNotBlank(productQueryParam.getNews()) &&
|
||||
!ShopConstants.YSHOP_ZERO.equals(productQueryParam.getNews())) {
|
||||
wrapper.lambda().eq(YxStoreProduct::getIsNew, ShopCommonEnum.IS_NEW_1.getValue());
|
||||
}
|
||||
|
||||
//销量排序
|
||||
if(SortEnum.DESC.getValue().equals(productQueryParam.getSalesOrder())){
|
||||
if (SortEnum.DESC.getValue().equals(productQueryParam.getSalesOrder())) {
|
||||
wrapper.lambda().orderByDesc(YxStoreProduct::getSales);
|
||||
}else if(SortEnum.ASC.getValue().equals(productQueryParam.getSalesOrder())) {
|
||||
} else if (SortEnum.ASC.getValue().equals(productQueryParam.getSalesOrder())) {
|
||||
wrapper.lambda().orderByAsc(YxStoreProduct::getSales);
|
||||
}
|
||||
|
||||
//价格排序
|
||||
if(SortEnum.DESC.getValue().equals(productQueryParam.getPriceOrder())){
|
||||
if (SortEnum.DESC.getValue().equals(productQueryParam.getPriceOrder())) {
|
||||
wrapper.lambda().orderByDesc(YxStoreProduct::getPrice);
|
||||
}else if(SortEnum.ASC.getValue().equals(productQueryParam.getPriceOrder())){
|
||||
} else if (SortEnum.ASC.getValue().equals(productQueryParam.getPriceOrder())) {
|
||||
wrapper.lambda().orderByAsc(YxStoreProduct::getPrice);
|
||||
}
|
||||
|
||||
@ -262,46 +264,47 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
Page<YxStoreProduct> pageModel = new Page<>(productQueryParam.getPage(),
|
||||
productQueryParam.getLimit());
|
||||
|
||||
IPage<YxStoreProduct> pageList = storeProductMapper.selectPage(pageModel,wrapper);
|
||||
IPage<YxStoreProduct> pageList = storeProductMapper.selectPage(pageModel, wrapper);
|
||||
|
||||
List<YxStoreProductQueryVo> list = generator.convert(pageList.getRecords(),YxStoreProductQueryVo.class);
|
||||
List<YxStoreProductQueryVo> list = generator.convert(pageList.getRecords(), YxStoreProductQueryVo.class);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品详情
|
||||
* @param id 商品id
|
||||
* @param uid 用户id
|
||||
* @param latitude 纬度
|
||||
*
|
||||
* @param id 商品id
|
||||
* @param uid 用户id
|
||||
* @param latitude 纬度
|
||||
* @param longitude 经度
|
||||
* @return ProductVo
|
||||
*/
|
||||
@Override
|
||||
public ProductVo goodsDetail(Long id, Long uid, String latitude, String longitude) {
|
||||
QueryWrapper<YxStoreProduct> wrapper = new QueryWrapper<>();
|
||||
wrapper.lambda().eq(YxStoreProduct::getIsShow,ShopCommonEnum.SHOW_1.getValue())
|
||||
.eq(YxStoreProduct::getId,id);
|
||||
wrapper.lambda().eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
|
||||
.eq(YxStoreProduct::getId, id);
|
||||
YxStoreProduct storeProduct = storeProductMapper.selectOne(wrapper);
|
||||
if(ObjectUtil.isNull(storeProduct)){
|
||||
if (ObjectUtil.isNull(storeProduct)) {
|
||||
throw new ErrorRequestException("商品不存在或已下架");
|
||||
}
|
||||
|
||||
//获取商品sku
|
||||
Map<String, Object> returnMap = yxStoreProductAttrService.getProductAttrDetail(id);
|
||||
ProductVo productVo = new ProductVo();
|
||||
YxStoreProductQueryVo storeProductQueryVo = generator.convert(storeProduct,YxStoreProductQueryVo.class);
|
||||
YxStoreProductQueryVo storeProductQueryVo = generator.convert(storeProduct, YxStoreProductQueryVo.class);
|
||||
|
||||
//设置销量
|
||||
storeProductQueryVo.setSales(storeProductQueryVo.getSales()+storeProductQueryVo.getFicti());
|
||||
storeProductQueryVo.setSales(storeProductQueryVo.getSales() + storeProductQueryVo.getFicti());
|
||||
|
||||
//设置VIP价格
|
||||
double vipPrice = userService.setLevelPrice(
|
||||
storeProductQueryVo.getPrice().doubleValue(),uid);
|
||||
storeProductQueryVo.getPrice().doubleValue(), uid);
|
||||
storeProductQueryVo.setVipPrice(BigDecimal.valueOf(vipPrice));
|
||||
|
||||
//收藏
|
||||
boolean isCollect = relationService.isProductRelation(id,uid);
|
||||
boolean isCollect = relationService.isProductRelation(id, uid);
|
||||
storeProductQueryVo.setUserCollect(isCollect);
|
||||
|
||||
//总条数
|
||||
@ -319,15 +322,15 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
//获取运费模板名称
|
||||
String storeFreePostage = RedisUtil.get("store_free_postage");
|
||||
String tempName = "";
|
||||
if(StrUtil.isBlank(storeFreePostage)
|
||||
if (StrUtil.isBlank(storeFreePostage)
|
||||
|| !NumberUtil.isNumber(storeFreePostage)
|
||||
|| Integer.valueOf(storeFreePostage) == 0){
|
||||
|| Integer.valueOf(storeFreePostage) == 0) {
|
||||
tempName = "全国包邮";
|
||||
}else{
|
||||
} else {
|
||||
YxShippingTemplates shippingTemplates = shippingTemplatesService.getById(storeProduct.getTempId());
|
||||
if(ObjectUtil.isNotNull(shippingTemplates)){
|
||||
if (ObjectUtil.isNotNull(shippingTemplates)) {
|
||||
tempName = shippingTemplates.getName();
|
||||
}else {
|
||||
} else {
|
||||
throw new BadRequestException("请配置运费模板");
|
||||
}
|
||||
|
||||
@ -336,22 +339,22 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
|
||||
//设置商品相关信息
|
||||
productVo.setStoreInfo(storeProductQueryVo);
|
||||
productVo.setProductAttr((List<YxStoreProductAttrQueryVo>)returnMap.get("productAttr"));
|
||||
productVo.setProductValue((Map<String, YxStoreProductAttrValue>)returnMap.get("productValue"));
|
||||
productVo.setProductAttr((List<YxStoreProductAttrQueryVo>) returnMap.get("productAttr"));
|
||||
productVo.setProductValue((Map<String, YxStoreProductAttrValue>) returnMap.get("productValue"));
|
||||
|
||||
|
||||
//门店
|
||||
productVo.setSystemStore(systemStoreService.getStoreInfo(latitude,longitude));
|
||||
productVo.setSystemStore(systemStoreService.getStoreInfo(latitude, longitude));
|
||||
productVo.setMapKey(RedisUtil.get(ShopKeyUtils.getTengXunMapKey()));
|
||||
//添加足迹
|
||||
YxStoreProductRelation foot = relationService.getOne(new LambdaQueryWrapper<YxStoreProductRelation>()
|
||||
.eq(YxStoreProductRelation::getUid, uid)
|
||||
.eq(YxStoreProductRelation::getProductId, storeProductQueryVo.getId())
|
||||
.eq(YxStoreProductRelation::getType, "foot"));
|
||||
if(ObjectUtil.isNotNull(foot)){
|
||||
if (ObjectUtil.isNotNull(foot)) {
|
||||
foot.setCreateTime(new Date());
|
||||
relationService.saveOrUpdate(foot);
|
||||
}else {
|
||||
} else {
|
||||
YxStoreProductRelation storeProductRelation = new YxStoreProductRelation();
|
||||
storeProductRelation.setProductId(storeProductQueryVo.getId());
|
||||
storeProductRelation.setUid(uid);
|
||||
@ -376,7 +379,8 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
* @param page 页码
|
||||
*
|
||||
* @param page 页码
|
||||
* @param limit 条数
|
||||
* @param order ProductEnum
|
||||
* @return List
|
||||
@ -385,11 +389,11 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
public List<YxStoreProductQueryVo> getList(int page, int limit, int order) {
|
||||
|
||||
QueryWrapper<YxStoreProduct> wrapper = new QueryWrapper<>();
|
||||
wrapper.lambda().eq(YxStoreProduct::getIsShow,ShopCommonEnum.SHOW_1.getValue())
|
||||
wrapper.lambda().eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
|
||||
.orderByDesc(YxStoreProduct::getSort);
|
||||
|
||||
// order
|
||||
switch (ProductEnum.toType(order)){
|
||||
switch (ProductEnum.toType(order)) {
|
||||
case TYPE_1:
|
||||
wrapper.lambda().eq(YxStoreProduct::getIsBest,
|
||||
ShopCommonEnum.IS_STATUS_1.getValue()); //精品推荐
|
||||
@ -409,17 +413,13 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
}
|
||||
Page<YxStoreProduct> pageModel = new Page<>(page, limit);
|
||||
|
||||
IPage<YxStoreProduct> pageList = storeProductMapper.selectPage(pageModel,wrapper);
|
||||
IPage<YxStoreProduct> pageList = storeProductMapper.selectPage(pageModel, wrapper);
|
||||
|
||||
|
||||
return generator.convert(pageList.getRecords(),YxStoreProductQueryVo.class);
|
||||
return generator.convert(pageList.getRecords(), YxStoreProductQueryVo.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//============ 分割线================//
|
||||
|
||||
|
||||
@ -435,9 +435,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
|
||||
|
||||
@Override
|
||||
public List<YxStoreProduct> queryAll(YxStoreProductQueryCriteria criteria){
|
||||
public List<YxStoreProduct> queryAll(YxStoreProductQueryCriteria criteria) {
|
||||
List<YxStoreProduct> yxStoreProductList = baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreProduct.class, criteria));
|
||||
yxStoreProductList.forEach(yxStoreProduct ->{
|
||||
yxStoreProductList.forEach(yxStoreProduct -> {
|
||||
yxStoreProduct.setStoreCategory(yxStoreCategoryService.getById(yxStoreProduct.getCateId()));
|
||||
});
|
||||
return yxStoreProductList;
|
||||
@ -448,7 +448,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
public void download(List<YxStoreProductDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (YxStoreProductDto yxStoreProduct : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)", yxStoreProduct.getMerId());
|
||||
map.put("商品图片", yxStoreProduct.getImage());
|
||||
map.put("轮播图", yxStoreProduct.getSliderImage());
|
||||
@ -490,39 +490,37 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 商品上架下架
|
||||
* @param id 商品id
|
||||
* @param status ShopCommonEnum
|
||||
*
|
||||
* @param id 商品id
|
||||
* @param status ShopCommonEnum
|
||||
*/
|
||||
@Override
|
||||
public void onSale(Long id,Integer status) {
|
||||
if(ShopCommonEnum.SHOW_1.getValue().equals(status)){
|
||||
public void onSale(Long id, Integer status) {
|
||||
if (ShopCommonEnum.SHOW_1.getValue().equals(status)) {
|
||||
status = ShopCommonEnum.SHOW_0.getValue();
|
||||
}else{
|
||||
} else {
|
||||
status = ShopCommonEnum.SHOW_1.getValue();
|
||||
}
|
||||
storeProductMapper.updateOnsale(status,id);
|
||||
storeProductMapper.updateOnsale(status, id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增/保存商品
|
||||
*
|
||||
* @param storeProductDto 商品
|
||||
*/
|
||||
@Override
|
||||
public void insertAndEditYxStoreProduct(StoreProductDto storeProductDto)
|
||||
{
|
||||
public void insertAndEditYxStoreProduct(StoreProductDto storeProductDto) {
|
||||
|
||||
ProductResultDto resultDTO = this.computedProduct(storeProductDto.getAttrs());
|
||||
|
||||
//添加商品
|
||||
YxStoreProduct yxStoreProduct = new YxStoreProduct();
|
||||
BeanUtil.copyProperties(storeProductDto,yxStoreProduct,"sliderImage");
|
||||
if(storeProductDto.getSliderImage().isEmpty()) {
|
||||
BeanUtil.copyProperties(storeProductDto, yxStoreProduct, "sliderImage");
|
||||
if (storeProductDto.getSliderImage().isEmpty()) {
|
||||
throw new YshopException("请上传轮播图");
|
||||
}
|
||||
|
||||
@ -532,13 +530,16 @@ 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);
|
||||
|
||||
//属性处理
|
||||
//处理单sKu
|
||||
if(SpecTypeEnum.TYPE_0.getValue().equals(storeProductDto.getSpecType())){
|
||||
if (SpecTypeEnum.TYPE_0.getValue().equals(storeProductDto.getSpecType())) {
|
||||
FromatDetailDto fromatDetailDto = FromatDetailDto.builder()
|
||||
.value("规格")
|
||||
.detailValue("")
|
||||
@ -548,62 +549,58 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
List<ProductFormatDto> attrs = storeProductDto.getAttrs();
|
||||
ProductFormatDto productFormatDto = attrs.get(0);
|
||||
productFormatDto.setValue1("规格");
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("规格","默认");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("规格", "默认");
|
||||
productFormatDto.setDetail(map);
|
||||
yxStoreProductAttrService.insertYxStoreProductAttr(ListUtil.toList(fromatDetailDto),
|
||||
ListUtil.toList(productFormatDto),storeProductDto.getId());
|
||||
}else{
|
||||
ListUtil.toList(productFormatDto), storeProductDto.getId());
|
||||
} else {
|
||||
yxStoreProductAttrService.insertYxStoreProductAttr(storeProductDto.getItems(),
|
||||
storeProductDto.getAttrs(),storeProductDto.getId());
|
||||
storeProductDto.getAttrs(), storeProductDto.getId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取生成的属性
|
||||
* @param id 商品id
|
||||
*
|
||||
* @param id 商品id
|
||||
* @param jsonStr jsonStr
|
||||
* @return map
|
||||
*/
|
||||
@Override
|
||||
public Map<String,Object> getFormatAttr(Long id, String jsonStr,boolean isActivity) {
|
||||
public Map<String, Object> getFormatAttr(Long id, String jsonStr, boolean isActivity) {
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
Map<String,Object> resultMap = new LinkedHashMap<>(3);
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>(3);
|
||||
|
||||
if(jsonObject == null || jsonObject.get("attrs") == null || jsonObject.getJSONArray("attrs").isEmpty()){
|
||||
resultMap.put("attr",new ArrayList<>());
|
||||
resultMap.put("value",new ArrayList<>());
|
||||
resultMap.put("header",new ArrayList<>());
|
||||
if (jsonObject == null || jsonObject.get("attrs") == null || jsonObject.getJSONArray("attrs").isEmpty()) {
|
||||
resultMap.put("attr", new ArrayList<>());
|
||||
resultMap.put("value", new ArrayList<>());
|
||||
resultMap.put("header", new ArrayList<>());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<FromatDetailDto> fromatDetailDTOList = JSON.parseArray(jsonObject.get("attrs").toString(),
|
||||
FromatDetailDto.class);
|
||||
|
||||
//fromatDetailDTOList
|
||||
DetailDto detailDto = this.attrFormat(fromatDetailDTOList);
|
||||
|
||||
List<Map<String,Object>> headerMapList = null;
|
||||
List<Map<String,Object>> valueMapList = new ArrayList<>();
|
||||
List<Map<String, Object>> headerMapList = null;
|
||||
List<Map<String, Object>> valueMapList = new ArrayList<>();
|
||||
String align = "center";
|
||||
Map<String,Object> headerMap = new LinkedHashMap<>();
|
||||
for (Map<String, Map<String,String>> map : detailDto.getRes()) {
|
||||
Map<String,String> detail = map.get("detail");
|
||||
String[] detailArr = detail.values().toArray(new String[]{});
|
||||
Map<String, Object> headerMap = new LinkedHashMap<>();
|
||||
for (Map<String, Map<String, String>> map : detailDto.getRes()) {
|
||||
Map<String, String> detail = map.get("detail");
|
||||
String[] detailArr = detail.values().toArray(new String[]{});
|
||||
Arrays.sort(detailArr);
|
||||
|
||||
String sku = String.join(",",detailArr);
|
||||
String sku = String.join(",", detailArr);
|
||||
|
||||
Map<String,Object> valueMap = new LinkedHashMap<>();
|
||||
Map<String, Object> valueMap = new LinkedHashMap<>();
|
||||
|
||||
List<String> detailKeys =
|
||||
detail.entrySet()
|
||||
@ -613,12 +610,12 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
|
||||
int i = 0;
|
||||
headerMapList = new ArrayList<>();
|
||||
for (String title : detailKeys){
|
||||
headerMap.put("title",title);
|
||||
headerMap.put("minWidth","130");
|
||||
headerMap.put("align",align);
|
||||
headerMap.put("key", "value" + (i+1));
|
||||
headerMap.put("slot", "value" + (i+1));
|
||||
for (String title : detailKeys) {
|
||||
headerMap.put("title", title);
|
||||
headerMap.put("minWidth", "130");
|
||||
headerMap.put("align", align);
|
||||
headerMap.put("key", "value" + (i + 1));
|
||||
headerMap.put("slot", "value" + (i + 1));
|
||||
headerMapList.add(ObjectUtil.clone(headerMap));
|
||||
i++;
|
||||
}
|
||||
@ -626,7 +623,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
String[] detailValues = detail.values().toArray(new String[]{});
|
||||
for (int j = 0; j < detailValues.length; j++) {
|
||||
String key = "value" + (j + 1);
|
||||
valueMap.put(key,detailValues[j]);
|
||||
valueMap.put(key, detailValues[j]);
|
||||
}
|
||||
// /** 拼团属性对应的金额 */
|
||||
// private BigDecimal pinkPrice;
|
||||
@ -637,41 +634,41 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
// private Integer pinkStock;
|
||||
//
|
||||
// private Integer seckillStock;
|
||||
valueMap.put("detail",detail);
|
||||
valueMap.put("pic","");
|
||||
valueMap.put("price",0);
|
||||
valueMap.put("cost",0);
|
||||
valueMap.put("ot_price",0);
|
||||
valueMap.put("stock",0);
|
||||
valueMap.put("bar_code","");
|
||||
valueMap.put("weight",0);
|
||||
valueMap.put("volume",0);
|
||||
valueMap.put("brokerage",0);
|
||||
valueMap.put("brokerage_two",0);
|
||||
valueMap.put("pink_price",0);
|
||||
valueMap.put("seckill_price",0);
|
||||
valueMap.put("pink_stock",0);
|
||||
valueMap.put("seckill_stock",0);
|
||||
if(id > 0){
|
||||
valueMap.put("detail", detail);
|
||||
valueMap.put("pic", "");
|
||||
valueMap.put("price", 0);
|
||||
valueMap.put("cost", 0);
|
||||
valueMap.put("ot_price", 0);
|
||||
valueMap.put("stock", 0);
|
||||
valueMap.put("bar_code", "");
|
||||
valueMap.put("weight", 0);
|
||||
valueMap.put("volume", 0);
|
||||
valueMap.put("brokerage", 0);
|
||||
valueMap.put("brokerage_two", 0);
|
||||
valueMap.put("pink_price", 0);
|
||||
valueMap.put("seckill_price", 0);
|
||||
valueMap.put("pink_stock", 0);
|
||||
valueMap.put("seckill_stock", 0);
|
||||
if (id > 0) {
|
||||
YxStoreProductAttrValue storeProductAttrValue = yxStoreProductAttrValueService
|
||||
.getOne(Wrappers.<YxStoreProductAttrValue>lambdaQuery()
|
||||
.eq(YxStoreProductAttrValue::getProductId,id)
|
||||
.eq(YxStoreProductAttrValue::getSku,sku));
|
||||
if(storeProductAttrValue != null){
|
||||
valueMap.put("pic",storeProductAttrValue.getImage());
|
||||
valueMap.put("price",storeProductAttrValue.getPrice());
|
||||
valueMap.put("cost",storeProductAttrValue.getCost());
|
||||
valueMap.put("ot_price",storeProductAttrValue.getOtPrice());
|
||||
valueMap.put("stock",storeProductAttrValue.getStock());
|
||||
valueMap.put("bar_code",storeProductAttrValue.getBarCode());
|
||||
valueMap.put("weight",storeProductAttrValue.getWeight());
|
||||
valueMap.put("volume",storeProductAttrValue.getVolume());
|
||||
valueMap.put("brokerage",storeProductAttrValue.getBrokerage());
|
||||
valueMap.put("brokerage_two",storeProductAttrValue.getBrokerageTwo());
|
||||
valueMap.put("pink_price",storeProductAttrValue.getPinkPrice());
|
||||
valueMap.put("seckill_price",storeProductAttrValue.getSeckillPrice());
|
||||
valueMap.put("pink_stock",storeProductAttrValue.getPinkStock());
|
||||
valueMap.put("seckill_stock",storeProductAttrValue.getSeckillStock());
|
||||
.eq(YxStoreProductAttrValue::getProductId, id)
|
||||
.eq(YxStoreProductAttrValue::getSku, sku));
|
||||
if (storeProductAttrValue != null) {
|
||||
valueMap.put("pic", storeProductAttrValue.getImage());
|
||||
valueMap.put("price", storeProductAttrValue.getPrice());
|
||||
valueMap.put("cost", storeProductAttrValue.getCost());
|
||||
valueMap.put("ot_price", storeProductAttrValue.getOtPrice());
|
||||
valueMap.put("stock", storeProductAttrValue.getStock());
|
||||
valueMap.put("bar_code", storeProductAttrValue.getBarCode());
|
||||
valueMap.put("weight", storeProductAttrValue.getWeight());
|
||||
valueMap.put("volume", storeProductAttrValue.getVolume());
|
||||
valueMap.put("brokerage", storeProductAttrValue.getBrokerage());
|
||||
valueMap.put("brokerage_two", storeProductAttrValue.getBrokerageTwo());
|
||||
valueMap.put("pink_price", storeProductAttrValue.getPinkPrice());
|
||||
valueMap.put("seckill_price", storeProductAttrValue.getSeckillPrice());
|
||||
valueMap.put("pink_stock", storeProductAttrValue.getPinkStock());
|
||||
valueMap.put("seckill_stock", storeProductAttrValue.getSeckillStock());
|
||||
}
|
||||
}
|
||||
|
||||
@ -679,27 +676,24 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
|
||||
}
|
||||
|
||||
this.addMap(headerMap,headerMapList,align,isActivity);
|
||||
this.addMap(headerMap, headerMapList, align, isActivity);
|
||||
|
||||
|
||||
resultMap.put("attr",fromatDetailDTOList);
|
||||
resultMap.put("value",valueMapList);
|
||||
resultMap.put("header",headerMapList);
|
||||
resultMap.put("attr", fromatDetailDTOList);
|
||||
resultMap.put("value", valueMapList);
|
||||
resultMap.put("header", headerMapList);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 计算产品数据
|
||||
*
|
||||
* @param attrs attrs
|
||||
* @return ProductResultDto
|
||||
*/
|
||||
private ProductResultDto computedProduct(List<ProductFormatDto> attrs){
|
||||
private ProductResultDto computedProduct(List<ProductFormatDto> attrs) {
|
||||
//取最小价格
|
||||
Double minPrice = attrs
|
||||
.stream()
|
||||
@ -725,7 +719,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
.reduce(Integer::sum)
|
||||
.orElse(0);
|
||||
|
||||
if(stock <= 0) {
|
||||
if (stock <= 0) {
|
||||
throw new YshopException("库存不能低于0");
|
||||
}
|
||||
|
||||
@ -739,158 +733,161 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
|
||||
/**
|
||||
* mapTobean
|
||||
*
|
||||
* @param listMap listMap
|
||||
* @return list
|
||||
*/
|
||||
private List<ProductFormatDto> ListMapToListBean(List<Map<String, Object>> listMap){
|
||||
private List<ProductFormatDto> ListMapToListBean(List<Map<String, Object>> listMap) {
|
||||
List<ProductFormatDto> list = new ArrayList<>();
|
||||
// 循环遍历出map对象
|
||||
for (Map<String, Object> m : listMap) {
|
||||
list.add(BeanUtil.mapToBean(m,ProductFormatDto.class,true));
|
||||
list.add(BeanUtil.mapToBean(m, ProductFormatDto.class, true));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加表头
|
||||
* @param headerMap headerMap
|
||||
*
|
||||
* @param headerMap headerMap
|
||||
* @param headerMapList headerMapList
|
||||
* @param align align
|
||||
* @param align align
|
||||
*/
|
||||
private void addMap(Map<String,Object> headerMap,List<Map<String,Object>> headerMapList,String align,boolean isActivity){
|
||||
headerMap.put("title","图片");
|
||||
private void addMap(Map<String, Object> headerMap, List<Map<String, Object>> headerMapList, String align, boolean isActivity) {
|
||||
headerMap.put("title", "图片");
|
||||
headerMap.put("slot", "pic");
|
||||
headerMap.put("align",align);
|
||||
headerMap.put("minWidth",80);
|
||||
headerMap.put("align", align);
|
||||
headerMap.put("minWidth", 80);
|
||||
headerMapList.add(ObjectUtil.clone(headerMap));
|
||||
|
||||
headerMap.put("title","售价");
|
||||
headerMap.put("title", "售价");
|
||||
headerMap.put("slot", "price");
|
||||
headerMap.put("align",align);
|
||||
headerMap.put("minWidth",120);
|
||||
headerMap.put("align", align);
|
||||
headerMap.put("minWidth", 120);
|
||||
headerMapList.add(ObjectUtil.clone(headerMap));
|
||||
|
||||
headerMap.put("title","成本价");
|
||||
headerMap.put("title", "成本价");
|
||||
headerMap.put("slot", "cost");
|
||||
headerMap.put("align",align);
|
||||
headerMap.put("minWidth",140);
|
||||
headerMap.put("align", align);
|
||||
headerMap.put("minWidth", 140);
|
||||
headerMapList.add(ObjectUtil.clone(headerMap));
|
||||
|
||||
headerMap.put("title","原价");
|
||||
headerMap.put("title", "原价");
|
||||
headerMap.put("slot", "ot_price");
|
||||
headerMap.put("align",align);
|
||||
headerMap.put("minWidth",140);
|
||||
headerMap.put("align", align);
|
||||
headerMap.put("minWidth", 140);
|
||||
headerMapList.add(ObjectUtil.clone(headerMap));
|
||||
|
||||
headerMap.put("title","库存");
|
||||
headerMap.put("title", "库存");
|
||||
headerMap.put("slot", "stock");
|
||||
headerMap.put("align",align);
|
||||
headerMap.put("minWidth",140);
|
||||
headerMap.put("align", align);
|
||||
headerMap.put("minWidth", 140);
|
||||
headerMapList.add(ObjectUtil.clone(headerMap));
|
||||
|
||||
headerMap.put("title","产品编号");
|
||||
headerMap.put("title", "产品编号");
|
||||
headerMap.put("slot", "bar_code");
|
||||
headerMap.put("align",align);
|
||||
headerMap.put("minWidth",140);
|
||||
headerMap.put("align", align);
|
||||
headerMap.put("minWidth", 140);
|
||||
headerMapList.add(ObjectUtil.clone(headerMap));
|
||||
|
||||
headerMap.put("title","重量(KG)");
|
||||
headerMap.put("title", "重量(KG)");
|
||||
headerMap.put("slot", "weight");
|
||||
headerMap.put("align",align);
|
||||
headerMap.put("minWidth",140);
|
||||
headerMap.put("align", align);
|
||||
headerMap.put("minWidth", 140);
|
||||
headerMapList.add(ObjectUtil.clone(headerMap));
|
||||
|
||||
headerMap.put("title","体积(m³)");
|
||||
headerMap.put("title", "体积(m³)");
|
||||
headerMap.put("slot", "volume");
|
||||
headerMap.put("align",align);
|
||||
headerMap.put("minWidth",140);
|
||||
headerMap.put("align", align);
|
||||
headerMap.put("minWidth", 140);
|
||||
|
||||
if(isActivity){
|
||||
headerMap.put("title","拼团价");
|
||||
if (isActivity) {
|
||||
headerMap.put("title", "拼团价");
|
||||
headerMap.put("slot", "pink_price");
|
||||
headerMap.put("align",align);
|
||||
headerMap.put("minWidth",140);
|
||||
headerMap.put("align", align);
|
||||
headerMap.put("minWidth", 140);
|
||||
headerMapList.add(ObjectUtil.clone(headerMap));
|
||||
|
||||
headerMap.put("title","拼团活动库存");
|
||||
headerMap.put("title", "拼团活动库存");
|
||||
headerMap.put("slot", "pink_stock");
|
||||
headerMap.put("align",align);
|
||||
headerMap.put("minWidth",140);
|
||||
headerMap.put("align", align);
|
||||
headerMap.put("minWidth", 140);
|
||||
headerMapList.add(ObjectUtil.clone(headerMap));
|
||||
|
||||
headerMap.put("title","秒杀价");
|
||||
headerMap.put("title", "秒杀价");
|
||||
headerMap.put("slot", "seckill_price");
|
||||
headerMap.put("align",align);
|
||||
headerMap.put("minWidth",140);
|
||||
headerMap.put("align", align);
|
||||
headerMap.put("minWidth", 140);
|
||||
headerMapList.add(ObjectUtil.clone(headerMap));
|
||||
|
||||
headerMap.put("title","秒杀活动库存");
|
||||
headerMap.put("title", "秒杀活动库存");
|
||||
headerMap.put("slot", "seckill_stock");
|
||||
headerMap.put("align",align);
|
||||
headerMap.put("minWidth",140);
|
||||
headerMap.put("align", align);
|
||||
headerMap.put("minWidth", 140);
|
||||
headerMapList.add(ObjectUtil.clone(headerMap));
|
||||
}
|
||||
|
||||
headerMap.put("title","操作");
|
||||
headerMap.put("title", "操作");
|
||||
headerMap.put("slot", "action");
|
||||
headerMap.put("align",align);
|
||||
headerMap.put("minWidth",70);
|
||||
headerMap.put("align", align);
|
||||
headerMap.put("minWidth", 70);
|
||||
headerMapList.add(ObjectUtil.clone(headerMap));
|
||||
}
|
||||
|
||||
/**
|
||||
* 组合规则属性算法
|
||||
*
|
||||
* @param fromatDetailDTOList
|
||||
* @return DetailDto
|
||||
*/
|
||||
private DetailDto attrFormat(List<FromatDetailDto> fromatDetailDTOList){
|
||||
private DetailDto attrFormat(List<FromatDetailDto> fromatDetailDTOList) {
|
||||
|
||||
List<String> data = new ArrayList<>();
|
||||
List<Map<String,Map<String,String>>> res = new ArrayList<>();
|
||||
List<Map<String, Map<String, String>>> res = new ArrayList<>();
|
||||
|
||||
fromatDetailDTOList.stream()
|
||||
.map(FromatDetailDto::getDetail)
|
||||
.forEach(i -> {
|
||||
if(i == null || i.isEmpty()) {
|
||||
if (i == null || i.isEmpty()) {
|
||||
throw new YshopException("请至少添加一个规格值哦");
|
||||
}
|
||||
String str = ArrayUtil.join(i.toArray(),",");
|
||||
if(str.contains("-")) {
|
||||
String str = ArrayUtil.join(i.toArray(), ",");
|
||||
if (str.contains("-")) {
|
||||
throw new YshopException("规格值里包含'-',请重新添加");
|
||||
}
|
||||
});
|
||||
|
||||
if(fromatDetailDTOList.size() > 1){
|
||||
for (int i=0; i < fromatDetailDTOList.size() - 1;i++){
|
||||
if(i == 0) {
|
||||
if (fromatDetailDTOList.size() > 1) {
|
||||
for (int i = 0; i < fromatDetailDTOList.size() - 1; i++) {
|
||||
if (i == 0) {
|
||||
data = fromatDetailDTOList.get(i).getDetail();
|
||||
}
|
||||
List<String> tmp = new LinkedList<>();
|
||||
for (String v : data) {
|
||||
for (String g : fromatDetailDTOList.get(i+1).getDetail()) {
|
||||
for (String g : fromatDetailDTOList.get(i + 1).getDetail()) {
|
||||
String rep2 = "";
|
||||
if(i == 0){
|
||||
if (i == 0) {
|
||||
rep2 = fromatDetailDTOList.get(i).getValue() + "_" + v + "-"
|
||||
+ fromatDetailDTOList.get(i+1).getValue() + "_" + g;
|
||||
}else{
|
||||
+ fromatDetailDTOList.get(i + 1).getValue() + "_" + g;
|
||||
} else {
|
||||
rep2 = v + "-"
|
||||
+ fromatDetailDTOList.get(i+1).getValue() + "_" + g;
|
||||
+ fromatDetailDTOList.get(i + 1).getValue() + "_" + g;
|
||||
}
|
||||
|
||||
tmp.add(rep2);
|
||||
|
||||
if(i == fromatDetailDTOList.size() - 2){
|
||||
Map<String,Map<String,String>> rep4 = new LinkedHashMap<>();
|
||||
Map<String,String> reptemp = new LinkedHashMap<>();
|
||||
if (i == fromatDetailDTOList.size() - 2) {
|
||||
Map<String, Map<String, String>> rep4 = new LinkedHashMap<>();
|
||||
Map<String, String> reptemp = new LinkedHashMap<>();
|
||||
for (String h : Arrays.asList(rep2.split("-"))) {
|
||||
List<String> rep3 = Arrays.asList(h.split("_"));
|
||||
if(rep3.size() > 1){
|
||||
reptemp.put(rep3.get(0),rep3.get(1));
|
||||
}else{
|
||||
reptemp.put(rep3.get(0),"");
|
||||
if (rep3.size() > 1) {
|
||||
reptemp.put(rep3.get(0), rep3.get(1));
|
||||
} else {
|
||||
reptemp.put(rep3.get(0), "");
|
||||
}
|
||||
}
|
||||
rep4.put("detail",reptemp);
|
||||
rep4.put("detail", reptemp);
|
||||
|
||||
res.add(rep4);
|
||||
}
|
||||
@ -898,23 +895,23 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
|
||||
}
|
||||
|
||||
if(!tmp.isEmpty()){
|
||||
if (!tmp.isEmpty()) {
|
||||
data = tmp;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
List<String> dataArr = new ArrayList<>();
|
||||
for (FromatDetailDto fromatDetailDTO : fromatDetailDTOList) {
|
||||
for (String str : fromatDetailDTO.getDetail()) {
|
||||
Map<String,Map<String,String>> map2 = new LinkedHashMap<>();
|
||||
dataArr.add(fromatDetailDTO.getValue()+"_"+str);
|
||||
Map<String,String> map1 = new LinkedHashMap<>();
|
||||
map1.put(fromatDetailDTO.getValue(),str);
|
||||
map2.put("detail",map1);
|
||||
Map<String, Map<String, String>> map2 = new LinkedHashMap<>();
|
||||
dataArr.add(fromatDetailDTO.getValue() + "_" + str);
|
||||
Map<String, String> map1 = new LinkedHashMap<>();
|
||||
map1.put(fromatDetailDTO.getValue(), str);
|
||||
map2.put("detail", map1);
|
||||
res.add(map2);
|
||||
}
|
||||
}
|
||||
String s = StrUtil.join("-",dataArr);
|
||||
String s = StrUtil.join("-", dataArr);
|
||||
data.add(s);
|
||||
}
|
||||
|
||||
@ -925,4 +922,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
return detailDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteForwardImg(Long id) {
|
||||
baseMapper.deleteForwardImg(id, "_product_detail_wap");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user