Commit 74232b0e authored by shiyu's avatar shiyu

成交详情

parent c84bbb49
......@@ -14,6 +14,8 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
public class MediaUtil {
......@@ -87,6 +89,58 @@ public class MediaUtil {
return null;
}
/**
* 获取展示图片
*
* @param images
* @param videos
* @return
*/
public static Map<String, Object> getHomePageImage(String images, String videos) {
Map<String, Object> homePageMap = new HashMap<>();
homePageMap.put("url", "");
homePageMap.put("type", 2);
homePageMap.put("width", "0");
homePageMap.put("height", "0");
if (org.apache.commons.lang3.StringUtils.isNotBlank(images)) {
String[] image = images.split(";");
homePageMap.put("url", image[0]);
if (image[0].contains("_")) {
homePageMap = getAspect(image[0]);
homePageMap.put("url", image[0]);
homePageMap.put("type", 2);
}
}
if (org.apache.commons.lang3.StringUtils.isNotBlank(videos)) {
String[] vedioImage = videos.split(";");
if (vedioImage[0].contains(",")) {
String[] video = vedioImage[0].split(",");
homePageMap = getAspect(video[1]);
homePageMap.put("url", video[1]);
homePageMap.put("type", 1);
}
}
return homePageMap;
}
/**
* 获取图片的长宽
*
* @param image
* @return
*/
public static Map<String, Object> getAspect(String image) {
Map<String, Object> map = new HashMap<>();
String[] _image = image.split("_");
String[] infoImage = _image[1].split("\\.");
String[] result = infoImage[0].split("x");
map.put("width", result[0]);
map.put("height", result[1]);
return map;
}
public static void main(String[] args) {
String vedioUrl = "https://cdn.wanwudezhi.com/static/web-static/video/53596700878a572ca4fae35243aaa819.mp4";
String url = getImageByCutVedio(vedioUrl);
......
......@@ -5,6 +5,7 @@ import com.github.pagehelper.PageInfo;
import com.wwdz.ch.core.entity.Chart;
import com.wwdz.ch.core.type.PageSearchResult;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.core.util.MediaUtil;
import com.wwdz.ch.db.dao.BidRecordDao;
import com.wwdz.ch.db.dao.CategoryDao;
import com.wwdz.ch.db.dao.ItemDao;
......@@ -124,6 +125,7 @@ public class QueryPriceServiceImpl implements QueryPriceService {
map.put("bidTime", i.getBidTime());
map.put("price", StringUtil.formatAmount(String.valueOf(Math.round(i.getPrice() / (double) 100))));
map.put("platform", "电商平台");
map.put("homePageImage", MediaUtil.getHomePageImage(i.getImages(), i.getVideos()));
map.put("detail", i.getDetail());
if (StringUtils.hasLength(i.getTopImage())) {
map.put("image", i.getTopImage());
......
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