添加tag和属性预览相关。

This commit is contained in:
chenxudong 2025-03-04 14:33:42 +08:00
parent bd59d91776
commit 34fdf667ec
6 changed files with 37 additions and 8 deletions

View File

@ -1,6 +1,7 @@
package com.electromagnetic.industry.software.manage.config;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
@ -26,8 +27,8 @@ public class EdMetaObjectHandler implements MetaObjectHandler {
if (metaObject.hasGetter("updatedAt")) {
this.strictInsertFill(metaObject, "updatedAt", Date.class, new Date());
}
if (metaObject.hasGetter("updatedTime")) {
this.strictInsertFill(metaObject, "updatedTime", Date.class, new Date());
if (metaObject.hasGetter("createdBy")) {
this.strictUpdateFill(metaObject, "createdBy", String.class, UserThreadLocal.getUserId());
}
}
@ -42,6 +43,9 @@ public class EdMetaObjectHandler implements MetaObjectHandler {
if (metaObject.hasGetter("updatedTime")) {
this.strictUpdateFill(metaObject, "updatedTime", Date.class, new Date());
}
if (metaObject.hasGetter("updatedBy")) {
this.strictUpdateFill(metaObject, "updatedTime", String.class, UserThreadLocal.getUserId());
}
}
}

View File

@ -1,5 +1,6 @@
package com.electromagnetic.industry.software.manage.pojo.models;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.experimental.Accessors;
@ -12,24 +13,24 @@ public class BaseModel {
/**
* 创建时间
*/
@TableField(value = "created_time")
@TableField(value = "created_time", fill = FieldFill.INSERT)
private Date createdTime;
/**
* 创建人
*/
@TableField(value = "created_by")
@TableField(value = "created_by", fill = FieldFill.INSERT)
private String createdBy;
/**
* 最后更新时间
*/
@TableField(value = "updated_time")
@TableField(value = "updated_time", fill = FieldFill.UPDATE)
private Date updatedTime;
/**
* 最后更新人
*/
@TableField(value = "updated_by")
@TableField(value = "updated_by", fill = FieldFill.UPDATE)
private String updatedBy;
}

View File

@ -1,9 +1,11 @@
package com.electromagnetic.industry.software.manage.pojo.other;
import com.electromagnetic.industry.software.manage.pojo.resp.FileTagInfo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class FileInfoVO {
@ -43,4 +45,7 @@ public class FileInfoVO {
private String fileCode;
private String createdBy;
private List<FileTagInfo> labels;
}

View File

@ -0,0 +1,12 @@
package com.electromagnetic.industry.software.manage.pojo.resp;
import lombok.Data;
@Data
public class FileTagInfo {
private String tagId;
private String tagName;
}

View File

@ -34,6 +34,7 @@ import com.electromagnetic.industry.software.manage.pojo.other.UploadRecordDTO;
import com.electromagnetic.industry.software.manage.pojo.req.*;
import com.electromagnetic.industry.software.manage.pojo.resp.*;
import com.electromagnetic.industry.software.manage.service.EdFileInfoService;
import com.electromagnetic.industry.software.manage.service.EdTagLibraryService;
import com.electromagnetic.industry.software.manage.service.FileSystemService;
import com.electromagnetic.industry.software.manage.service.PermissionService;
import org.springframework.core.io.FileSystemResource;
@ -77,6 +78,9 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
@Resource
private ElePropertyConfig elePropertyConfig;
@Resource
private EdTagLibraryService edTagLibraryService;
/**
* 查询文件列表
*
@ -93,7 +97,6 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
}
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
.select(EdFileInfo.class, file -> !file.getColumn().equals("file_content"))
.eq(EdFileInfo::getSaveStatus, EleDataSaveStatusEnum.SUCCESS.code)

View File

@ -56,18 +56,22 @@ public class OfficeFileUtil {
try {
String pdfParentDir = FileUtil.getParent(pdfPath, 1) + File.separatorChar + IdUtil.fastSimpleUUID() + File.separatorChar;
StringBuilder command = new StringBuilder();
command.append("libreoffice").append(" ").append("--headless")
command.append("/usr/bin/libreoffice24.8").append(" ").append("--headless")
.append(" ").append("--convert-to")
.append(" ").append("pdf")
.append(" ").append(wordPath)
.append(" ").append("--outdir")
.append(" ").append(pdfParentDir);
log.info("convert word file to pdf, command: {}", command);
Process process = RuntimeUtil.exec(command.toString());
process.waitFor();
if (process.exitValue() != 0) {
String info = StrFormatter.format("word文档{}转换成pdf文档{}失败", wordPath, pdfPath);
throw new BizException(info);
}
String outPdfPath = FileUtil.loopFiles(pdfParentDir).get(0).getAbsolutePath();
FileUtil.move(new File(outPdfPath), new File(pdfPath), true);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new BizException(e.getMessage(), e);