Commit 4db91359 authored by shiyu's avatar shiyu

泉库后台商品详情展示图片问题优化

parent bcf37b52
...@@ -170,9 +170,10 @@ public class ItemVo implements Entity { ...@@ -170,9 +170,10 @@ public class ItemVo implements Entity {
public static final ItemVo fromItem(Item item) { public static final ItemVo fromItem(Item item) {
ItemVo itemVo = new ItemVo(); ItemVo itemVo = new ItemVo();
try {
EntityMapper.copyAttribute(item, itemVo); EntityMapper.copyAttribute(item, itemVo);
long price = item.getPrice() == null ? 0 : item.getPrice(); long price = item.getPrice() == null ? 0 : item.getPrice();
itemVo.setPrice(price / (double)100); itemVo.setPrice(price / (double) 100);
itemVo.setStateName(ItemStateEnum.getNameByCode(item.getState())); itemVo.setStateName(ItemStateEnum.getNameByCode(item.getState()));
itemVo.setId(item.getId()); itemVo.setId(item.getId());
itemVo.setName(item.getName()); itemVo.setName(item.getName());
...@@ -182,8 +183,8 @@ public class ItemVo implements Entity { ...@@ -182,8 +183,8 @@ public class ItemVo implements Entity {
itemVo.setSort(item.getSort()); itemVo.setSort(item.getSort());
itemVo.setShareImage(item.getShareImage()); itemVo.setShareImage(item.getShareImage());
itemVo.setDetail(item.getDetail()); itemVo.setDetail(item.getDetail());
itemVo.setBidTime(item.getBidTime()!=null?DateUtils.toString(item.getBidTime()):""); itemVo.setBidTime(item.getBidTime() != null ? DateUtils.toString(item.getBidTime()) : "");
if (!StringUtils.isEmpty(item.getImages())){ if (!StringUtils.isEmpty(item.getImages())) {
itemVo.setImages(item.getImages().split(";")); itemVo.setImages(item.getImages().split(";"));
} }
itemVo.setIsDeleted(item.getIsDeleted()); itemVo.setIsDeleted(item.getIsDeleted());
...@@ -196,6 +197,16 @@ public class ItemVo implements Entity { ...@@ -196,6 +197,16 @@ public class ItemVo implements Entity {
topImage = item.getImages().split(";")[0]; topImage = item.getImages().split(";")[0];
} }
itemVo.setTopImage(topImage); itemVo.setTopImage(topImage);
String extra = item.getExtra();
if (com.xxdxxs.utils.StringUtils.hasLength(extra)) {
Map<String, Object> map = JsonUtils.toMap(extra);
itemVo.setDiameter(map.get("diameter") == null ? "" : map.get("diameter").toString());
itemVo.setThickness(map.get("thickness") == null ? "" : map.get("thickness").toString());
itemVo.setWeight(map.get("weight") == null ? "" : map.get("weight").toString());
}
} catch (Exception e) {
e.printStackTrace();
}
return itemVo; return itemVo;
} }
......
...@@ -93,7 +93,7 @@ public class ItemServiceImpl implements ItemService { ...@@ -93,7 +93,7 @@ public class ItemServiceImpl implements ItemService {
item = itemDao.findDetails(id); item = itemDao.findDetails(id);
} }
} }
ItemVo itemVo = ItemVo.convertEntity(item); ItemVo itemVo = ItemVo.fromItem(item);
//用于展示商品归属的类目(页面级联下拉控件数据展示) //用于展示商品归属的类目(页面级联下拉控件数据展示)
Integer categoryId = item.getCid(); Integer categoryId = item.getCid();
Category category = categoryDao.findById(categoryId); Category category = categoryDao.findById(categoryId);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment