Authored by caoyan

商品详情增加传图模块

@@ -12,6 +12,7 @@ import org.slf4j.LoggerFactory; @@ -12,6 +12,7 @@ import org.slf4j.LoggerFactory;
12 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.stereotype.Service; 13 import org.springframework.stereotype.Service;
14 14
  15 +import com.alibaba.fastjson.JSONArray;
15 import com.google.common.collect.Lists; 16 import com.google.common.collect.Lists;
16 import com.yoho.ufo.dal.BrandMapper; 17 import com.yoho.ufo.dal.BrandMapper;
17 import com.yoho.ufo.dal.SizePoolDetailMapper; 18 import com.yoho.ufo.dal.SizePoolDetailMapper;
@@ -70,13 +71,14 @@ public class SizePoolService implements ISizePoolService{ @@ -70,13 +71,14 @@ public class SizePoolService implements ISizePoolService{
70 } 71 }
71 72
72 checkIsExistBrand(bo); 73 checkIsExistBrand(bo);
  74 + List<SizePoolImage> imageList = JSONArray.parseArray(bo.getImageInfoList(), SizePoolImage.class);
73 75
74 SizePool sizePool = new SizePool(); 76 SizePool sizePool = new SizePool();
75 sizePool.setStatus(STATUS_OPEN);//默认开启 77 sizePool.setStatus(STATUS_OPEN);//默认开启
76 sizePool.setRangeType(bo.getRangeType()); 78 sizePool.setRangeType(bo.getRangeType());
77 - sizePool.setImageUrl(bo.getImageInfoList().get(0).getImageUrl());  
78 - sizePool.setImageWidth(bo.getImageInfoList().get(0).getImageWidth());  
79 - sizePool.setImageHeight(bo.getImageInfoList().get(0).getImageHeight()); 79 + sizePool.setImageUrl(imageList.get(0).getImageUrl());
  80 + sizePool.setImageWidth(imageList.get(0).getImageWidth());
  81 + sizePool.setImageHeight(imageList.get(0).getImageHeight());
80 sizePool.setUpdateTime(DateUtil.getCurrentTimeSeconds()); 82 sizePool.setUpdateTime(DateUtil.getCurrentTimeSeconds());
81 sizePool.setUpdateUid(new UserHelper().getUserId()); 83 sizePool.setUpdateUid(new UserHelper().getUserId());
82 84
@@ -85,15 +87,15 @@ public class SizePoolService implements ISizePoolService{ @@ -85,15 +87,15 @@ public class SizePoolService implements ISizePoolService{
85 return result; 87 return result;
86 } 88 }
87 89
88 - saveSizePoolImage(bo.getImageInfoList(), sizePool.getId()); 90 + saveSizePoolImage(imageList, sizePool.getId());
89 91
90 return batchAddSizePoolDetail(sizePool.getId(), bo); 92 return batchAddSizePoolDetail(sizePool.getId(), bo);
91 93
92 } 94 }
93 95
94 - private void saveSizePoolImage(List<SizePoolImageBo> imageInfoList, Integer sizePoolId) { 96 + private void saveSizePoolImage(List<SizePoolImage> imageInfoList, Integer sizePoolId) {
95 List<SizePoolImage> list = Lists.newArrayList(); 97 List<SizePoolImage> list = Lists.newArrayList();
96 - for(SizePoolImageBo item : imageInfoList) { 98 + for(SizePoolImage item : imageInfoList) {
97 SizePoolImage image = new SizePoolImage(); 99 SizePoolImage image = new SizePoolImage();
98 image.setSizePoolId(sizePoolId); 100 image.setSizePoolId(sizePoolId);
99 image.setImageUrl(item.getImageUrl()); 101 image.setImageUrl(item.getImageUrl());
@@ -115,11 +117,13 @@ public class SizePoolService implements ISizePoolService{ @@ -115,11 +117,13 @@ public class SizePoolService implements ISizePoolService{
115 117
116 checkIsExistBrand(bo); 118 checkIsExistBrand(bo);
117 119
  120 + List<SizePoolImage> imageList = JSONArray.parseArray(bo.getImageInfoList(), SizePoolImage.class);
  121 +
118 SizePool sizePool = new SizePool(); 122 SizePool sizePool = new SizePool();
119 sizePool.setId(bo.getId()); 123 sizePool.setId(bo.getId());
120 - sizePool.setImageUrl(bo.getImageInfoList().get(0).getImageUrl());  
121 - sizePool.setImageWidth(bo.getImageInfoList().get(0).getImageWidth());  
122 - sizePool.setImageHeight(bo.getImageInfoList().get(0).getImageHeight()); 124 + sizePool.setImageUrl(imageList.get(0).getImageUrl());
  125 + sizePool.setImageWidth(imageList.get(0).getImageWidth());
  126 + sizePool.setImageHeight(imageList.get(0).getImageHeight());
123 sizePool.setUpdateTime(DateUtil.getCurrentTimeSeconds()); 127 sizePool.setUpdateTime(DateUtil.getCurrentTimeSeconds());
124 sizePool.setUpdateUid(new UserHelper().getUserId()); 128 sizePool.setUpdateUid(new UserHelper().getUserId());
125 129