根据制度正文生成条款调整
This commit is contained in:
parent
16c0b40946
commit
ed7e3f55d5
@ -288,7 +288,8 @@ public class CreateMaps implements IJob {
|
||||
* @param name
|
||||
*/
|
||||
public boolean updateMaps2(UserContext userContext, String id,DCContext dcContextpdf1, String name, String groupValue, String fileValue, String fileName) {
|
||||
PALRepositoryModel palRepositoryModel = ReadWordUtil.getRepositoryByName(id, name);
|
||||
PALRepositoryModel palRepositoryModel = PALRepositoryCache.getCache().get(fileValue);
|
||||
//PALRepositoryModel palRepositoryModel = ReadWordUtil.getRepositoryByName(id, name);
|
||||
if(palRepositoryModel == null){
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ 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.cache.PALRepositoryCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
|
||||
@ -271,32 +272,25 @@ public class ReadWordUtil {
|
||||
//将文件挂载到附件里面
|
||||
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, name);
|
||||
try {
|
||||
String id = palRepositoryModel.getId();
|
||||
logMaps.put("PALID",id);
|
||||
//查询对应绩效模型中数据模型进行填充数据
|
||||
BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(id, 0);
|
||||
String shpId = "";
|
||||
String define = defineModel.getDefinition();
|
||||
JSONObject definition = JSONObject.parseObject(define);
|
||||
JSONObject elements = definition.getJSONObject("elements");
|
||||
for (String key : elements.keySet()) {
|
||||
JSONObject shape1 = elements.getJSONObject(key);
|
||||
if("regulation".equals(shape1.getString("name"))) {
|
||||
shpId = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//删除已有xml文件
|
||||
StringBuffer sql = new StringBuffer();
|
||||
sql.append("delete from ").append(UpfileModel.DATABASE_ENTITY).append(" WHERE SHAPEID = '" + shpId + "'");
|
||||
int update = DBSql.update(sql.toString());
|
||||
boolean writeFileTodisk = writeFileTodisk(userContext, shpId, fileName, originfile, palRepositoryModel.getId(), "s");
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
/* 上传附件到第一个形状,现在已改为每次重新生成第一个节点
|
||||
* try { PALRepositoryModel palRepositoryModel =
|
||||
* PALRepositoryCache.getCache().get(fileValue); String id =
|
||||
* palRepositoryModel.getId(); logMaps.put("PALID",id); //查询对应绩效模型中数据模型进行填充数据
|
||||
* BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(id,
|
||||
* 0); String shpId = ""; String define = defineModel.getDefinition();
|
||||
* JSONObject definition = JSONObject.parseObject(define); JSONObject elements =
|
||||
* definition.getJSONObject("elements"); for (String key : elements.keySet()) {
|
||||
* JSONObject shape1 = elements.getJSONObject(key);
|
||||
* if("regulation".equals(shape1.getString("name"))||"I/O_L4".equals(shape1.
|
||||
* getString("name"))) { shpId = key; break; } } //删除已有xml文件 StringBuffer sql =
|
||||
* new StringBuffer();
|
||||
* sql.append("delete from ").append(UpfileModel.DATABASE_ENTITY).
|
||||
* append(" WHERE SHAPEID = '" + shpId + "'"); int update =
|
||||
* DBSql.update(sql.toString()); boolean writeFileTodisk =
|
||||
* writeFileTodisk(userContext, shpId, fileName, originfile,
|
||||
* palRepositoryModel.getId(), "s"); } catch (FileNotFoundException e) { // TODO
|
||||
* Auto-generated catch block e.printStackTrace(); }
|
||||
*/
|
||||
//创建图形
|
||||
if (iscreatemap) {
|
||||
DCContext dcContextpdf1 = new DCContext(userContext, dcProfilepdfdoc, "com.actionsoft.apps.coe.pal.datamigration", groupValue, fileValue, fileName);
|
||||
|
||||
@ -1,9 +1,30 @@
|
||||
package com.actionsoft.apps.coe.pal.datamigration.util.readword;
|
||||
|
||||
import cn.jpush.api.utils.StringUtils;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.poi.hwpf.usermodel.Paragraph;
|
||||
import org.apache.poi.xwpf.usermodel.IBodyElement;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.aris.mapping.ModelMappingAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.constant.Constant;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.util.ShapeUtil;
|
||||
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.resource.plugin.profile.DCPluginProfile;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.bpms.server.fs.DCContext;
|
||||
@ -15,19 +36,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.spire.doc.Document;
|
||||
import com.spire.doc.FileFormat;
|
||||
|
||||
import org.apache.poi.hwpf.usermodel.Paragraph;
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import cn.jpush.api.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* @author baizp
|
||||
@ -109,7 +118,7 @@ public class WordUtilXWPF {
|
||||
}
|
||||
|
||||
public JSONObject rewritContent2(UserContext userContext, JSONObject elements, DCContext dcContextpdf, String name,
|
||||
JSONObject shapefirst, String plid, int type,String groupValue, String fileValue, String fileName) {
|
||||
JSONObject shapefirst, String plid, int type, String groupValue, String fileValue, String fileName) {
|
||||
|
||||
// File file = null;
|
||||
int count = 0;
|
||||
@ -127,7 +136,7 @@ public class WordUtilXWPF {
|
||||
|
||||
// 保存为Docx格式
|
||||
|
||||
docs.saveToFile(path+name+".docx",FileFormat.Docx);
|
||||
docs.saveToFile(path + name + ".docx", FileFormat.Docx);
|
||||
|
||||
File f = new File(path + fileName);
|
||||
|
||||
@ -144,34 +153,33 @@ public class WordUtilXWPF {
|
||||
// 保存为Doc格式 //docs.saveToFile("toDoc.doc",FileFormat.Doc);
|
||||
|
||||
//
|
||||
DCPluginProfile dcProfilepdfdoc = DCProfileManager.getDCProfile("com.actionsoft.apps.coe.pal.datamigration", "migration");
|
||||
DCContext dcContextpdf1 = new DCContext(userContext, dcProfilepdfdoc, "com.actionsoft.apps.coe.pal.datamigration", groupValue, fileValue, name+".docx");
|
||||
DCPluginProfile dcProfilepdfdoc = DCProfileManager.getDCProfile("com.actionsoft.apps.coe.pal.datamigration",
|
||||
"migration");
|
||||
DCContext dcContextpdf1 = new DCContext(userContext, dcProfilepdfdoc,
|
||||
"com.actionsoft.apps.coe.pal.datamigration", groupValue, fileValue, name + ".docx");
|
||||
InputStream docxfile = SDK.getDCAPI().read(dcContextpdf1);
|
||||
|
||||
XWPFDocument doc = new XWPFDocument(docxfile);
|
||||
JSONArray onlinedata = new JSONArray();
|
||||
if (shapefirst == null || shapefirst.size() == 0) {
|
||||
|
||||
// 创建起始节点
|
||||
JSONObject shapeze = ShapeUtil.getProcessShapeDefinitionByName("control.policy", "regulation");
|
||||
String shapeIdz = UUIDGener.getObjectId();
|
||||
shapeze.put("text", name);// 不生效
|
||||
shapeze.put("level", 0);
|
||||
JSONObject props1 = shapeze.getJSONObject("props");// 位置大小
|
||||
shapeze.put("id", shapeIdz);
|
||||
props1.put("x", 100);
|
||||
props1.put("y", 277);
|
||||
props1.put("w", 110);
|
||||
props1.put("h", 50);
|
||||
props1.put("x", 180);
|
||||
props1.put("y", 180);
|
||||
props1.put("w", 150);
|
||||
props1.put("h", 66);
|
||||
props1.put("zindex", 0);
|
||||
shapeze.put("next", true);
|
||||
elements.put(shapeIdz, shapeze);
|
||||
shapeze.put("p", 0);
|
||||
onlinedata.add(shapeze);
|
||||
} else {
|
||||
elements.put(shapefirst.getString("id"), shapefirst);
|
||||
shapefirst.put("next", true);
|
||||
shapefirst.put("p", 0);
|
||||
onlinedata.add(shapefirst);
|
||||
}
|
||||
// 上传附件
|
||||
writeFileTodisk(userContext, shapeIdz, fileName, docxfile, fileValue, "s");
|
||||
|
||||
// 获取段落
|
||||
List<XWPFParagraph> paras = doc.getParagraphs();
|
||||
@ -206,7 +214,7 @@ public class WordUtilXWPF {
|
||||
if (isstart) {// && numlevel == null && isstart) {
|
||||
count++;
|
||||
isstart = false;
|
||||
//continue;
|
||||
// continue;
|
||||
}
|
||||
if (isstart) {
|
||||
continue;
|
||||
@ -1044,4 +1052,43 @@ public class WordUtilXWPF {
|
||||
}
|
||||
return titleLvl;
|
||||
}
|
||||
/**
|
||||
* 将文件挂载到附件
|
||||
*
|
||||
* @param me
|
||||
* @param reid
|
||||
* @param filename
|
||||
* @param inputStream
|
||||
* @param pl_uuid
|
||||
* @param type
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public boolean 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 = null;
|
||||
//创建数据库数据
|
||||
UpfileModel model = new UpfileModel();
|
||||
model.setPl_uuid(pl_uuid);
|
||||
if ("f".equals(type)) {
|
||||
model.setShape_uuid("");
|
||||
model.setType("f");
|
||||
dcContextpdf = new DCContext(me, fileProfile, CoEConstant.APP_ID, "file", pl_uuid, filename);
|
||||
} else {
|
||||
//dcContextpdf = new DCContext(me, fileProfile, CoEConstant.APP_ID, "file", pl_uuid, filename);
|
||||
dcContextpdf = new DCContext(me, fileProfile, CoEConstant.APP_ID, pl_uuid, reid, filename);
|
||||
model.setShape_uuid(reid);
|
||||
model.setType("s");
|
||||
}
|
||||
SDK.getDCAPI().write(inputStream, dcContextpdf);
|
||||
model.setUuid(UUIDGener.getUUID());
|
||||
model.setFileName(filename);
|
||||
model.setDownload(1);
|
||||
model.setCreateUser(me.getUID());
|
||||
model.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||
if(new UpFileDao().create(model)>0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -801,14 +801,14 @@
|
||||
<!-- <div id="bar_activityNo" awsui-qtip='节点编号排序' class="toolbar_button">
|
||||
<div class="ico extend_activityNo"></div>
|
||||
</div>-->
|
||||
<div id="bar_importShape" awsui-qtip='上传附件并创建相应节点' class="toolbar_button" style="<#importShapeStyle>">
|
||||
<!-- <div id="bar_importShape" awsui-qtip='上传附件并创建相应节点' class="toolbar_button" style="<#importShapeStyle>">
|
||||
<div class="ico ico_importShape"></div>
|
||||
</div>
|
||||
</div>-->
|
||||
|
||||
<div id="QualityInspection" awsui-qtip='质量检测' class="toolbar_button">
|
||||
<div class="ico QualityInspection"></div>
|
||||
</div>
|
||||
<div id="bar_importPolicyFile" awsui-qtip='上传附件并创建制度' class="toolbar_button" style="<#importShapeStyle>">
|
||||
<div id="bar_importPolicyFile" awsui-qtip='上传正文生成条款' class="toolbar_button" style="<#importShapeStyle>">
|
||||
<div class="ico ico_importShape"></div>
|
||||
</div>
|
||||
<!-- <div id="bar_import" awsui-qtip='导入' class="toolbar_button" style="<#importStyle>">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user