You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tobacco/bs-admin/src/main/java/com/bs/ct/controller/CtGalleryImagesController.java

690 lines
30 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package com.bs.ct.controller;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.bs.cm.domain.CmAttach;
import com.bs.cm.service.ICmAttachService;
import com.bs.common.config.BsConfig;
import com.bs.common.core.domain.entity.SysDept;
import com.bs.common.core.domain.model.LoginUser;
import com.bs.common.utils.StringUtils;
import com.bs.common.utils.file.FileUploadUtils;
import com.bs.common.utils.file.FileUtils;
import com.bs.ct.domain.*;
import com.bs.ct.service.*;
import com.bs.ct.utils.ExifUtils;
import com.bs.ct.utils.OperateImageUtils;
import com.bs.ct.utils.UUIDUtils;
import com.bs.framework.config.ServerConfig;
import com.bs.system.service.ISysDeptService;
import com.drew.imaging.ImageMetadataReader;
import com.drew.imaging.ImageProcessingException;
import com.drew.metadata.Directory;
import com.drew.metadata.Metadata;
import com.drew.metadata.Tag;
import com.drew.metadata.exif.ExifSubIFDDirectory;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import static com.bs.common.config.BsConfig.getProfile;
/**
* 图库图片Controller
*
* @author bs
* @date 2025-02-22
*/
@Api(tags = "图库图片")
@RestController
@RequestMapping("/gallery/images")
public class CtGalleryImagesController extends BaseController {
@Value("${bs.profile}")
private String profile;
@Resource
private ICtGalleryImagesService ctGalleryImagesService;
@Autowired
private ServerConfig serverConfig;
@Autowired
private ICmAttachService cmAttachService;
@Resource
private ICtTaskTagService ctTaskTagService;
@Resource
private ICtGalleryImagesTagService ctGalleryImagesTagService;
@Resource
private ICtTagService ctTagService;
@Autowired
private ISysDeptService deptService;
@Resource
private ICtTaskBranchService ctTaskBranchService;
@Resource
private ICtTaskInfoService ctTaskInfoService;
@Resource
private ICtImagesFeedbackRefService ctImagesFeedbackRefService;
@Resource
private ICtGalleryCataService ctGalleryCataService;
@Resource
private ICtTaskFeedbackService ctTaskFeedbackService;
/**
* 分页查询图库图片列表
*/
@ApiOperation("分页查询图库图片列表")
@GetMapping("/pageList")
public TableDataInfo pageList(CtGalleryImages ctGalleryImages) {
Integer pageNum = ctGalleryImages.getPageNum() != null ? ctGalleryImages.getPageNum() : 1;
Integer pageSize = ctGalleryImages.getPageSize() != null ? ctGalleryImages.getPageSize() : 10;
LambdaQueryWrapper<CtGalleryImages> queryWrapper = new LambdaQueryWrapper();
if (Validator.isEmpty(ctGalleryImages.getImageTitle())) {
condition(queryWrapper,ctGalleryImages);
}
List<CtGalleryImages> list = ctGalleryImagesService.list(queryWrapper);
setAll(list);
setFile(list);
if (Validator.isNotEmpty(ctGalleryImages.getImageTitle())) {
list = filterByImageTitle(list,ctGalleryImages.getImageTitle());
}
Integer start = (pageNum - 1) * pageSize;
List<CtGalleryImages> result = list.stream()
.skip(start) // 跳过前4条数据
.limit(pageSize) // 最多取6条数据
.collect(Collectors.toList());
TableDataInfo data = getDataTable(result);
data.setTotal(list.size());
return data;
}
// 过滤方法
public static List<CtGalleryImages> filterByImageTitle(List<CtGalleryImages> list, String filterText) {
return list.stream()
.filter(image -> {
boolean matchImageName = image.getImageName() != null && image.getImageName().contains(filterText);
boolean matchImageTitle = image.getImageTitle() != null && image.getImageTitle().contains(filterText);
boolean matchKeyWords = image.getKeyWords() != null && image.getKeyWords().contains(filterText);
boolean matchCataName = image.getCataName() != null && image.getCataName().contains(filterText);
boolean matchTagNames = image.getTagNames() != null && image.getTagNames().stream().anyMatch(tag -> tag.contains(filterText));
boolean matchTaskTitles = image.getTaskTitles() != null && image.getTaskTitles().stream().anyMatch(task -> task.contains(filterText));
return matchImageName || matchImageTitle || matchKeyWords || matchCataName || matchTagNames || matchTaskTitles;
})
.collect(Collectors.toList());
}
private void setAll(List<CtGalleryImages> list) {
List<CtGalleryCata> ctGalleryCatas = ctGalleryCataService.list();
List<CtGalleryImagesTag> imagesTags = ctGalleryImagesTagService.list();
HashMap<Long, String> longStringHashMap = ctGalleryCatas.stream()
.collect(Collectors.toMap(
CtGalleryCata::getId,
CtGalleryCata::getCataName,
(existing, replacement) -> existing,
HashMap::new
));
Map<Long, List<String>> imageStringHashMap = imagesTags.stream()
.collect(Collectors.groupingBy(
CtGalleryImagesTag::getImageId,
Collectors.mapping(
CtGalleryImagesTag::getTagName,
Collectors.toList()
)
));
//查询相关任务名称
List<CtImagesFeedbackRef> imagesFeedbackRefs = ctImagesFeedbackRefService.list();
Map<Long, List<Long>> refMap = imagesFeedbackRefs.stream()
.collect(Collectors.groupingBy(
CtImagesFeedbackRef::getImageId, // 分组键imageId
Collectors.mapping(
CtImagesFeedbackRef::getFeedbackId, // 提取值feedbackId
Collectors.toList() // 收集为列表
)
));
List<CtTaskFeedback> ctTaskFeedbacks = ctTaskFeedbackService.list();
HashMap<Long, Long> feedbackIdsMap = ctTaskFeedbacks.stream()
.collect(Collectors.toMap(
CtTaskFeedback::getId, // 键id
CtTaskFeedback::getTaskId, // 值taskId
(existing, replacement) -> existing, // 处理键冲突:保留现有值
() -> new HashMap<>() // 指定 Map 实现类(可选)
));
List<CtTaskInfo> ctTaskInfos = ctTaskInfoService.list();
HashMap<Long, String> infoMap = new HashMap<>();
if (null != ctTaskInfos) {
infoMap = ctTaskInfos.stream()
.filter(ctTaskInfo -> ctTaskInfo.getTaskTitle() != null) // 过滤掉taskTitle为空的项
.collect(Collectors.toMap(
CtTaskInfo::getId,
CtTaskInfo::getTaskTitle,
(existing, replacement) -> existing,
HashMap::new
));
}
for (CtGalleryImages ctGalleryImage : list) {
Long cataId = ctGalleryImage.getCataId();
String cataName = longStringHashMap.get(cataId);
ctGalleryImage.setCataName(cataName);
List<String> tagNames = imageStringHashMap.get(ctGalleryImage.getId());
ctGalleryImage.setTagNames(tagNames);
List<Long> feedList = refMap.get(ctGalleryImage.getId());
List<String> taskTitles = new ArrayList<>();
if (null != feedList && feedList.size() > 0) {
for (Long feedId : feedList) {
Long taskInfoId = feedbackIdsMap.get(feedId);
if (null != infoMap && infoMap.size() > 0) {
String taskTitleName = infoMap.get(taskInfoId);
taskTitles.add(taskTitleName);
}
}
ctGalleryImage.setTaskTitles(taskTitles);
}
}
}
private void setFile(List<CtGalleryImages> list) {
for (CtGalleryImages ctGalleryImages : list) {
List<CtGalleryImagesTag> galleryImagesTags = ctGalleryImagesTagService.list(new LambdaQueryWrapper<CtGalleryImagesTag>()
.eq(CtGalleryImagesTag::getImageId, ctGalleryImages.getId()));
ctGalleryImages.setImagesTags(galleryImagesTags);
List<CmAttach> cmAttachList = cmAttachService.list(new LambdaQueryWrapper<CmAttach>().eq(CmAttach::getFileId,ctGalleryImages.getFileId()));
ctGalleryImages.setFile(cmAttachList);
}
}
/**
* 查询图库图片列表
*/
@ApiOperation("查询图库图片列表")
@GetMapping("/list")
public AjaxResult list(CtGalleryImages ctGalleryImages) {
LambdaQueryWrapper<CtGalleryImages> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctGalleryImages);
if (null != ctGalleryImages.getFeedbackId()) {
List<CtImagesFeedbackRef> ctImagesFeedbackRefs = ctImagesFeedbackRefService.list(new LambdaQueryWrapper<CtImagesFeedbackRef>()
.eq(CtImagesFeedbackRef::getFeedbackId, ctGalleryImages.getFeedbackId()));
List<Long> imageIds = ctImagesFeedbackRefs.stream()
.map(CtImagesFeedbackRef::getImageId)
.collect(Collectors.toList());
if (null != imageIds && imageIds.size() > 0) {
List<CtGalleryImages> galleryImages = ctGalleryImagesService.list(new LambdaQueryWrapper<CtGalleryImages>()
.in(CtGalleryImages::getId, imageIds));
return success(galleryImages);
} else {
return null;
}
}
List<CtGalleryImages> list = ctGalleryImagesService.list(queryWrapper);
return success(list);
}
/**
* 生成图片
*/
@ApiOperation("生成图片")
@Log(title = "生成图片", businessType = BusinessType.UPDATE)
@PostMapping("/generateImage")
public AjaxResult generateImage(@RequestBody CtGalleryImages ctGalleryImages) {
List<Long> imagesIds = ctGalleryImages.getIds();
String imageType = ctGalleryImages.getImageType(); // 假设 CtGalleryImages 有一个 imageType 字段用于指定生成图片的类型
List<CtGalleryImages> list = ctGalleryImagesService.list(new LambdaQueryWrapper<CtGalleryImages>()
.in(CtGalleryImages::getId, imagesIds));
BufferedImage[] imgs = new BufferedImage[list.size()];
Map<Integer, File> imgMap = new HashMap<>();
int index = 0;
for (CtGalleryImages galleryImages : list) {
String attachUrl = galleryImages.getImagePath().replace("/profile", "");
String filePath = profile + attachUrl;
try {
imgs[index] = OperateImageUtils.getBufferedImage(filePath);
imgMap.put(index, new File(filePath));
index = index + 1 ;
} catch (IOException e) {
e.printStackTrace();
return AjaxResult.error("读取图片失败: " + filePath);
}
}
BufferedImage destImg = null;
String outputFileName = null;
String mp4SavePath = "";
try {
switch (imageType) {
case "nineGrid":
if (imgs.length >= 9) {
destImg = OperateImageUtils.mergeImageToGrid(3, 3, imgs);
outputFileName = UUIDUtils.generatorUUID() + "nineGrid.jpg";
} else {
return AjaxResult.error("生成九宫格图片需要至少9张图片");
}
break;
case "fourGrid":
if (imgs.length >= 4) {
BufferedImage[] fourImgs = new BufferedImage[4];
System.arraycopy(imgs, 0, fourImgs, 0, 4);
destImg = OperateImageUtils.mergeImageToGrid(2, 2, fourImgs);
outputFileName = UUIDUtils.generatorUUID() + "fourGrid.jpg";
} else {
return AjaxResult.error("生成四宫格图片需要至少4张图片");
}
break;
case "horizontalMerge":
if (imgs.length >= 2) {
destImg = OperateImageUtils.mergeImage(true, imgs);
outputFileName = UUIDUtils.generatorUUID() + "horizontalMerge.jpg";
} else {
return AjaxResult.error("水平合并需要至少2张图片");
}
break;
case "verticalMerge":
if (imgs.length >= 2) {
destImg = OperateImageUtils.mergeImage(false, imgs);
outputFileName = UUIDUtils.generatorUUID() + "verticalMerge.jpg";
} else {
return AjaxResult.error("垂直合并需要至少2张图片");
}
break;
case "video":
int width = imgs[0].getWidth();
int height = imgs[0].getHeight();
mp4SavePath = UUIDUtils.generatorUUID() + "output.mp4";
OperateImageUtils.createMp4(profile, mp4SavePath, imgMap, width, height);
break;
default:
return AjaxResult.error("不支持的生成类型: " + imageType);
}
} catch (IOException e) {
e.printStackTrace();
}
if (destImg != null) {
OperateImageUtils.saveImage(destImg, profile , outputFileName, "jpg");
return AjaxResult.success("图片生成成功", outputFileName);
}
if (StringUtils.isNotEmpty(mp4SavePath)) {
return AjaxResult.success("视频生成成功", mp4SavePath);
}
return AjaxResult.error("图片/视频生成失败");
}
//
/**
* 通用上传请求(单个)
*/
@PostMapping("/upload")
public AjaxResult uploadFile(MultipartFile file, String fileId, Long cataId, String imageTitle, Date photoTime, Date uploadTime,
String isOpen, String keyWords, String remarks, Long tagId, ArrayList<Long> ctTags, Long feedbackId
) throws Exception
{
try
{
Long newId = System.currentTimeMillis() + new Random().nextInt(1000);
CtGalleryImages ctGalleryImages = new CtGalleryImages();
ctGalleryImages.setCataId(cataId);
ctGalleryImages.setImageTitle(imageTitle);
ctGalleryImages.setPhotoTime(photoTime);
ctGalleryImages.setUploadTime(uploadTime);
ctGalleryImages.setIsOpen(isOpen);
ctGalleryImages.setKeyWords(keyWords);
ctGalleryImages.setRemarks(remarks);
ctGalleryImages.setFileId(newId);
// 上传文件路径
String filePath = BsConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String realName = fileName.replace("profile", "");
String exifInfo = ExifUtils.getExifInfo(getProfile() + realName).toString();
ctGalleryImages.setExifInfo(exifInfo);
String url = serverConfig.getUrl() + fileName;
String newFileName = FileUtils.getName(fileName);
String originalFilename = file.getOriginalFilename();
CmAttach cmAttach = new CmAttach();
cmAttach.setFileId(String.valueOf(newId));
cmAttach.setFileSort(1L);
cmAttach.setAttachName(newFileName);
cmAttach.setAttachContentType(file.getContentType());
cmAttach.setAttachFileSize(file.getSize());
cmAttach.setAttachFileUrl(fileName);
cmAttach.setOldName(originalFilename);
cmAttach.setVersionNo("1");
cmAttach.setRemark("");
boolean save = cmAttachService.save(cmAttach);
if (save) {
Long id = cmAttach.getId();
AjaxResult ajax = AjaxResult.success();
ajax.put("cmAttach", cmAttach);
CtTaskTag taskTag = null;
if (null != tagId) {
taskTag = ctTaskTagService.getById(tagId);
ctGalleryImages.setCataId(taskTag.getSaveDir());
}
ctGalleryImages.setImageName(originalFilename);
ctGalleryImages.setImagePath(fileName);
ctGalleryImages.setImageSize(BigDecimal.valueOf(file.getSize()));
ctGalleryImages.setFileId(newId);
boolean saveImage = ctGalleryImagesService.save(ctGalleryImages);
if (saveImage) {
ajax.put("imageId",ctGalleryImages.getId());
if (null != taskTag) {
CtGalleryImagesTag ctGalleryImagesTag = new CtGalleryImagesTag();
ctGalleryImagesTag.setImageId(ctGalleryImages.getId());
ctGalleryImagesTag.setTagType(taskTag.getTagType());
ctGalleryImagesTag.setTagName(taskTag.getTagName());
ctGalleryImagesTagService.save(ctGalleryImagesTag);
}
if (null != ctTags) {
for (Long ctTagId : ctTags) {
CtTag ctTag = ctTagService.getById(ctTagId);
CtGalleryImagesTag ctGalleryImagesTag = new CtGalleryImagesTag();
ctGalleryImagesTag.setImageId(ctGalleryImages.getId());
ctGalleryImagesTag.setTagType(ctTag.getTagType());
ctGalleryImagesTag.setTagName(ctTag.getTagName());
ctGalleryImagesTag.setIsPhoto(ctTag.getIsPhoto());
ctGalleryImagesTag.setTagDesc(ctTag.getTagDesc());
ctGalleryImagesTag.setPhotoNum(ctTag.getPhotoNum());
ctGalleryImagesTag.setSaveDir(ctTag.getSaveDir());
ctGalleryImagesTag.setFileId(ctTag.getFileId());
ctGalleryImagesTagService.save(ctGalleryImagesTag);
}
}
}
return ajax;
}
return null;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
* 修改图库图片
*/
@ApiOperation("添加图片标签")
@Log(title = "添加图片标签", businessType = BusinessType.UPDATE)
@PostMapping("/saveByTag")
public AjaxResult saveByTag(@RequestBody CtGalleryImages ctGalleryImages) {
ctGalleryImages.getTaskTagId();
CtTaskTag ctTaskTag = ctTaskTagService.getById(ctGalleryImages.getTaskTagId());
List<Long> ids = ctGalleryImages.getIds();
for (Long id : ids) {
CtGalleryImagesTag ctGalleryImagesTag = new CtGalleryImagesTag();
ctGalleryImagesTag.setImageId(id);
ctGalleryImagesTag.setTagType(ctTaskTag.getTagType());
ctGalleryImagesTag.setTagName(ctTaskTag.getTagName());
List<CtGalleryImagesTag> ctGalleryImagesTags = ctGalleryImagesTagService.list(new LambdaQueryWrapper<CtGalleryImagesTag>()
.eq(CtGalleryImagesTag::getImageId, id)
.eq(CtGalleryImagesTag::getTagType, ctTaskTag.getTagType())
.eq(CtGalleryImagesTag::getTagName, ctTaskTag.getTagName()));
if (null == ctGalleryImagesTags || ctGalleryImagesTags.size() == 0) {
ctGalleryImagesTagService.save(ctGalleryImagesTag);
}
}
return toAjax(true);
}
/**
* 修改图库图片
*/
@ApiOperation("生成任务")
@Log(title = "生成任务", businessType = BusinessType.UPDATE)
@PostMapping("/generateTasks")
public AjaxResult generateTasks(@RequestBody CtGalleryImages ctGalleryImages) {
List<Long> imagesIds = ctGalleryImages.getIds();
List<CtGalleryImagesTag> list = ctGalleryImagesTagService.list(new LambdaQueryWrapper<CtGalleryImagesTag>()
.in(CtGalleryImagesTag::getImageId, imagesIds));
CtTaskInfo ctTaskInfo = new CtTaskInfo();
Long newId = System.currentTimeMillis() + new Random().nextInt(1000);
ctTaskInfo.setId(newId);
//设置发起单位与部门
LoginUser loginUser = getLoginUser();
Long deptId = loginUser.getDeptId();
if (null != deptId) {
ctTaskInfo.setDeptId(deptId);
SysDept sysDept = deptService.selectDeptById(deptId);
Long parentId = sysDept.getParentId();
SysDept parentDept = deptService.selectDeptById(parentId);
if (null != parentDept) {
ctTaskInfo.setBranchCode(String.valueOf(parentDept.getDeptId()));
ctTaskInfo.setBranchName(parentDept.getDeptName());
}
CtTaskBranch branch = new CtTaskBranch();
branch.setBranchCode(String.valueOf(deptId));
branch.setBranchName(sysDept.getDeptName());
branch.setTaskId(ctTaskInfo.getId());
branch.setType("机构");
ctTaskBranchService.saveOrUpdate(branch);
CtTaskBranch taskBranch = new CtTaskBranch();
taskBranch.setBranchCode(String.valueOf(deptId));
taskBranch.setUserName(loginUser.getUsername());
taskBranch.setUserId(String.valueOf(loginUser.getUserId()));
taskBranch.setTaskStatus("0");
taskBranch.setTaskId(ctTaskInfo.getId());
taskBranch.setType("人员");
ctTaskBranchService.saveOrUpdate(taskBranch);
}
if ("1".equals(ctTaskInfo.getStatus())) {
ctTaskInfo.setTaskDate(new Date());
}
boolean save = ctTaskInfoService.save(ctTaskInfo);
if (save) {
List<CtTaskTag> tasgs = ctTaskInfo.getTags();
if (null != tasgs && tasgs.size() > 0) {
if (null != list && list.size() > 0) {
for (CtGalleryImagesTag image : list) {
CtTaskTag taskTag = new CtTaskTag();
taskTag.setTaskId(ctTaskInfo.getId());
taskTag.setTagName(image.getTagName());
taskTag.setTagType(image.getTagType());
taskTag.setIsPhoto(image.getIsPhoto());
taskTag.setTagDesc(image.getTagDesc());
taskTag.setPhotoNum(image.getPhotoNum());
taskTag.setSaveDir(image.getSaveDir());
taskTag.setFileId(image.getFileId());
ctTaskTagService.save(taskTag);
}
}
}
}
return success(ctTaskInfo);
}
/**
* 导出图库图片列表
*/
@ApiOperation("导出图库图片列表")
@Log(title = "图库图片导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CtGalleryImages ctGalleryImages) {
LambdaQueryWrapper<CtGalleryImages> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,ctGalleryImages);
List<CtGalleryImages> list = ctGalleryImagesService.list(queryWrapper);
ExcelUtil<CtGalleryImages> util = new ExcelUtil<CtGalleryImages>(CtGalleryImages. class);
util.exportExcel(response, list, "图库图片数据");
}
/**
* 获取图库图片详细信息
*/
@ApiOperation("获取图库图片详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ctGalleryImagesService.getById(id));
}
/**
* 新增图库图片
*/
@ApiOperation("新增图库图片")
@Log(title = "图库图片新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CtGalleryImages ctGalleryImages) {
return toAjax(ctGalleryImagesService.save(ctGalleryImages));
}
/**
* 修改图库图片
*/
@ApiOperation("修改图库图片")
@Log(title = "图库图片修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CtGalleryImages ctGalleryImages) {
return toAjax(ctGalleryImagesService.updateById(ctGalleryImages));
}
/**
* 删除图库图片
*/
@ApiOperation("删除图库图片")
@Log(title = "图库图片删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(ctGalleryImagesService.removeBatchByIds(ids));
}
/**
* 条件设置
*/
private void condition (LambdaQueryWrapper<CtGalleryImages> queryWrapper,CtGalleryImages ctGalleryImages){
//id
if(Validator.isNotEmpty(ctGalleryImages.getId())){
queryWrapper.eq(CtGalleryImages::getId,ctGalleryImages.getId());
}
//目录id
if(Validator.isNotEmpty(ctGalleryImages.getCataId())){
queryWrapper.eq(CtGalleryImages::getCataId,ctGalleryImages.getCataId());
}
//图片名称
if(Validator.isNotEmpty(ctGalleryImages.getImageName())){
queryWrapper.eq(CtGalleryImages::getImageName,ctGalleryImages.getImageName());
}
//图片标题
if(Validator.isNotEmpty(ctGalleryImages.getImageTitle())){
queryWrapper.eq(CtGalleryImages::getImageTitle,ctGalleryImages.getImageTitle());
}
//图片路径
if(Validator.isNotEmpty(ctGalleryImages.getImagePath())){
queryWrapper.eq(CtGalleryImages::getImagePath,ctGalleryImages.getImagePath());
}
//图片大小
if(Validator.isNotEmpty(ctGalleryImages.getImageSize())){
queryWrapper.eq(CtGalleryImages::getImageSize,ctGalleryImages.getImageSize());
}
//图片拍摄时间
if(Validator.isNotEmpty(ctGalleryImages.getPhotoTime())){
queryWrapper.eq(CtGalleryImages::getPhotoTime,ctGalleryImages.getPhotoTime());
}
//图片上传时间
if(Validator.isNotEmpty(ctGalleryImages.getUploadTime())){
queryWrapper.eq(CtGalleryImages::getUploadTime,ctGalleryImages.getUploadTime());
}
//是否公开
if(Validator.isNotEmpty(ctGalleryImages.getIsOpen())){
queryWrapper.eq(CtGalleryImages::getIsOpen,ctGalleryImages.getIsOpen());
}
//图片关键字
if(Validator.isNotEmpty(ctGalleryImages.getKeyWords())){
queryWrapper.eq(CtGalleryImages::getKeyWords,ctGalleryImages.getKeyWords());
}
//附件id
if(Validator.isNotEmpty(ctGalleryImages.getFileId())){
queryWrapper.eq(CtGalleryImages::getFileId,ctGalleryImages.getFileId());
}
//备注
if(Validator.isNotEmpty(ctGalleryImages.getRemarks())){
queryWrapper.eq(CtGalleryImages::getRemarks,ctGalleryImages.getRemarks());
}
//删除标志0代表存在 2代表删除
if(Validator.isNotEmpty(ctGalleryImages.getDelFlag())){
queryWrapper.eq(CtGalleryImages::getDelFlag,ctGalleryImages.getDelFlag());
}
//创建部门
if(Validator.isNotEmpty(ctGalleryImages.getCreateDept())){
queryWrapper.eq(CtGalleryImages::getCreateDept,ctGalleryImages.getCreateDept());
}
//创建人
if(Validator.isNotEmpty(ctGalleryImages.getCreateBy())){
queryWrapper.eq(CtGalleryImages::getCreateBy,ctGalleryImages.getCreateBy());
}
//创建时间
if(Validator.isNotEmpty(ctGalleryImages.getCreateTime())){
queryWrapper.eq(CtGalleryImages::getCreateTime,ctGalleryImages.getCreateTime());
}
//修改人
if(Validator.isNotEmpty(ctGalleryImages.getUpdateBy())){
queryWrapper.eq(CtGalleryImages::getUpdateBy,ctGalleryImages.getUpdateBy());
}
//修改时间
if(Validator.isNotEmpty(ctGalleryImages.getUpdateTime())){
queryWrapper.eq(CtGalleryImages::getUpdateTime,ctGalleryImages.getUpdateTime());
}
//租户ID
if(Validator.isNotEmpty(ctGalleryImages.getTenantId())){
queryWrapper.eq(CtGalleryImages::getTenantId,ctGalleryImages.getTenantId());
}
}
public static void main(String[] args) {
try {
System.out.println(ExifUtils.getExifInfo("d:\\1.jpg").toString());
/*File imageFile = new File("d:\\1.jpg");
Metadata metadata = ImageMetadataReader.readMetadata(imageFile);
for (Directory directory : metadata.getDirectories()) {
for (Tag tag : directory.getTags()) {
System.out.println(tag.getTagName() + " = " + tag.getDescription());
}
}*/
} catch (ImageProcessingException e) {
// 处理异常
} catch (IOException e) {
// 处理IO异常
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}