diff --git a/src/main/java/com/zcloud/controller/app/highriskwork/AppHotWorkApplicationDelayedController.java b/src/main/java/com/zcloud/controller/app/highriskwork/AppHotWorkApplicationDelayedController.java index 548935fb..81a82b4e 100644 --- a/src/main/java/com/zcloud/controller/app/highriskwork/AppHotWorkApplicationDelayedController.java +++ b/src/main/java/com/zcloud/controller/app/highriskwork/AppHotWorkApplicationDelayedController.java @@ -69,38 +69,38 @@ public class AppHotWorkApplicationDelayedController extends BaseController { map.put("msg", "文件格式不正确!"); return map; } - Image srcImg = ImageIO.read(file.getInputStream()); - //获取图片的宽 - int srcImgWidth = srcImg.getWidth(null); - //获取图片的高 - int srcImgHeight = srcImg.getHeight(null); - - BufferedImage bufImg = new BufferedImage(srcImgWidth, srcImgHeight, BufferedImage.TYPE_INT_RGB); - // 加水印 - //创建画笔 - Graphics2D g = bufImg.createGraphics(); - //srcImg 为上面获取到的原始图片的图片对象 - g.drawImage(srcImg, 0, 0, srcImgWidth, srcImgHeight, null); - //根据图片的背景设置水印颜色 - g.setColor(new Color(255,255,255,128)); - //设置字体 画笔字体样式为微软雅黑,加粗,文字大小为60pt - g.setFont(new Font("微软雅黑", Font.BOLD, 20)); - //设置水印的坐标 - int x=(srcImgWidth - WaterMarkUtil.getWatermarkLength(DateUtil.date2Str(new Date()), g)) / 2; - int y=srcImgHeight / 2; - //画出水印 第一个参数是水印内容,第二个参数是x轴坐标,第三个参数是y轴坐标 - g.drawString(DateUtil.date2Str(new Date()), x, y); - g.dispose(); - //将加完水印的图片暂存到内存中 - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ImageIO.write(bufImg, suffixName, bos); - ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); - +// Image srcImg = ImageIO.read(file.getInputStream()); +// //获取图片的宽 +// int srcImgWidth = srcImg.getWidth(null); +// //获取图片的高 +// int srcImgHeight = srcImg.getHeight(null); +// +// BufferedImage bufImg = new BufferedImage(srcImgWidth, srcImgHeight, BufferedImage.TYPE_INT_RGB); +// // 加水印 +// //创建画笔 +// Graphics2D g = bufImg.createGraphics(); +// //srcImg 为上面获取到的原始图片的图片对象 +// g.drawImage(srcImg, 0, 0, srcImgWidth, srcImgHeight, null); +// //根据图片的背景设置水印颜色 +// g.setColor(new Color(255,255,255,128)); +// //设置字体 画笔字体样式为微软雅黑,加粗,文字大小为60pt +// g.setFont(new Font("微软雅黑", Font.BOLD, 20)); +// //设置水印的坐标 +// int x=(srcImgWidth - WaterMarkUtil.getWatermarkLength(DateUtil.date2Str(new Date()), g)) / 2; +// int y=srcImgHeight / 2; +// //画出水印 第一个参数是水印内容,第二个参数是x轴坐标,第三个参数是y轴坐标 +// g.drawString(DateUtil.date2Str(new Date()), x, y); +// g.dispose(); +// //将加完水印的图片暂存到内存中 +// ByteArrayOutputStream bos = new ByteArrayOutputStream(); +// ImageIO.write(bufImg, suffixName, bos); +// ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); +// String ffile = DateUtil.getDays(); String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); -// Smb.sshSftp(file, fileName, Const.FILEPATHYHTP + corpInfoId + "/" + ffile); - //通过流的方式上传文件 - Smb.sshSftpForInput(bis, fileName, Const.FILEPATHYHTP + corpInfoId + "/" + ffile); + Smb.sshSftp(file, fileName, Const.FILEPATHYHTP + corpInfoId + "/" + ffile); +// 通过流的方式上传文件 +// Smb.sshSftpForInput(bis, fileName, Const.FILEPATHYHTP + corpInfoId + "/" + ffile); pd.put("FILEPATH",Const.FILEPATHYHTP + corpInfoId + "/" + ffile + "/" + fileName); } hotworkapplicationdelayedService.save(pd);