|
@@ -41,6 +41,7 @@ public class AttachmngsController {
|
|
|
@RequestParam("attachId") Long attachId,
|
|
|
@RequestParam("longitude") String longitude,
|
|
|
@RequestParam("latitude") String latitude,
|
|
|
+ @RequestParam("carRegNo") String carRegNo,
|
|
|
@RequestParam("updateDate") String date,
|
|
|
HttpServletRequest request) throws Exception {
|
|
|
if (file.isEmpty()) {
|
|
@@ -56,7 +57,7 @@ public class AttachmngsController {
|
|
|
|
|
|
SysUser user = SecurityUtils.getLoginUser().getUser();
|
|
|
// String watermark = longitude + "," + latitude + "-" + date + "-" + user.getNickName();
|
|
|
- String watermark = address + "||" + date + "||" + user.getNickName();
|
|
|
+ String watermark = address + "||" + date + "||" + carRegNo;
|
|
|
System.out.println( );
|
|
|
// String watermark = date;
|
|
|
File file2 = AddWatermarkUtil.transferToFile(file);
|
|
@@ -76,6 +77,15 @@ public class AttachmngsController {
|
|
|
AddWatermarkUtil.waterPress(file2, file2, Color.DARK_GRAY, 48, watermark);
|
|
|
// AddWatermarkUtil.addWaterMark(file2, file2, Color.DARK_GRAY, 48, watermark);
|
|
|
|
|
|
+ // 如果图片大于40kb压缩
|
|
|
+ if (AddWatermarkUtil.fileToTransfer(file2).getBytes().length > 240800) {
|
|
|
+ // 压缩
|
|
|
+ Thumbnails.of(file2)
|
|
|
+ .scale(1f) //图片大小(长宽)压缩比例 从0-1,1表示原图
|
|
|
+ .outputQuality(0.5f) //图片质量压缩比例 从0-1,越接近1质量越好
|
|
|
+ .toFile(file2);
|
|
|
+ }
|
|
|
+
|
|
|
// 转二进制
|
|
|
byte[] bytes = AddWatermarkUtil.fileToTransfer(file2).getBytes();
|
|
|
|