添加tag和属性预览相关。
This commit is contained in:
parent
bd59d91776
commit
34fdf667ec
|
|
@ -1,6 +1,7 @@
|
||||||
package com.electromagnetic.industry.software.manage.config;
|
package com.electromagnetic.industry.software.manage.config;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
|
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||||
import org.apache.ibatis.reflection.MetaObject;
|
import org.apache.ibatis.reflection.MetaObject;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|
@ -26,8 +27,8 @@ public class EdMetaObjectHandler implements MetaObjectHandler {
|
||||||
if (metaObject.hasGetter("updatedAt")) {
|
if (metaObject.hasGetter("updatedAt")) {
|
||||||
this.strictInsertFill(metaObject, "updatedAt", Date.class, new Date());
|
this.strictInsertFill(metaObject, "updatedAt", Date.class, new Date());
|
||||||
}
|
}
|
||||||
if (metaObject.hasGetter("updatedTime")) {
|
if (metaObject.hasGetter("createdBy")) {
|
||||||
this.strictInsertFill(metaObject, "updatedTime", Date.class, new Date());
|
this.strictUpdateFill(metaObject, "createdBy", String.class, UserThreadLocal.getUserId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,6 +43,9 @@ public class EdMetaObjectHandler implements MetaObjectHandler {
|
||||||
if (metaObject.hasGetter("updatedTime")) {
|
if (metaObject.hasGetter("updatedTime")) {
|
||||||
this.strictUpdateFill(metaObject, "updatedTime", Date.class, new Date());
|
this.strictUpdateFill(metaObject, "updatedTime", Date.class, new Date());
|
||||||
}
|
}
|
||||||
|
if (metaObject.hasGetter("updatedBy")) {
|
||||||
|
this.strictUpdateFill(metaObject, "updatedTime", String.class, UserThreadLocal.getUserId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.electromagnetic.industry.software.manage.pojo.models;
|
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
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;
|
private Date createdTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建人
|
* 创建人
|
||||||
*/
|
*/
|
||||||
@TableField(value = "created_by")
|
@TableField(value = "created_by", fill = FieldFill.INSERT)
|
||||||
private String createdBy;
|
private String createdBy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最后更新时间
|
* 最后更新时间
|
||||||
*/
|
*/
|
||||||
@TableField(value = "updated_time")
|
@TableField(value = "updated_time", fill = FieldFill.UPDATE)
|
||||||
private Date updatedTime;
|
private Date updatedTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最后更新人
|
* 最后更新人
|
||||||
*/
|
*/
|
||||||
@TableField(value = "updated_by")
|
@TableField(value = "updated_by", fill = FieldFill.UPDATE)
|
||||||
private String updatedBy;
|
private String updatedBy;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
package com.electromagnetic.industry.software.manage.pojo.other;
|
package com.electromagnetic.industry.software.manage.pojo.other;
|
||||||
|
|
||||||
|
import com.electromagnetic.industry.software.manage.pojo.resp.FileTagInfo;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class FileInfoVO {
|
public class FileInfoVO {
|
||||||
|
|
@ -43,4 +45,7 @@ public class FileInfoVO {
|
||||||
private String fileCode;
|
private String fileCode;
|
||||||
|
|
||||||
private String createdBy;
|
private String createdBy;
|
||||||
|
|
||||||
|
private List<FileTagInfo> labels;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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.req.*;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.resp.*;
|
import com.electromagnetic.industry.software.manage.pojo.resp.*;
|
||||||
import com.electromagnetic.industry.software.manage.service.EdFileInfoService;
|
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.FileSystemService;
|
||||||
import com.electromagnetic.industry.software.manage.service.PermissionService;
|
import com.electromagnetic.industry.software.manage.service.PermissionService;
|
||||||
import org.springframework.core.io.FileSystemResource;
|
import org.springframework.core.io.FileSystemResource;
|
||||||
|
|
@ -77,6 +78,9 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
@Resource
|
@Resource
|
||||||
private ElePropertyConfig elePropertyConfig;
|
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)
|
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.select(EdFileInfo.class, file -> !file.getColumn().equals("file_content"))
|
.select(EdFileInfo.class, file -> !file.getColumn().equals("file_content"))
|
||||||
.eq(EdFileInfo::getSaveStatus, EleDataSaveStatusEnum.SUCCESS.code)
|
.eq(EdFileInfo::getSaveStatus, EleDataSaveStatusEnum.SUCCESS.code)
|
||||||
|
|
|
||||||
|
|
@ -56,18 +56,22 @@ public class OfficeFileUtil {
|
||||||
try {
|
try {
|
||||||
String pdfParentDir = FileUtil.getParent(pdfPath, 1) + File.separatorChar + IdUtil.fastSimpleUUID() + File.separatorChar;
|
String pdfParentDir = FileUtil.getParent(pdfPath, 1) + File.separatorChar + IdUtil.fastSimpleUUID() + File.separatorChar;
|
||||||
StringBuilder command = new StringBuilder();
|
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("--convert-to")
|
||||||
.append(" ").append("pdf")
|
.append(" ").append("pdf")
|
||||||
.append(" ").append(wordPath)
|
.append(" ").append(wordPath)
|
||||||
.append(" ").append("--outdir")
|
.append(" ").append("--outdir")
|
||||||
.append(" ").append(pdfParentDir);
|
.append(" ").append(pdfParentDir);
|
||||||
|
log.info("convert word file to pdf, command: {}", command);
|
||||||
Process process = RuntimeUtil.exec(command.toString());
|
Process process = RuntimeUtil.exec(command.toString());
|
||||||
process.waitFor();
|
process.waitFor();
|
||||||
if (process.exitValue() != 0) {
|
if (process.exitValue() != 0) {
|
||||||
String info = StrFormatter.format("word文档{}转换成pdf文档{}失败", wordPath, pdfPath);
|
String info = StrFormatter.format("word文档{}转换成pdf文档{}失败", wordPath, pdfPath);
|
||||||
throw new BizException(info);
|
throw new BizException(info);
|
||||||
}
|
}
|
||||||
|
String outPdfPath = FileUtil.loopFiles(pdfParentDir).get(0).getAbsolutePath();
|
||||||
|
FileUtil.move(new File(outPdfPath), new File(pdfPath), true);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
throw new BizException(e.getMessage(), e);
|
throw new BizException(e.getMessage(), e);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue