|
@@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
import cn.com.ctop.common.module.mapper.MailLogMapper;
|
|
|
import cn.com.ctop.common.module.utils.CorpWexinUtils;
|
|
|
+import cn.com.ctop.common.module.utils.ImageUtils;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.google.gson.JsonObject;
|
|
@@ -36,11 +37,14 @@ import javax.annotation.Resource;
|
|
|
import javax.imageio.ImageIO;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.swing.*;
|
|
|
+import java.awt.*;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
import java.io.*;
|
|
|
+import java.net.URL;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.text.MessageFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@@ -210,8 +214,14 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
|
for (int j = 0; j < imageUrlList.size(); j++) {
|
|
|
String imagePath = imageUrlList.get(j);
|
|
|
//通过图片网络地址 获取输入流
|
|
|
- InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
|
|
|
+ /* InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
|
|
|
BufferedImage bufferImg = ImageIO.read(is);
|
|
|
+*/
|
|
|
+ URL url = new URL(imagePath);
|
|
|
+ Image imageTookittitle = Toolkit.getDefaultToolkit().createImage(url);
|
|
|
+ BufferedImage bufferImg = createExcelByTemplate.toBufferedImage(imageTookittitle);
|
|
|
+
|
|
|
+
|
|
|
ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".") + 1), byteArrayOut);
|
|
|
int startIndex = settlementList.size() +6;
|
|
|
//anchor主要用于设置图片的属性
|
|
@@ -396,8 +406,13 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
|
for (int j = 0; j < imageUrlList.size(); j++) {
|
|
|
String imagePath = imageUrlList.get(j);
|
|
|
//通过图片网络地址 获取输入流
|
|
|
- InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
|
|
|
+ /* InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
|
|
|
BufferedImage bufferImg = ImageIO.read(is);
|
|
|
+ */
|
|
|
+ URL url = new URL(imagePath);
|
|
|
+ Image imageTookittitle = Toolkit.getDefaultToolkit().createImage(url);
|
|
|
+ BufferedImage bufferImg = createExcelByTemplate.toBufferedImage(imageTookittitle);
|
|
|
+
|
|
|
ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".") + 1), byteArrayOut);
|
|
|
//anchor主要用于设置图片的属性
|
|
|
int startIndex = settlementList.size()+7;
|
|
@@ -793,7 +808,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
|
|
|
|
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
+ public static void main(String[] args) throws Exception{
|
|
|
/* String a = "woshiwoshi{1}woshi{2}111{3}===";
|
|
|
String b = MessageFormat.format(a,"测试","我","你","结束");
|
|
|
System.out.println(a);
|
|
@@ -809,6 +824,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
|
list.add("2021-07-15");
|
|
|
|
|
|
|
|
|
+/*
|
|
|
|
|
|
|
|
|
// 获取两个日期之间 所有的 时间 年-月-日
|
|
@@ -829,7 +845,14 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
|
System.out.println(stringList);
|
|
|
|
|
|
|
|
|
+*/
|
|
|
|
|
|
+ //String imagePath = "https://media-1301855440.cos.ap-chongqing.myqcloud.com/undefined/2021-08-25/9774099-1-1629874464883.jpg";
|
|
|
+ String imagePath = "https://media-1301855440.cos.ap-chongqing.myqcloud.com/undefined/2021-08-25/9677284-1629874460562.jpg";
|
|
|
+ //通过图片网络地址 获取输入流
|
|
|
+ InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
|
|
|
+ BufferedImage bufferImg = ImageIO.read(is);
|
|
|
+ System.out.println(bufferImg);
|
|
|
|
|
|
|
|
|
|