|
@@ -1,6 +1,7 @@
|
|
package com.fdkankan.sale.util;
|
|
package com.fdkankan.sale.util;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
import com.fdkankan.sale.common.CacheUtil;
|
|
import com.fdkankan.sale.common.CacheUtil;
|
|
import com.fdkankan.sale.common.FilePath;
|
|
import com.fdkankan.sale.common.FilePath;
|
|
@@ -101,10 +102,14 @@ public class MyExcelUtil {
|
|
*/
|
|
*/
|
|
private void imageHandleByParam(Map<String, Object> param) {
|
|
private void imageHandleByParam(Map<String, Object> param) {
|
|
for (Map.Entry<String, Object> entry : param.entrySet()) {
|
|
for (Map.Entry<String, Object> entry : param.entrySet()) {
|
|
|
|
+ String mapKey = entry.getKey();
|
|
|
|
+ String ossPath = entry.getValue().toString();
|
|
|
|
+ String downloadPath = FilePath.file_path + ossPath.replaceAll(CacheUtil.host,"");
|
|
try {
|
|
try {
|
|
- String mapKey = entry.getKey();
|
|
|
|
- String ossPath = entry.getValue().toString();
|
|
|
|
- String downloadPath = FilePath.file_path + ossPath.replaceAll(CacheUtil.host,"");
|
|
|
|
|
|
+ File file = new File(downloadPath);
|
|
|
|
+ if(!file.exists()){
|
|
|
|
+ fYunFileServiceInterface.downloadFile(ossPath,downloadPath );
|
|
|
|
+ }
|
|
// 填充图片
|
|
// 填充图片
|
|
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
|
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
|
BufferedImage bufferImg = ImageIO.read(new File(downloadPath));
|
|
BufferedImage bufferImg = ImageIO.read(new File(downloadPath));
|
|
@@ -120,6 +125,8 @@ public class MyExcelUtil {
|
|
param.put(mapKey, byteArrayOut.toByteArray());
|
|
param.put(mapKey, byteArrayOut.toByteArray());
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
|
+ }finally {
|
|
|
|
+ FileUtil.del(downloadPath);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|