//1-普通无库存
if (screenType == 1) {
XSSFSheet noStock = wb.createSheet(waybillNo + "无库存页面截图" + sort);
XSSFSheet unsaleable = wb.createSheet(waybillNo + "不可售截图" + sort);
XSSFSheet saleRecord = wb.createSheet(waybillNo + "贩卖记录" + sort);
XSSFSheet storeInfomation = wb.createSheet(waybillNo + "店铺信息" + sort);
//插入无库存截图
log.info("无库存截图===={}" + JSON.toJSONString(detailNoRegionList.get(i).get("lowStockScreen")));
if (!CommUtil.toString(detailNoRegionList.get(i).get("lowStockScreen")).equals("")) {
URL urlConet = new URL(
CommUtil.toString(detailNoRegionList.get(i).get("lowStockScreen")));
con = (HttpURLConnection) urlConet.openConnection();
con.setRequestMethod("GET");
con.setConnectTimeout(4 * 1000);
inStream = con.getInputStream();// 通过输入流获取图片数据
byteArrayOut = new ByteArrayOutputStream();
// 将图片读到BufferedImage
bufferImg = ImageIO.read(inStream);
// 将图片写入流中
ImageIO.write(bufferImg, "png", byteArrayOut);
XSSFDrawing patriarch = (XSSFDrawing) noStock.createDrawingPatriarch();
//原始高度
int width = bufferImg.getWidth();
int height = bufferImg.getHeight();
XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, 0, 0, 0, 0);
// 插入图片
XSSFPicture pict = patriarch.createPicture(anchor, wb
.addPicture(byteArrayOut.toByteArray(), XSSFWorkbook.PICTURE_TYPE_PNG));
pict.resize(20, ((double) height / (double) width * 80D));
}
log.info("不可售截图===={}" + JSON.toJSONString(detailNoRegionList.get(i).get("notForSaleScreen")));
if (!CommUtil.toString(detailNoRegionList.get(i).get("notForSaleScreen")).equals("")) {
//不可售
String noSale = CommUtil.toString(detailNoRegionList.get(i).get("notForSaleScreen"));
URL urlConet = new URL(noSale);
con = (HttpURLConnection) urlConet.openConnection();
con.setRequestMethod("GET");
con.setConnectTimeout(4 * 1000);
inStream = con.getInputStream();// 通过输入流获取图片数据
byteArrayOut = new ByteArrayOutputStream();
// 将图片读到BufferedImage
bufferImg = ImageIO.read(inStream);
//原始高度
int width = bufferImg.getWidth();
int height = bufferImg.getHeight();
// 将图片写入流中
ImageIO.write(bufferImg, "png", byteArrayOut);
XSSFDrawing patriarch = (XSSFDrawing) unsaleable.createDrawingPatriarch();
XSSFClientAnchor anchor = null;
anchor = new XSSFClientAnchor(0, 0, 0, 0, 0, 0, 0, 0);
// 插入图片
XSSFPicture pictCalculation = patriarch.createPicture(
anchor, wb.addPicture(byteArrayOut.toByteArray(),
XSSFWorkbook.PICTURE_TYPE_PNG));
pictCalculation.resize(20, ((double) height / (double) width * 80D));
}
log.info("贩卖记录===={}" + JSON.toJSONString(detailNoRegionList.get(i).get("traffickRecord")));
if (!CommUtil.toString(detailNoRegionList.get(i).get("traffickRecord")).equals("")) {
//贩卖记录
String traffickRecord = CommUtil.toString(detailNoRegionList.get(i).get("traffickRecord"));
URL urlConet = new URL(traffickRecord);
con = (HttpURLConnection) urlConet.openConnection();
con.setRequestMethod("GET");
con.setConnectTimeout(4 * 1000);
inStream = con.getInputStream();// 通过输入流获取图片数据
byteArrayOut = new ByteArrayOutputStream();
// 将图片读到BufferedImage
bufferImg = ImageIO.read(inStream);
//原始高度
int width = bufferImg.getWidth();
int height = bufferImg.getHeight();
// 将图片写入流中
ImageIO.write(bufferImg, "png", byteArrayOut);
XSSFDrawing patriarch = (XSSFDrawing) saleRecord.createDrawingPatriarch();
XSSFClientAnchor anchor = null;
anchor = new XSSFClientAnchor(0, 0, 0, 0, 0, 0, 0, 0);
// 插入图片
XSSFPicture pictCalculation = patriarch.createPicture(
anchor, wb.addPicture(byteArrayOut.toByteArray(),
XSSFWorkbook.PICTURE_TYPE_PNG));
pictCalculation.resize(20, ((double) height / (double) width * 80D));
}
log.info("店铺信息===={}" + JSON.toJSONString(detailNoRegionList.get(i).get("storeInformationScreen")));
if (!CommUtil.toString(detailNoRegionList.get(i).get("storeInformationScreen")).equals("")) {
//店铺信息
String storeInformationScreen = CommUtil.toString(detailNoRegionList.get(i).get("storeInformationScreen"));
URL urlConet = new URL(storeInformationScreen);
con = (HttpURLConnection) urlConet.openConnection();
con.setRequestMethod("GET");
con.setConnectTimeout(4 * 1000);
inStream = con.getInputStream();// 通过输入流获取图片数据
byteArrayOut = new ByteArrayOutputStream();
// 将图片读到BufferedImage
bufferImg = ImageIO.read(inStream);
//原始高度
int width = bufferImg.getWidth();
int height = bufferImg.getHeight();
// 将图片写入流中
ImageIO.write(bufferImg, "png", byteArrayOut);
XSSFDrawing patriarch = (XSSFDrawing) storeInfomation.createDrawingPatriarch();
XSSFClientAnchor anchor = null;
anchor = new XSSFClientAnchor(0, 0, 0, 0, 0, 0, 0, 0);
// 插入图片
XSSFPicture pictCalculation = patriarch.createPicture(
anchor, wb.addPicture(byteArrayOut.toByteArray(),
XSSFWorkbook.PICTURE_TYPE_PNG));
pictCalculation.resize(20, ((double) height / (double) width * 80D));
}