|
|
@@ -3,11 +3,12 @@ package com.siwei.apply.service.impl;
|
|
|
import com.siwei.apply.common.UnifyAttachmentEnum;
|
|
|
import com.siwei.apply.domain.NodeAttachment;
|
|
|
import com.siwei.apply.domain.Project;
|
|
|
+import com.siwei.apply.domain.ProjectAttachmentInfo;
|
|
|
import com.siwei.apply.domain.ProjectWorkflow;
|
|
|
-import com.siwei.apply.domain.Workflow;
|
|
|
import com.siwei.apply.domain.res.TdgyRes;
|
|
|
import com.siwei.apply.enums.*;
|
|
|
import com.siwei.apply.mapper.NodeAttachmentMapper;
|
|
|
+import com.siwei.apply.mapper.ProjectAttachmentInfoMapper;
|
|
|
import com.siwei.apply.mapper.ProjectMapper;
|
|
|
import com.siwei.apply.mapper.ProjectWorkflowMapper;
|
|
|
import com.siwei.apply.service.NodeAttachmentService;
|
|
|
@@ -16,11 +17,9 @@ import com.siwei.apply.utils.FileExtractUtil;
|
|
|
import com.siwei.apply.utils.ServiceFileUtil;
|
|
|
import com.siwei.apply.utils.ServiceUtil;
|
|
|
import com.siwei.common.core.exception.ServiceException;
|
|
|
-import org.apache.catalina.core.ApplicationContext;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.apache.commons.io.FilenameUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.apache.ibatis.annotations.Param;
|
|
|
-import org.apache.poi.sl.usermodel.ObjectMetaData;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -53,6 +52,11 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
@Autowired
|
|
|
private TdgyService tdgyService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ProjectAttachmentInfoMapper projectAttachmentInfoMapper;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 根据ID查询附件信息
|
|
|
* @param id 附件ID
|
|
|
@@ -585,6 +589,47 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 1.查询出当前存在的
|
|
|
+ * 2.找出新增的
|
|
|
+ * 3.找出要删除的
|
|
|
+ * 3.再次更新
|
|
|
+ *
|
|
|
+ *
|
|
|
+ *
|
|
|
+ * 更新附件信息关联全文检索
|
|
|
+ * @param projectId
|
|
|
+ * @param nodeId
|
|
|
+ * @param rootPath
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+
|
|
|
+ public Boolean modifyAttachmentInfo(String projectId,String nodeId,String rootPath){
|
|
|
+ try {
|
|
|
+ List<Path> fileList = ServiceFileUtil.getDirectoryFileList(rootPath);
|
|
|
+
|
|
|
+
|
|
|
+ if(CollectionUtils.isEmpty(fileList)){
|
|
|
+ for(Path path : fileList){
|
|
|
+ ProjectAttachmentInfo projectAttachmentInfo = new ProjectAttachmentInfo();
|
|
|
+ projectAttachmentInfo.generateId();
|
|
|
+ projectAttachmentInfo.setProjectId(projectId);
|
|
|
+ projectAttachmentInfo.setNodeId(nodeId);
|
|
|
+ projectAttachmentInfo.setFilePath(path.toString());
|
|
|
+ String baseName = FilenameUtils.getBaseName(path.getFileName().toString());
|
|
|
+ projectAttachmentInfo.setFileName(baseName);
|
|
|
+ projectAttachmentInfoMapper.insert(projectAttachmentInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new ServiceException("全文检索附件材料--保存失败");
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|