Przeglądaj źródła

// add bank

release_toaliyun_real
xhxu 3 lat temu
rodzic
commit
2dbeace45c
2 zmienionych plików z 8 dodań i 7 usunięć
  1. +1
    -2
      mallinkBApi/src/main/java/com/iformall/controller/WxMerchantMediaUploadController.java
  2. +7
    -5
      mallinkBApi/src/main/java/com/iformall/utils/ImgYwsqhUtil.java

+ 1
- 2
mallinkBApi/src/main/java/com/iformall/controller/WxMerchantMediaUploadController.java Wyświetl plik

@@ -156,9 +156,8 @@ public class WxMerchantMediaUploadController extends BaseController {
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"生成图片异常"); return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"生成图片异常");
} }
try { try {
InputStream inputStream = new ByteArrayInputStream(bytes);


String url = aliyunOSS.upload(tenantEntity.getTenantId(), ".png", inputStream);
String url = aliyunOSS.upload(tenantEntity.getTenantId(), ".png", new ByteArrayInputStream(bytes));
if(StringUtils.isBlank(url)){ if(StringUtils.isBlank(url)){
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"获取图片异常"); return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"获取图片异常");
} }


+ 7
- 5
mallinkBApi/src/main/java/com/iformall/utils/ImgYwsqhUtil.java Wyświetl plik

@@ -38,11 +38,12 @@ public class ImgYwsqhUtil {
try { try {


// InputStream backImgUrl = ClassLoader.getSystemResourceAsStream(imgTempPath); // InputStream backImgUrl = ClassLoader.getSystemResourceAsStream(imgTempPath);
// InputStream backImgUrl = ImgYwsqhUtil.class.getClassLoader().getResourceAsStream(imgTempPath);
ClassPathResource resource = new ClassPathResource(imgTempPath);
InputStream backImgUrl = resource.getInputStream();
InputStream backImgUrl = ImgYwsqhUtil.class.getClassLoader().getResourceAsStream(imgTempPath);
// ClassPathResource resource = new ClassPathResource(imgTempPath);
// InputStream backImgUrl = resource.getInputStream();


BufferedImage backImg = ImageIO.read(backImgUrl); BufferedImage backImg = ImageIO.read(backImgUrl);
backImgUrl.close();
Graphics g = backImg.getGraphics(); Graphics g = backImg.getGraphics();


Font fTxtBottom = new Font("微软雅黑", Font.PLAIN, 70); Font fTxtBottom = new Font("微软雅黑", Font.PLAIN, 70);
@@ -110,8 +111,9 @@ public class ImgYwsqhUtil {


ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
ImageIO.write(backImg, "png", out); ImageIO.write(backImg, "png", out);

return out.toByteArray();
byte[] bytes = out.toByteArray();
out.close();
return bytes;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
logger.error("生成证书异常", e.getMessage()); logger.error("生成证书异常", e.getMessage());


Ładowanie…
Anuluj
Zapisz