|
@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
@@ -185,6 +186,15 @@ public class GoodsServiceImpl implements GoodsService {
|
|
galleryEntity.setGoodsId(id);
|
|
galleryEntity.setGoodsId(id);
|
|
goodsGalleryDao.save(galleryEntity);
|
|
goodsGalleryDao.save(galleryEntity);
|
|
}
|
|
}
|
|
|
|
+ }else if(ObjectUtils.isEmpty(goods.getGoodsImgList()) && !ObjectUtils.isEmpty(goods.getListPicUrl())){
|
|
|
|
+ String[] images = goods.getListPicUrl().split("#\\$#");
|
|
|
|
+ for (int i = 0; i < images.length; i++) {
|
|
|
|
+ GoodsGalleryEntity galleryEntity = new GoodsGalleryEntity();
|
|
|
|
+ galleryEntity.setGoodsId(goods.getId());
|
|
|
|
+ galleryEntity.setImgUrl(images[i]);
|
|
|
|
+ galleryEntity.setSortOrder(i);
|
|
|
|
+ goodsGalleryDao.save(galleryEntity);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
//保存商品详情页面显示的属性
|
|
//保存商品详情页面显示的属性
|
|
@@ -283,41 +293,19 @@ public class GoodsServiceImpl implements GoodsService {
|
|
galleryEntity.setGoodsId(goods.getId());
|
|
galleryEntity.setGoodsId(goods.getId());
|
|
goodsGalleryDao.save(galleryEntity);
|
|
goodsGalleryDao.save(galleryEntity);
|
|
}
|
|
}
|
|
|
|
+ }else if(ObjectUtils.isEmpty(goods.getGoodsImgList()) && !ObjectUtils.isEmpty(goods.getListPicUrl())){
|
|
|
|
+ String[] images = goods.getListPicUrl().split("#\\$#");
|
|
|
|
+ for (int i = 0; i < images.length; i++) {
|
|
|
|
+ GoodsGalleryEntity galleryEntity = new GoodsGalleryEntity();
|
|
|
|
+ galleryEntity.setGoodsId(goods.getId());
|
|
|
|
+ galleryEntity.setImgUrl(images[i]);
|
|
|
|
+ galleryEntity.setSortOrder(i);
|
|
|
|
+ goodsGalleryDao.save(galleryEntity);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return goods.getId();
|
|
return goods.getId();
|
|
}
|
|
}
|
|
|
|
|
|
-// @Override
|
|
|
|
-// @Transactional
|
|
|
|
-// public int update(GoodsEntity goods) {
|
|
|
|
-// SysUserEntity user = ShiroUtils.getUserEntity();
|
|
|
|
-// List<GoodsAttributeEntity> attributeEntityList = goods.getAttributeEntityList();
|
|
|
|
-// if (null != attributeEntityList && attributeEntityList.size() > 0) {
|
|
|
|
-// for (GoodsAttributeEntity goodsAttributeEntity : attributeEntityList) {
|
|
|
|
-// int result = goodsAttributeDao.updateByGoodsIdAttributeId(goodsAttributeEntity);
|
|
|
|
-// if (result == 0) {
|
|
|
|
-// goodsAttributeDao.save(goodsAttributeEntity);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// goods.setUpdateUserId(user.getUserId());
|
|
|
|
-// goods.setUpdateTime(new Date());
|
|
|
|
-// //商品轮播图
|
|
|
|
-// //修改时全删全插
|
|
|
|
-// List<GoodsGalleryEntity> galleryEntityList = goods.getGoodsImgList();
|
|
|
|
-// Map<String, Integer> map = new HashMap<String, Integer>();
|
|
|
|
-// map.put("goodsId", goods.getId());
|
|
|
|
-// goodsGalleryDao.deleteByGoodsId(map);
|
|
|
|
-//
|
|
|
|
-// if (null != galleryEntityList && galleryEntityList.size() > 0) {
|
|
|
|
-// for (GoodsGalleryEntity galleryEntity : galleryEntityList) {
|
|
|
|
-// galleryEntity.setGoodsId(goods.getId());
|
|
|
|
-// goodsGalleryDao.save(galleryEntity);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// return goodsDao.update(goods);
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public int delete(Integer id) {
|
|
public int delete(Integer id) {
|
|
CurrentUserLoginVo user = ShiroUtils.getUserEntity();
|
|
CurrentUserLoginVo user = ShiroUtils.getUserEntity();
|