水印照片
This commit is contained in:
parent
713d63dcc4
commit
96b05f7d57
|
|
@ -53,22 +53,26 @@ public class ProPullTask {
|
||||||
/**
|
/**
|
||||||
* 水印照片转换
|
* 水印照片转换
|
||||||
*/
|
*/
|
||||||
// @Scheduled(initialDelay = 6000, fixedDelay = 60000 * 30)
|
@Scheduled(initialDelay = 6000, fixedDelay = 60000 * 30)
|
||||||
@Async
|
@Async
|
||||||
public void getPhotoWatermarkTask() {
|
public void getPhotoWatermarkTask() {
|
||||||
log.info("--------水印照片生成定时器开启------");
|
log.info("--------水印照片生成定时器开启------");
|
||||||
//实名制工程
|
//实名制工程
|
||||||
List<FileStorageDto> fileList = dao.getNotHaveWatermarkPhoto();
|
List<FileStorageDto> fileList = dao.getNotHaveWatermarkPhoto();
|
||||||
fileList.forEach(item -> {
|
fileList.forEach(item -> {
|
||||||
String localPath = SystemUtils.getUploadPath() + File.separator+ item.getOriginalFilePath();
|
String localPath = SystemUtils.getUploadPath() + item.getOriginalFilePath();
|
||||||
List<String> sb = new ArrayList<>();
|
List<String> sb = new ArrayList<>();
|
||||||
sb.add(item.getVioDate());
|
sb.add(item.getVioDate());
|
||||||
sb.add(item.getProName());
|
sb.add(item.getProName());
|
||||||
String[] split = item.getSourceTypeName().split("-");
|
String[] split = item.getSourceTypeName().split("-");
|
||||||
sb.add(split[0]);
|
sb.add(split[0]);
|
||||||
sb.add(split[1]);
|
sb.add(split[1]);
|
||||||
String s = HighQualityWatermark.generateWatermark(sb, localPath);
|
try {
|
||||||
item.setWatermarkFilePath(s);
|
String s = HighQualityWatermark.generateWatermark(sb, localPath);
|
||||||
|
item.setWatermarkFilePath(s);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("水印照片转换异常:",e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
dao.updateHaveWatermarkPhoto(fileList);
|
dao.updateHaveWatermarkPhoto(fileList);
|
||||||
log.info("--------水印照片生成定时器完毕------");
|
log.info("--------水印照片生成定时器完毕------");
|
||||||
|
|
|
||||||
|
|
@ -322,6 +322,10 @@ public class HighQualityWatermark {
|
||||||
String suffix = IDUtils.getSuffix(localPath);
|
String suffix = IDUtils.getSuffix(localPath);
|
||||||
String path = File.separator + "sy" + File.separator + IDUtils.createID() + suffix;
|
String path = File.separator + "sy" + File.separator + IDUtils.createID() + suffix;
|
||||||
String outPath = SystemUtils.getUploadPath() + path;
|
String outPath = SystemUtils.getUploadPath() + path;
|
||||||
|
File uploadFile = new File(outPath);
|
||||||
|
if (!uploadFile.getParentFile().exists()) {
|
||||||
|
uploadFile.getParentFile().mkdirs();
|
||||||
|
}
|
||||||
// 添加高质量水印
|
// 添加高质量水印
|
||||||
addHighQualityWatermark(localPath, outPath,
|
addHighQualityWatermark(localPath, outPath,
|
||||||
watermarkLines, "bottom-left",
|
watermarkLines, "bottom-left",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue