|
@@ -36,6 +36,7 @@ import com.zhongzheng.modules.user.service.IUserService;
|
|
|
import com.zhongzheng.modules.user.service.IUserStudyRecordService;
|
|
|
import com.zhongzheng.modules.user.vo.UserStudyRecordVo;
|
|
|
import com.zhongzheng.modules.user.vo.UserVo;
|
|
|
+import org.apache.commons.compress.utils.IOUtils;
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -427,8 +428,10 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
String imgName = projectUrl + "out01.jpg";
|
|
|
try {
|
|
|
// 加载本地图片
|
|
|
- String imageLocalUrl = projectUrl + "002.jpg";
|
|
|
- BufferedImage imageLocal = ImageIO.read(new File(imageLocalUrl));
|
|
|
+ InputStream imgStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("static/002.jpg");
|
|
|
+ // String imageLocalUrl = projectUrl + "002.jpg";
|
|
|
+ // BufferedImage imageLocal = ImageIO.read(new File(imageLocalUrl));
|
|
|
+ BufferedImage imageLocal = ImageIO.read(imgStream);
|
|
|
// 以本地图片为模板
|
|
|
Graphics2D g = imageLocal.createGraphics();
|
|
|
|
|
@@ -478,7 +481,11 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
// ImageIO.write(imageLocal, "jpg", outputfile);
|
|
|
//上传OSS
|
|
|
InputStream is = bufferedImageToInputStream(imageLocal);
|
|
|
- return ossService.uploadInputStream(is,7);
|
|
|
+ String ossPath = ossService.uploadInputStream(is,7);
|
|
|
+ if(imgStream!=null){
|
|
|
+ imgStream.close();
|
|
|
+ }
|
|
|
+ return ossPath;
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -493,8 +500,10 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
String imgName = projectUrl + "out02.jpg";
|
|
|
try {
|
|
|
// 加载本地图片
|
|
|
- String imageLocalUrl = projectUrl + "003.jpg";
|
|
|
- BufferedImage imageLocal = ImageIO.read(new File(imageLocalUrl));
|
|
|
+ InputStream imgStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("static/003.jpg");
|
|
|
+ // String imageLocalUrl = projectUrl + "003.jpg";
|
|
|
+ // BufferedImage imageLocal = ImageIO.read(new File(imageLocalUrl));
|
|
|
+ BufferedImage imageLocal = ImageIO.read(imgStream);
|
|
|
// 以本地图片为模板
|
|
|
Graphics2D g = imageLocal.createGraphics();
|
|
|
|
|
@@ -535,7 +544,11 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
// ImageIO.write(imageLocal, "jpg", outputfile);
|
|
|
//上传OSS
|
|
|
InputStream is = bufferedImageToInputStream(imageLocal);
|
|
|
- return ossService.uploadInputStream(is,7);
|
|
|
+ String ossPath = ossService.uploadInputStream(is,7);
|
|
|
+ if(imgStream!=null){
|
|
|
+ imgStream.close();
|
|
|
+ }
|
|
|
+ return ossPath;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|