Authored by mali

图片采用相对路径存储

... ... @@ -5,6 +5,8 @@ import com.yoho.core.common.utils.DateUtil;
import com.yoho.ufo.dal.BrandMapper;
import com.yoho.ufo.model.brand.Brand;
import com.yoho.ufo.service.IBrandService;
import com.yoho.ufo.util.ImagesConstant;
import com.yoho.ufo.util.ImagesHelper;
import com.yoho.ufo.util.OrikaUtils;
import com.yohobuy.ufo.model.common.PageModel;
import com.yohobuy.ufo.model.common.PageResponseBO;
... ... @@ -36,6 +38,7 @@ public class BrandServiceImpl implements IBrandService {
Brand brand = OrikaUtils.map(brandRequestBo, Brand.class);
brand.setEditTime(DateUtil.currentTimeSeconds());
brand.setEditPid(getUserId());
brand.setBrandLogo(ImagesHelper.getImageRelativeUrl(brand.getBrandLogo(), ImagesConstant.BUCKET_BRAND_LOGO));
if (brand.getId() == null || brand.getId() == 0) {
// 默认开启状态
brand.setStatus(1);
... ... @@ -64,6 +67,7 @@ public class BrandServiceImpl implements IBrandService {
for (Brand brand1 : brands) {
responseBo = OrikaUtils.map(brand1, BrandResponseBo.class);
responseBo.setCreateTime(DateUtil.getDateStrBySecond(brand1.getCreateTime(), DateUtil.DATE_TIME_FORMAT));
responseBo.setBrandLogo(ImagesHelper.getImageAbsoluteUrl(brand1.getBrandLogo(), ImagesConstant.BUCKET_BRAND_LOGO));
brandResponseBos.add(responseBo);
}
return new PageResponseBO<>(count, brandResponseBos, pageModel.getCurrentPage(), pageModel.getPageSize());
... ... @@ -76,6 +80,7 @@ public class BrandServiceImpl implements IBrandService {
Brand brand = brandMapper.selectOneById(id);
BrandResponseBo brandResponseBo = OrikaUtils.map(brand, BrandResponseBo.class);
brandResponseBo.setCreateTime(DateUtil.getDateStrBySecond(brand.getCreateTime(), DateUtil.DATE_TIME_FORMAT));
brandResponseBo.setBrandLogo(ImagesHelper.getImageAbsoluteUrl(brand.getBrandLogo(), ImagesConstant.BUCKET_BRAND_LOGO));
return brandResponseBo;
}
... ...
... ... @@ -12,6 +12,8 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.core.dal.datasource.annotation.Database;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.ufo.event.model.StorageNumEvent;
import com.yoho.ufo.util.ImagesConstant;
import com.yoho.ufo.util.ImagesHelper;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
... ... @@ -140,7 +142,7 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
} else {
gi.setIsDefault("N");
}
gi.setImageUrl(image);
gi.setImageUrl(ImagesHelper.getImageRelativeUrl(image, ImagesConstant.BUCKET_GOODS_IMG));
gi.setOrderBy(i + 1);
goodsImagesList.add(gi);
}
... ... @@ -167,7 +169,7 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
g.setId(bo.getGoodsId());
g.setIsDefault("Y");
if (CollectionUtils.isNotEmpty(bo.getImageUrlList())) {
g.setColorImage(bo.getImageUrlList().get(0));
g.setColorImage(ImagesHelper.getImageRelativeUrl(bo.getImageUrlList().get(0), ImagesConstant.BUCKET_GOODS_IMG));
}
return g;
}
... ... @@ -281,7 +283,7 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
bo.setColorId(goods.getColorId());
}
if (CollectionUtils.isNotEmpty(goodsImages)) {
bo.setImageUrlList(CollectionUtil.map(goodsImages, GoodsImages::getImageUrl));
bo.setImageUrlList(CollectionUtil.map(goodsImages, item -> ImagesHelper.getImageAbsoluteUrl(item.getImageUrl(), ImagesConstant.BUCKET_GOODS_IMG)));
}
if (CollectionUtils.isNotEmpty(storages)) {
bo.setStorageIdList(CollectionUtil.map(storages, Storage::getId));
... ... @@ -333,7 +335,7 @@ public static void main(String[] args) {
// 图片
Goods goods = goodsMap.get(respBo.getId());
if (goods != null) {
respBo.setColorImage(goods.getColorImage());
respBo.setColorImage(ImagesHelper.getImageAbsoluteUrl(goods.getColorImage(), ImagesConstant.BUCKET_GOODS_IMG));
}
// 分类
ProductSort maxSort = productSortMap.get(respBo.getMaxSortId());
... ...
... ... @@ -67,7 +67,7 @@
realInputName: "brandLogo",
url: contextPath + '/fileupload/upload',
queryParams: {
bucket: "goodsimg"
bucket: "brandLogo"
},
onBeforeSubmit: function () {
$.messager.progress({
... ...