挂载附件
This commit is contained in:
parent
ecac7d4466
commit
c6e415f77d
@ -1,9 +1,13 @@
|
||||
package com.actionsoft.apps.coe.pal.datamigration.util.readword;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
|
||||
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.pal.repository.dao.CoeProcessLevelDaoFacotory;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.constant.CoeFileConstant;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.dao.UpFileDao;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.web.CoeProcessLevelWeb;
|
||||
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
@ -22,6 +26,7 @@ import org.apache.poi.hwpf.HWPFDocument;
|
||||
import org.apache.poi.hwpf.usermodel.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -162,13 +167,25 @@ public class ReadWordUtil {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
//进行文件解析
|
||||
DCPluginProfile dcProfilepdfdoc = DCProfileManager.getDCProfile("com.actionsoft.apps.coe.pal.datamigration", "migration");
|
||||
//将文件挂载到附件里面
|
||||
DCContext dcContextorigin = new DCContext(userContext, dcProfilepdfdoc, "com.actionsoft.apps.coe.pal.datamigration", groupValue, fileValue, fileName);
|
||||
InputStream originfile = SDK.getDCAPI().read(dcContextorigin);
|
||||
PALRepositoryModel palRepositoryModel = getRepositoryByName(wsId, docname.replace(".doc", ""));
|
||||
if (palRepositoryModel != null) {
|
||||
try {
|
||||
writeFileTodisk(userContext, "", fileName, originfile, palRepositoryModel.getId(),"f");
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//进行文件解析
|
||||
DCContext dcContextpdfdoc = new DCContext(userContext, dcProfilepdfdoc, "com.actionsoft.apps.coe.pal.datamigration", groupValue, fileValue, docname);
|
||||
InputStream docfile = SDK.getDCAPI().read(dcContextpdfdoc);
|
||||
ReadWordUtil tmp = new ReadWordUtil();
|
||||
tmp.writeAttrbute(userContext, docfile, docname.replace(".doc", ""), wsId);
|
||||
|
||||
//创建图形
|
||||
DCContext dcContextpdf1 = new DCContext(userContext, dcProfilepdfdoc, "com.actionsoft.apps.coe.pal.datamigration", groupValue, fileValue, docxname);
|
||||
InputStream docxfile = SDK.getDCAPI().read(dcContextpdf1);
|
||||
new CreateMaps().updateMaps(userContext, wsId, docxfile, docxname.replace(".docx", ""));
|
||||
@ -410,6 +427,39 @@ public class ReadWordUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将文件挂载到附件
|
||||
* @param me
|
||||
* @param reid
|
||||
* @param filename
|
||||
* @param inputStream
|
||||
* @param pl_uuid
|
||||
* @param type
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public void writeFileTodisk(UserContext me, String reid, String filename, InputStream inputStream, String pl_uuid,String type) throws FileNotFoundException {
|
||||
//InputStream ins = new FileInputStream("");
|
||||
DCPluginProfile fileProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
||||
DCContext dcContextpdf = new DCContext(me, fileProfile, CoEConstant.APP_ID, "file", pl_uuid, filename);
|
||||
SDK.getDCAPI().write(inputStream, dcContextpdf);
|
||||
//创建数据库数据
|
||||
UpfileModel model = new UpfileModel();
|
||||
model.setPl_uuid(pl_uuid);
|
||||
if("f".equals(type)){
|
||||
model.setShape_uuid("");
|
||||
model.setType("f");
|
||||
}else {
|
||||
model.setShape_uuid(reid);
|
||||
model.setType("s");
|
||||
}
|
||||
model.setUuid(UUIDGener.getUUID());
|
||||
model.setFileName(filename);
|
||||
model.setDownload(1);
|
||||
model.setCreateUser(me.getUID());
|
||||
model.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
new UpFileDao().create(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据名字寻找palmode
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user