Authored by caoyan

商品详情增加传图模块

... ... @@ -12,6 +12,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONArray;
import com.google.common.collect.Lists;
import com.yoho.ufo.dal.BrandMapper;
import com.yoho.ufo.dal.SizePoolDetailMapper;
... ... @@ -70,13 +71,14 @@ public class SizePoolService implements ISizePoolService{
}
checkIsExistBrand(bo);
List<SizePoolImage> imageList = JSONArray.parseArray(bo.getImageInfoList(), SizePoolImage.class);
SizePool sizePool = new SizePool();
sizePool.setStatus(STATUS_OPEN);//默认开启
sizePool.setRangeType(bo.getRangeType());
sizePool.setImageUrl(bo.getImageInfoList().get(0).getImageUrl());
sizePool.setImageWidth(bo.getImageInfoList().get(0).getImageWidth());
sizePool.setImageHeight(bo.getImageInfoList().get(0).getImageHeight());
sizePool.setImageUrl(imageList.get(0).getImageUrl());
sizePool.setImageWidth(imageList.get(0).getImageWidth());
sizePool.setImageHeight(imageList.get(0).getImageHeight());
sizePool.setUpdateTime(DateUtil.getCurrentTimeSeconds());
sizePool.setUpdateUid(new UserHelper().getUserId());
... ... @@ -85,15 +87,15 @@ public class SizePoolService implements ISizePoolService{
return result;
}
saveSizePoolImage(bo.getImageInfoList(), sizePool.getId());
saveSizePoolImage(imageList, sizePool.getId());
return batchAddSizePoolDetail(sizePool.getId(), bo);
}
private void saveSizePoolImage(List<SizePoolImageBo> imageInfoList, Integer sizePoolId) {
private void saveSizePoolImage(List<SizePoolImage> imageInfoList, Integer sizePoolId) {
List<SizePoolImage> list = Lists.newArrayList();
for(SizePoolImageBo item : imageInfoList) {
for(SizePoolImage item : imageInfoList) {
SizePoolImage image = new SizePoolImage();
image.setSizePoolId(sizePoolId);
image.setImageUrl(item.getImageUrl());
... ... @@ -115,11 +117,13 @@ public class SizePoolService implements ISizePoolService{
checkIsExistBrand(bo);
List<SizePoolImage> imageList = JSONArray.parseArray(bo.getImageInfoList(), SizePoolImage.class);
SizePool sizePool = new SizePool();
sizePool.setId(bo.getId());
sizePool.setImageUrl(bo.getImageInfoList().get(0).getImageUrl());
sizePool.setImageWidth(bo.getImageInfoList().get(0).getImageWidth());
sizePool.setImageHeight(bo.getImageInfoList().get(0).getImageHeight());
sizePool.setImageUrl(imageList.get(0).getImageUrl());
sizePool.setImageWidth(imageList.get(0).getImageWidth());
sizePool.setImageHeight(imageList.get(0).getImageHeight());
sizePool.setUpdateTime(DateUtil.getCurrentTimeSeconds());
sizePool.setUpdateUid(new UserHelper().getUserId());
... ...