批量导入正文代码提交

This commit is contained in:
zhal 2023-07-17 17:54:46 +08:00
parent 1642c43f4d
commit b0bf1119ad
2 changed files with 383 additions and 392 deletions

View File

@ -1,29 +1,5 @@
package com.actionsoft.apps.coe.pal.datamigration.util.readtable;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.usermodel.CharacterRun;
import org.apache.poi.hwpf.usermodel.Paragraph;
import org.apache.poi.hwpf.usermodel.Range;
import org.apache.poi.hwpf.usermodel.Table;
import org.apache.poi.hwpf.usermodel.TableCell;
import org.apache.poi.hwpf.usermodel.TableRow;
import com.actionsoft.apps.coe.pal.datamigration.model.po.WordAttribute;
import com.actionsoft.apps.coe.pal.datamigration.model.po.WordField;
import com.actionsoft.apps.coe.pal.datamigration.util.ShapeUtil;
@ -49,8 +25,13 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aspose.words.Document;
import com.aspose.words.SaveFormat;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.usermodel.*;
import java.io.*;
import java.util.*;
/**
* @author baizp
@ -315,15 +296,25 @@ public class ReadTable {
}
@SuppressWarnings("deprecation")
public void controlPolicyFile_import(UserContext userContext, String wsId, String groupValue, String fileValue, String fileName) {
HashMap<String, Object> logMaps = new HashMap<String, Object>();
logMaps.put("FILENAME", fileName);
try {
String substring = fileName.substring(0,fileName.indexOf(".xml"));
//获取最后一个.的位置
int lastIndexOf = fileName.lastIndexOf(".");
//获取文件的后缀名
String suffix = fileName.substring(lastIndexOf);
String substring;
if (StringUtils.equals(suffix, ".xml")) {
substring = fileName.substring(0, fileName.indexOf(".xml"));
} else {
substring = fileName.substring(0, fileName.indexOf(".doc"));
}
PALRepositoryModel palRepositoryModel = ReadWordUtil.getRepositoryByName2(wsId, substring);
if (null == palRepositoryModel) {
logMaps.put("UPFILESTATE", "文件没有匹配到制度模型!");
@ -366,7 +357,9 @@ public class ReadTable {
}
}
}
} catch (Exception e) {
// TODO: handle exception
} finally {
@ -566,7 +559,6 @@ public class ReadTable {
}
/**
* 创建表单图形,用于挂附件
*
@ -614,7 +606,6 @@ public class ReadTable {
}
/**
* 创建表单图形
*