Authored by wangnan9279

goods

... ... @@ -35,16 +35,28 @@ public class GoodsCoverHelper {
return;
}
String imagesUrl = "";
String imagesUrlNotNull = "";
String cover1 = "";
String cover2 = "";
boolean flag = true;
for (HashMap<String, Object> goodsMap : goodsList) {
// 如果此goods是is_default=Y的,用这个goods
if ("Y".equals(MapUtils.getString(goodsMap, "is_default"))) {
imagesUrl = MapUtils.getString(goodsMap, "images_url");
cover1 = MapUtils.getString(goodsMap, "cover_1");
cover2 = MapUtils.getString(goodsMap, "cover_2");
break;
if (StringUtils.isNotBlank(imagesUrl)) {
break;
}
}
//找一个不为空的imagesUrl
if (flag && StringUtils.isNotBlank(MapUtils.getString(goodsMap, "images_url"))) {
imagesUrlNotNull = MapUtils.getString(goodsMap, "images_url");
flag = false;
}
}
if (StringUtils.isBlank(imagesUrl)) {
imagesUrl = imagesUrlNotNull;
}
cover1 = StringUtils.isNotBlank(cover1) ? cover1 : imagesUrl;
cover2 = StringUtils.isNotBlank(cover2) ? cover2 : imagesUrl;
... ...