制度手册开发
This commit is contained in:
parent
86cf8fa119
commit
3a3a709eb2
Binary file not shown.
@ -2,6 +2,7 @@ package com.awspaas.apps.coe.pal.output.zd.report1;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.sql.Timestamp;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ import com.actionsoft.bpms.server.DispatcherRequest;
|
|||||||
import com.actionsoft.bpms.server.UserContext;
|
import com.actionsoft.bpms.server.UserContext;
|
||||||
import com.actionsoft.bpms.server.fs.DCContext;
|
import com.actionsoft.bpms.server.fs.DCContext;
|
||||||
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
|
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
|
||||||
|
import com.actionsoft.bpms.util.UtilDate;
|
||||||
import com.actionsoft.bpms.util.UtilFile;
|
import com.actionsoft.bpms.util.UtilFile;
|
||||||
import com.actionsoft.bpms.util.UtilString;
|
import com.actionsoft.bpms.util.UtilString;
|
||||||
import com.actionsoft.sdk.local.SDK;
|
import com.actionsoft.sdk.local.SDK;
|
||||||
@ -41,6 +43,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.awspaas.apps.coe.pal.output.zd.util.PrReportComment;
|
import com.awspaas.apps.coe.pal.output.zd.util.PrReportComment;
|
||||||
import com.awspaas.apps.coe.pal.output.zd.util.ReportRepositoryCompare;
|
import com.awspaas.apps.coe.pal.output.zd.util.ReportRepositoryCompare;
|
||||||
import com.awspaas.apps.coe.pal.output.zd.util.XMLUtil;
|
import com.awspaas.apps.coe.pal.output.zd.util.XMLUtil;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.dom4j.Document;
|
import org.dom4j.Document;
|
||||||
import org.dom4j.DocumentException;
|
import org.dom4j.DocumentException;
|
||||||
import org.dom4j.Element;
|
import org.dom4j.Element;
|
||||||
@ -58,6 +61,9 @@ public class Report1Gener {
|
|||||||
public static final Object _lock = new Object();
|
public static final Object _lock = new Object();
|
||||||
private UserContext userContext = null;
|
private UserContext userContext = null;
|
||||||
GenerLogExd log = new GenerLogExd();
|
GenerLogExd log = new GenerLogExd();
|
||||||
|
//word换行符
|
||||||
|
private final String WRAPSTRING = "</w:t></w:r></w:p><w:p><w:pPr><w:keepNext w:val=\"off\"/><w:keepLines w:val=\"off\"/><w:pageBreakBefore w:val=\"off\"/><w:widowControl/><w:kinsoku/><w:wordWrap/><w:overflowPunct/><w:topLinePunct w:val=\"off\"/><w:autoSpaceDE/><w:autoSpaceDN/><w:adjustRightInd/><w:snapToGrid/><w:spacing w:line=\"240\" w:line-rule=\"auto\"/><w:ind w:left=\"56\" w:right=\"0\" w:right-chars=\"0\" w:first-line=\"0\" w:first-line-chars=\"0\"/><w:jc w:val=\"both\"/><w:textAlignment w:val=\"auto\"/><w:outlineLvl w:val=\"9\"/><w:rPr><w:rFonts w:ascii=\"宋体\" w:h-ansi=\"宋体\" w:fareast=\"宋体\" w:cs=\"宋体\" w:hint=\"fareast\"/><w:color w:val=\"auto\"/><w:sz w:val=\"21\"/><w:sz-cs w:val=\"21\"/><w:lang w:val=\"EN-US\"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"宋体\" w:h-ansi=\"宋体\" w:fareast=\"宋体\" w:cs=\"宋体\" w:hint=\"fareast\"/><w:color w:val=\"auto\"/><w:sz w:val=\"21\"/><w:sz-cs w:val=\"21\"/><w:lang w:val=\"EN-US\"/></w:rPr><w:t>";
|
||||||
|
|
||||||
public Report1Gener() {
|
public Report1Gener() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,9 +95,7 @@ public class Report1Gener {
|
|||||||
// ----预处理、校验----
|
// ----预处理、校验----
|
||||||
OutputAppProfile appModel = OutputAppManager.getProfile(model.getProfileId());
|
OutputAppProfile appModel = OutputAppManager.getProfile(model.getProfileId());
|
||||||
String tempPath = appModel.getAppContext().getPath();
|
String tempPath = appModel.getAppContext().getPath();
|
||||||
//String tempName = "步骤横表-流程手册.xml";
|
String tempName = "制度-手册2.xml";
|
||||||
// String tempName = "制度-手册(修改中).xml";
|
|
||||||
String tempName = "伊利集团流程制度类文件管理规范.xml";
|
|
||||||
log.info("begin...");
|
log.info("begin...");
|
||||||
log.info("-------------------");
|
log.info("-------------------");
|
||||||
// ----文件处理-----
|
// ----文件处理-----
|
||||||
@ -164,7 +168,7 @@ public class Report1Gener {
|
|||||||
docName = docPath + fileName + ".doc";
|
docName = docPath + fileName + ".doc";
|
||||||
indexMap.put(fileName, 1);
|
indexMap.put(fileName, 1);
|
||||||
}
|
}
|
||||||
JSONObject dataMap = getData(repositoryId, wizardJsonData, docPath, fileName);
|
JSONObject dataMap = getData2(repositoryId, wizardJsonData, docPath, fileName);
|
||||||
if (dataMap != null) {
|
if (dataMap != null) {
|
||||||
OutputWordUtil.createDoc2(dataMap, tempPath, tempName, docName);
|
OutputWordUtil.createDoc2(dataMap, tempPath, tempName, docName);
|
||||||
}
|
}
|
||||||
@ -172,32 +176,39 @@ public class Report1Gener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private JSONObject getData(String repositoryId, JSONObject wizardJsonData, String docPath, String fileName) {
|
/**
|
||||||
|
* 获取条款内容xml
|
||||||
|
* @param repositoryId
|
||||||
|
* @param controlShapeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Map<String, String> getContentData(String repositoryId, String controlShapeId) {
|
||||||
|
Map<String, String> result = new HashMap<>();
|
||||||
|
result.put("listDef", "");
|
||||||
|
result.put("content", "");
|
||||||
|
if (UtilString.isEmpty(controlShapeId)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
PALRepositoryModel repositoryModel = PALRepositoryQueryAPIManager.getInstance().queryPalRepositoryModelByPalId(repositoryId);
|
PALRepositoryModel repositoryModel = PALRepositoryQueryAPIManager.getInstance().queryPalRepositoryModelByPalId(repositoryId);
|
||||||
if (repositoryModel == null) {
|
if (repositoryModel == null) {
|
||||||
return null;
|
return result;
|
||||||
}
|
}
|
||||||
JSONObject dataMap = new JSONObject();
|
|
||||||
String content = "";
|
String content = "";
|
||||||
|
StringBuilder listStr = new StringBuilder();
|
||||||
// 读取附件
|
// 读取附件
|
||||||
// 流程附件列表
|
// 流程附件列表
|
||||||
UpFileDao upFileDao = new UpFileDao();
|
UpFileDao upFileDao = new UpFileDao();
|
||||||
StringBuffer sqlWhere = new StringBuffer();
|
List<UpfileModel> search = upFileDao.search(repositoryModel.getId(), controlShapeId, null);
|
||||||
sqlWhere.append(" and PALREPOSITORYID ='").append(repositoryModel.getId()).append("'");
|
|
||||||
List<UpfileModel> search = upFileDao.search(sqlWhere.toString());
|
|
||||||
|
|
||||||
DCContext dc = null;
|
DCContext dc = null;
|
||||||
File file = null;
|
File file = null;
|
||||||
if (search != null && search.size() > 0) {
|
if (search != null && search.size() > 0) {
|
||||||
// 复制附件
|
// 复制附件
|
||||||
for (UpfileModel upfileModel : search) {
|
for (UpfileModel upfileModel : search) {
|
||||||
if (!"f".equals(upfileModel.getType())) {// 文件
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (upfileModel.getFileName().contains(".xml")) {
|
if (upfileModel.getFileName().contains(".xml")) {
|
||||||
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
||||||
if (dcProfile != null) {
|
if (dcProfile != null) {
|
||||||
dc = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, "file", upfileModel.getPl_uuid(), upfileModel.getFileName());
|
dc = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, upfileModel.getPl_uuid(), upfileModel.getShape_uuid(), upfileModel.getFileName());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,32 +220,93 @@ public class Report1Gener {
|
|||||||
if (file != null) {
|
if (file != null) {
|
||||||
// 解析xml文件
|
// 解析xml文件
|
||||||
// 校验xml文档是否能够正常解析
|
// 校验xml文档是否能够正常解析
|
||||||
// Document doc = analysisXMLFile(file.getPath(), true);
|
Document doc = analysisXMLFile(file.getPath(), true);
|
||||||
// if (doc == null) {
|
if (doc == null) {
|
||||||
// System.out.println("解析xml失败");
|
System.out.println("解析xml失败");
|
||||||
// return null;
|
return null;
|
||||||
|
}
|
||||||
|
int step = 20;// 以20为步长进行批量调整
|
||||||
|
// 解析根节点
|
||||||
|
Element root = doc.getRootElement();
|
||||||
|
|
||||||
|
// System.out.println(root.getName());
|
||||||
|
Element lists = root.element("lists");
|
||||||
|
if (lists != null) {
|
||||||
|
for (Object obj : lists.elements()) {
|
||||||
|
Element e = (Element)obj;
|
||||||
|
String name = e.getName();
|
||||||
|
if ("listDef".equals(name)) {
|
||||||
|
e.setAttributeValue("listDefId", Integer.parseInt(e.attributeValue("listDefId")) + step + "");
|
||||||
|
listStr.append(e.asXML());
|
||||||
|
}
|
||||||
|
if ("list".equals(name)) {
|
||||||
|
e.setAttributeValue("ilfo", Integer.parseInt(e.attributeValue("ilfo")) + step + "");
|
||||||
|
Element ilst = e.element("ilst");
|
||||||
|
ilst.setAttributeValue("val", Integer.parseInt(ilst.attributeValue("val")) + step + "");
|
||||||
|
listStr.append(e.asXML());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (listStr.length() > 0) {
|
||||||
|
// System.out.println(listStr);
|
||||||
// }
|
// }
|
||||||
// // 解析根节点
|
|
||||||
// Element root = doc.getRootElement();
|
|
||||||
// // System.out.println(root.getName());
|
|
||||||
// Element body = root.element("body");
|
// Element body = root.element("body");
|
||||||
// if (body != null) {
|
// if (body != null) {
|
||||||
// // System.out.println(body.getName());
|
// // System.out.println(body.getName());
|
||||||
// // System.out.println(body.asXML());
|
// //System.out.println(body.asXML());
|
||||||
// List<Element> childList = body.elements();
|
// List<Element> childList = body.elements();
|
||||||
// if (childList != null) {
|
// if (childList != null) {
|
||||||
// for (Element e : childList) {
|
// for (Element e : childList) {
|
||||||
// content += e.asXML();
|
// //System.out.println(e.getName());
|
||||||
|
// // str += e.asXML();
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// 获取字符串
|
// 获取字符串
|
||||||
content = getFileContent(file);
|
content = getFileContent(file);
|
||||||
content = content.substring(content.indexOf("<wx:sect>") + 9, content.indexOf("<w:sectPr"));
|
content = content.substring(content.indexOf("<wx:sect>") + 9, content.indexOf("<w:sectPr"));
|
||||||
|
// System.out.println(content);
|
||||||
|
// System.out.println("以上的是替换前文本,以下是替换后文本");
|
||||||
|
String [] contentArr = content.split("<w:ilfo w:val=\"");
|
||||||
|
for (int i = 1; i < contentArr.length; i++) {
|
||||||
|
String c = contentArr[i];
|
||||||
|
int num = Integer.parseInt(c.substring(0, c.indexOf("\"")));
|
||||||
|
num += step;
|
||||||
|
contentArr[i] = num + c.substring(c.indexOf("\""));
|
||||||
|
}
|
||||||
|
List<String> list = Arrays.asList(contentArr);
|
||||||
|
content = StringUtils.join(list, "<w:ilfo w:val=\"");
|
||||||
}
|
}
|
||||||
dataMap.put("content", content);
|
String listStr2 = listStr.toString();
|
||||||
return dataMap;
|
listStr2 = listStr2.replace("xmlns:aml=\"http://schemas.microsoft.com/aml/2001/core\"", "")
|
||||||
|
.replace("xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\"", "")
|
||||||
|
.replace("xmlns:cx=\"http://schemas.microsoft.com/office/drawing/2014/chartex\"", "")
|
||||||
|
.replace("xmlns:cx1=\"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex\"", "")
|
||||||
|
.replace("xmlns:cx2=\"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex\"", "")
|
||||||
|
.replace("xmlns:cx3=\"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex\"", "")
|
||||||
|
.replace("xmlns:cx4=\"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex\"", "")
|
||||||
|
.replace("xmlns:cx5=\"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex\"", "")
|
||||||
|
.replace("xmlns:cx6=\"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex\"", "")
|
||||||
|
.replace("xmlns:cx7=\"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex\"", "")
|
||||||
|
.replace("xmlns:cx8=\"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex\"", "")
|
||||||
|
.replace("xmlns:dt=\"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882\"", "")
|
||||||
|
.replace("xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"", "")
|
||||||
|
.replace("xmlns:aink=\"http://schemas.microsoft.com/office/drawing/2016/ink\"", "")
|
||||||
|
.replace("xmlns:am3d=\"http://schemas.microsoft.com/office/drawing/2017/model3d\"", "")
|
||||||
|
.replace("xmlns:o=\"urn:schemas-microsoft-com:office:office\"", "")
|
||||||
|
.replace("xmlns:v=\"urn:schemas-microsoft-com:vml\"", "")
|
||||||
|
.replace("xmlns:w10=\"urn:schemas-microsoft-com:office:word\"", "")
|
||||||
|
.replace("xmlns:w=\"http://schemas.microsoft.com/office/word/2003/wordml\"", "")
|
||||||
|
.replace("xmlns:wx=\"http://schemas.microsoft.com/office/word/2003/auxHint\"", "")
|
||||||
|
.replace("xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\"", "")
|
||||||
|
.replace("xmlns:wsp=\"http://schemas.microsoft.com/office/word/2003/wordml/sp2\"", "")
|
||||||
|
.replace("xmlns:sl=\"http://schemas.microsoft.com/schemaLibrary/2003/core\"", "");
|
||||||
|
result.put("listDef", listStr2);
|
||||||
|
result.put("content", content);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFileContent(File file) {
|
public static String getFileContent(File file) {
|
||||||
@ -307,6 +379,7 @@ public class Report1Gener {
|
|||||||
if (repositoryModel == null) {
|
if (repositoryModel == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
prReportComment.getCommentContent(dataMap, repositoryModel); //获取一些公共的数据(手册首页的手册岗位名称、部门、时间等)
|
prReportComment.getCommentContent(dataMap, repositoryModel); //获取一些公共的数据(手册首页的手册岗位名称、部门、时间等)
|
||||||
|
|
||||||
JSONArray repositoryShapeTable = new JSONArray(); //流程步骤Table
|
JSONArray repositoryShapeTable = new JSONArray(); //流程步骤Table
|
||||||
@ -323,7 +396,7 @@ public class Report1Gener {
|
|||||||
if (wizardJsonData.getBoolean("orderNuberFirst")) { // 根据页面选择进行排序
|
if (wizardJsonData.getBoolean("orderNuberFirst")) { // 根据页面选择进行排序
|
||||||
OutputWordUtil.orderByNumber(repositoryFileElements);
|
OutputWordUtil.orderByNumber(repositoryFileElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 流程附件列表
|
// 流程附件列表
|
||||||
UpFileDao upFileDao = new UpFileDao();
|
UpFileDao upFileDao = new UpFileDao();
|
||||||
StringBuffer sqlWhere = new StringBuffer();
|
StringBuffer sqlWhere = new StringBuffer();
|
||||||
@ -336,18 +409,23 @@ public class Report1Gener {
|
|||||||
}
|
}
|
||||||
if (search != null && search.size() > 0) {
|
if (search != null && search.size() > 0) {
|
||||||
//创建附件目录及复制附件
|
//创建附件目录及复制附件
|
||||||
fileName = fileName + "_file";
|
// fileName = fileName + "_file";
|
||||||
file = new File(docPath, fileName);
|
// file = new File(docPath, fileName);
|
||||||
if (!file.exists()) {
|
// if (!file.exists()) {
|
||||||
log.info("创建附件");
|
// log.info("创建附件");
|
||||||
file.mkdir();
|
// file.mkdir();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
String controlShapeId = "";
|
||||||
if (repositoryFileElements != null) {
|
if (repositoryFileElements != null) {
|
||||||
int index = 1;// 流程步骤序号
|
int index = 1;// 流程步骤序号
|
||||||
int dangerIndex = 1;// 风险序号
|
int dangerIndex = 1;// 风险序号
|
||||||
int regulateIndex = 1;// 控制序号
|
int regulateIndex = 1;// 控制序号
|
||||||
for (Map<String, Object> shape : repositoryFileElements) {
|
for (Map<String, Object> shape : repositoryFileElements) {
|
||||||
|
String type = shape.get("type").toString();
|
||||||
|
if ("regulation".equals(type)) {
|
||||||
|
controlShapeId = shape.get("id").toString();
|
||||||
|
}
|
||||||
//如果图形元素不是流程步骤,不导出该元素
|
//如果图形元素不是流程步骤,不导出该元素
|
||||||
// if (PrReportComment.PROCESS_STEP.indexOf((String)shape.get("type")) == -1) {
|
// if (PrReportComment.PROCESS_STEP.indexOf((String)shape.get("type")) == -1) {
|
||||||
// continue;
|
// continue;
|
||||||
@ -356,7 +434,7 @@ public class Report1Gener {
|
|||||||
OutputWordUtil.setShapeDefaultValue2(repositoryId, _tr); //设置默认值
|
OutputWordUtil.setShapeDefaultValue2(repositoryId, _tr); //设置默认值
|
||||||
_tr.put(OutputWordUtil.SERIAL_NUMBER, index); //序号
|
_tr.put(OutputWordUtil.SERIAL_NUMBER, index); //序号
|
||||||
_tr.put(OutputWordUtil.REPOSITORY_NAME, specialCharTransfer(repositoryModel.getName().replace("\n", ""))); //流程名称
|
_tr.put(OutputWordUtil.REPOSITORY_NAME, specialCharTransfer(repositoryModel.getName().replace("\n", ""))); //流程名称
|
||||||
_tr.put(OutputWordUtil.SHAPE_NAME, specialCharTransfer(shape.get("text").toString()).replace("\n", OutputWordUtil.WRAPSTRING)); //步骤名称
|
_tr.put(OutputWordUtil.SHAPE_NAME, specialCharTransfer(shape.get("text").toString()).replace("\n", WRAPSTRING)); //步骤名称
|
||||||
|
|
||||||
/**序号改为流程编号**/
|
/**序号改为流程编号**/
|
||||||
/*_tr.put(OutputWordUtil.SERIAL_NUMBER, ""); //序号置空
|
/*_tr.put(OutputWordUtil.SERIAL_NUMBER, ""); //序号置空
|
||||||
@ -377,19 +455,19 @@ public class Report1Gener {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 复制doccenter下的文件
|
// 复制doccenter下的文件
|
||||||
DCContext dcContext = null;
|
// DCContext dcContext = null;
|
||||||
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
// DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
||||||
if (dcProfile != null) {
|
// if (dcProfile != null) {
|
||||||
dcContext = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, upfileModel.getPl_uuid(), upfileModel.getShape_uuid(), upfileModel.getFileName());
|
// dcContext = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, upfileModel.getPl_uuid(), upfileModel.getShape_uuid(), upfileModel.getFileName());
|
||||||
}
|
// }
|
||||||
File sourceFile = new UtilFile(dcContext.getFilePath());
|
// File sourceFile = new UtilFile(dcContext.getFilePath());
|
||||||
File targetFile = new UtilFile(file.toString() + File.separator + dcContext.getFileName());
|
// File targetFile = new UtilFile(file.toString() + File.separator + dcContext.getFileName());
|
||||||
try {
|
// try {
|
||||||
UtilFile.copyFile(sourceFile, targetFile);
|
// UtilFile.copyFile(sourceFile, targetFile);
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
System.out.println(e);
|
// System.out.println(e);
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
JSONObject object = new JSONObject();
|
JSONObject object = new JSONObject();
|
||||||
object.put("shape_file_name", upfileModel.getFileName());
|
object.put("shape_file_name", upfileModel.getFileName());
|
||||||
String link = fileName + File.separator + upfileModel.getFileName();
|
String link = fileName + File.separator + upfileModel.getFileName();
|
||||||
@ -411,19 +489,19 @@ public class Report1Gener {
|
|||||||
JSONObject obj = dataAttributes.getJSONObject(i);
|
JSONObject obj = dataAttributes.getJSONObject(i);
|
||||||
String attrId = obj.getString("key");
|
String attrId = obj.getString("key");
|
||||||
String attrValue = obj.getString("value");
|
String attrValue = obj.getString("value");
|
||||||
_tr.put("shape_" + attrId, attrValue.replace("\n", OutputWordUtil.WRAPSTRING));
|
_tr.put("shape_" + attrId, attrValue.replace("\n", WRAPSTRING));
|
||||||
if (raciRelationType) {// 涉及部门、岗位/角色关联的是bpm组织部门、岗位、角色
|
if (raciRelationType) {// 涉及部门、岗位/角色关联的是bpm组织部门、岗位、角色
|
||||||
if ("bpm_duty_r".equals(attrId)) {
|
if ("bpm_duty_r".equals(attrId)) {
|
||||||
_tr.put("shape_duty_r", attrValue.replace("\n", OutputWordUtil.WRAPSTRING));
|
_tr.put("shape_duty_r", attrValue.replace("\n", WRAPSTRING));
|
||||||
}
|
}
|
||||||
if ("bpm_approval_a".equals(attrId)) {
|
if ("bpm_approval_a".equals(attrId)) {
|
||||||
_tr.put("shape_approval_a", attrValue.replace("\n", OutputWordUtil.WRAPSTRING));
|
_tr.put("shape_approval_a", attrValue.replace("\n", WRAPSTRING));
|
||||||
}
|
}
|
||||||
if ("bpm_counselor_c".equals(attrId)) {
|
if ("bpm_counselor_c".equals(attrId)) {
|
||||||
_tr.put("shape_counselor_c", attrValue.replace("\n", OutputWordUtil.WRAPSTRING));
|
_tr.put("shape_counselor_c", attrValue.replace("\n", WRAPSTRING));
|
||||||
}
|
}
|
||||||
if ("bpm_notify_i".equals(attrId)) {
|
if ("bpm_notify_i".equals(attrId)) {
|
||||||
_tr.put("shape_notify_i", attrValue.replace("\n", OutputWordUtil.WRAPSTRING));
|
_tr.put("shape_notify_i", attrValue.replace("\n", WRAPSTRING));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ("danger".equals(attrId)) {
|
if ("danger".equals(attrId)) {
|
||||||
@ -440,37 +518,42 @@ public class Report1Gener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 条款内容xml
|
||||||
|
Map<String, String> contentMap = getContentData(repositoryId, controlShapeId);
|
||||||
|
String listDef = contentMap.get("listDef");
|
||||||
|
String contentXml = contentMap.get("content");
|
||||||
|
|
||||||
// 流程步骤的指标表格
|
// 流程步骤的指标表格
|
||||||
setTableValueOfKPI("kpi", repositoryId, KPITable, relationFileMap);
|
setTableValueOfKPI("kpi", repositoryId, KPITable, relationFileMap);
|
||||||
|
|
||||||
if (search != null && search.size() > 0) {
|
if (search != null && search.size() > 0) {
|
||||||
// 复制附件
|
// 复制附件
|
||||||
int index = 1;
|
// int index = 1;
|
||||||
for (UpfileModel upfileModel : search) {
|
// for (UpfileModel upfileModel : search) {
|
||||||
if (!"f".equals(upfileModel.getType())) {// 文件
|
// if (!"f".equals(upfileModel.getType())) {// 文件
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
// 复制doccenter下的文件
|
// // 复制doccenter下的文件
|
||||||
DCContext dcContext = null;
|
// DCContext dcContext = null;
|
||||||
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
// DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
||||||
if (dcProfile != null) {
|
// if (dcProfile != null) {
|
||||||
dcContext = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, "file", upfileModel.getPl_uuid(), upfileModel.getFileName());
|
// dcContext = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, "file", upfileModel.getPl_uuid(), upfileModel.getFileName());
|
||||||
}
|
// }
|
||||||
File sourceFile = new UtilFile(dcContext.getFilePath());
|
// File sourceFile = new UtilFile(dcContext.getFilePath());
|
||||||
File targetFile = new UtilFile(file.toString() + File.separator + dcContext.getFileName());
|
// File targetFile = new UtilFile(file.toString() + File.separator + dcContext.getFileName());
|
||||||
try {
|
// try {
|
||||||
UtilFile.copyFile(sourceFile, targetFile);
|
// UtilFile.copyFile(sourceFile, targetFile);
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
System.out.println(e);
|
// System.out.println(e);
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
JSONObject object = new JSONObject();
|
// JSONObject object = new JSONObject();
|
||||||
object.put("file_name", index + "." + upfileModel.getFileName());
|
// object.put("file_name", index + "." + upfileModel.getFileName());
|
||||||
String link = fileName + File.separator + upfileModel.getFileName();
|
// String link = fileName + File.separator + upfileModel.getFileName();
|
||||||
object.put("link", link);
|
// object.put("link", link);
|
||||||
fileTable.add(object);
|
// fileTable.add(object);
|
||||||
index++;
|
// index++;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
JSONArray termTable = new JSONArray(); //术语定义Table
|
JSONArray termTable = new JSONArray(); //术语定义Table
|
||||||
// 属性特征 属性代码KEY
|
// 属性特征 属性代码KEY
|
||||||
@ -550,23 +633,6 @@ public class Report1Gener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 2张表
|
|
||||||
// 文件属性内容(文本内容)表
|
|
||||||
// 文件属性内容关联表
|
|
||||||
|
|
||||||
// 根据绩效所属模型查询绩效形状的详细信息
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 流程文件属性术语与定义(表格类型)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 流程文件属性绩效形状的信息
|
|
||||||
|
|
||||||
// 流程文件属性相关文件和支持文件
|
|
||||||
|
|
||||||
//术语
|
//术语
|
||||||
dataMap.put("term_table", termTable);//table4
|
dataMap.put("term_table", termTable);//table4
|
||||||
//如果termTable.size()==0 则显示无
|
//如果termTable.size()==0 则显示无
|
||||||
@ -585,17 +651,88 @@ public class Report1Gener {
|
|||||||
|
|
||||||
dataMap.put(OutputWordUtil.TABLE_REPOSITORY_SHAPE, repositoryShapeTable);
|
dataMap.put(OutputWordUtil.TABLE_REPOSITORY_SHAPE, repositoryShapeTable);
|
||||||
dataMap.put("file_table", fileTable);
|
dataMap.put("file_table", fileTable);
|
||||||
dataMap.put("file_table_count", fileTable.size());
|
// dataMap.put("file_table_count", fileTable.size());
|
||||||
|
dataMap.put("file_table_count", 0);// 暂时置空
|
||||||
dataMap.put(OutputWordUtil.TABLE_DANGER, dangerTable);
|
dataMap.put(OutputWordUtil.TABLE_DANGER, dangerTable);
|
||||||
dataMap.put(OutputWordUtil.TABLE_REGULATE, regulateTable);
|
dataMap.put(OutputWordUtil.TABLE_REGULATE, regulateTable);
|
||||||
dataMap.put(OutputWordUtil.TABLE_KPI, KPITable);
|
dataMap.put(OutputWordUtil.TABLE_KPI, KPITable);
|
||||||
ReportRepositoryCompare compare = new ReportRepositoryCompare();
|
ReportRepositoryCompare compare = new ReportRepositoryCompare();
|
||||||
JSONArray historyVersionModify = compare.getModifyVersionHistory(repositoryId);
|
JSONArray historyVersionModify = compare.getModifyVersionHistory(repositoryId);
|
||||||
dataMap.put("history_table", historyVersionModify);
|
dataMap.put("history_table", historyVersionModify);
|
||||||
|
|
||||||
|
// 修订记录
|
||||||
|
dataMap.put("version_history_table", getVersionHistoryTable(repositoryModel));
|
||||||
|
// 附则处理
|
||||||
|
dataMap.put("T_supplementary_articles_count", dataMap.getString("pl_T_supplementary_articles").length());
|
||||||
|
// 目的处理
|
||||||
|
dataMap.put("Purpose_count", dataMap.getString("pl_Purpose").length());
|
||||||
|
// 条款word xml内容处理
|
||||||
|
dataMap.put("control_content_count", contentXml.length());
|
||||||
|
dataMap.put("control_content", contentXml);
|
||||||
|
dataMap.put("listDef", listDef);// 列表编号
|
||||||
return dataMap;
|
return dataMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修订记录
|
||||||
|
* @param repositoryModel
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private JSONArray getVersionHistoryTable(PALRepositoryModel repositoryModel) {
|
||||||
|
JSONArray versionHistoryTable = new JSONArray();// 修订记录
|
||||||
|
List<PALRepositoryModel> list = PALRepositoryCache.getByVersionId(repositoryModel.getVersionId());
|
||||||
|
list.sort((m1, m2)-> {
|
||||||
|
return m1.getVersion() - m2.getVersion() > 0 ? 1 : -1;
|
||||||
|
});
|
||||||
|
for (PALRepositoryModel model : list) {
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
Map<String, JSONObject> map = PALRepositoryQueryAPIManager.queryRepositoryAttributeById(model.getId());
|
||||||
|
// 版本P_versions,制度用的是versions
|
||||||
|
String attr = "versions";
|
||||||
|
String val = "";
|
||||||
|
val = specialCharTransfer(map.containsKey(attr) ? (map.get(attr).getString("text")) : "").replace("\n", WRAPSTRING);
|
||||||
|
obj.put(attr, val);
|
||||||
|
// 拟制/修订单位Issuing_department
|
||||||
|
attr = "Issuing_department";
|
||||||
|
val = specialCharTransfer(map.containsKey(attr) ? (map.get(attr).getString("text")) : "").replace("\n", WRAPSTRING);
|
||||||
|
obj.put(attr, val);
|
||||||
|
// 拟制/修订人Drafted_and_revised_by
|
||||||
|
attr = "Drafted_and_revised_by";
|
||||||
|
val = specialCharTransfer(map.containsKey(attr) ? (map.get(attr).getString("text")) : "").replace("\n", WRAPSTRING);
|
||||||
|
obj.put(attr, val);
|
||||||
|
// 拟制/修订日期Drafted_and_revised_date
|
||||||
|
attr = "Drafted_and_revised_date";
|
||||||
|
val = specialCharTransfer(map.containsKey(attr) ? (map.get(attr).getString("text")) : "").replace("\n", WRAPSTRING);
|
||||||
|
if (UtilString.isNotEmpty(val)) {
|
||||||
|
try {
|
||||||
|
Timestamp timestamp = UtilDate.parseTsFromDateTime(val);
|
||||||
|
val = UtilDate.yearFormat(timestamp) + "年" + Integer.parseInt(UtilDate.monthFormat(timestamp)) + "月" + UtilDate.dayFormat(timestamp) + "日";
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
obj.put(attr, val);
|
||||||
|
// 审核人auditor
|
||||||
|
attr = "auditor";
|
||||||
|
val = specialCharTransfer(map.containsKey(attr) ? (map.get(attr).getString("text")) : "").replace("\n", WRAPSTRING);
|
||||||
|
obj.put(attr, val);
|
||||||
|
// 复核人reviewer
|
||||||
|
attr = "reviewer";
|
||||||
|
val = specialCharTransfer(map.containsKey(attr) ? (map.get(attr).getString("text")) : "").replace("\n", WRAPSTRING);
|
||||||
|
obj.put(attr, val);
|
||||||
|
// 审批人approver
|
||||||
|
attr = "approver";
|
||||||
|
val = specialCharTransfer(map.containsKey(attr) ? (map.get(attr).getString("text")) : "").replace("\n", WRAPSTRING);
|
||||||
|
obj.put(attr, val);
|
||||||
|
// 修订内容及理由Contents_and_reasons_for_revision
|
||||||
|
attr = "Contents_and_reasons_for_revision";
|
||||||
|
val = specialCharTransfer(map.containsKey(attr) ? (map.get(attr).getString("text")) : "").replace("\n", WRAPSTRING);
|
||||||
|
obj.put(attr, val);
|
||||||
|
|
||||||
|
versionHistoryTable.add(obj);
|
||||||
|
}
|
||||||
|
return versionHistoryTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -657,7 +794,7 @@ public class Report1Gener {
|
|||||||
OutputWordUtil.setShapeDefaultValue2(shape.get("uuid").toString(), _tr); //设置默认值
|
OutputWordUtil.setShapeDefaultValue2(shape.get("uuid").toString(), _tr); //设置默认值
|
||||||
String name = specialCharTransfer(shape.get("text").toString());
|
String name = specialCharTransfer(shape.get("text").toString());
|
||||||
_tr.put("related_" + OutputWordUtil.SHAPE_NAME, processShapeName);
|
_tr.put("related_" + OutputWordUtil.SHAPE_NAME, processShapeName);
|
||||||
_tr.put(OutputWordUtil.SHAPE_NAME, name.replace("\n", OutputWordUtil.WRAPSTRING));
|
_tr.put(OutputWordUtil.SHAPE_NAME, name.replace("\n", WRAPSTRING));
|
||||||
_tr.put(OutputWordUtil.SERIAL_NUMBER, index);
|
_tr.put(OutputWordUtil.SERIAL_NUMBER, index);
|
||||||
JSONArray dataAttributes = (JSONArray) shape.get("attributes");
|
JSONArray dataAttributes = (JSONArray) shape.get("attributes");
|
||||||
for (int j = 0; j < dataAttributes.size(); j++) {
|
for (int j = 0; j < dataAttributes.size(); j++) {
|
||||||
@ -717,7 +854,7 @@ public class Report1Gener {
|
|||||||
JSONObject _tr = new JSONObject();
|
JSONObject _tr = new JSONObject();
|
||||||
OutputWordUtil.setShapeDefaultValue2(shape.get("uuid").toString(), _tr); //设置默认值
|
OutputWordUtil.setShapeDefaultValue2(shape.get("uuid").toString(), _tr); //设置默认值
|
||||||
String name = specialCharTransfer(shape.get("text").toString());
|
String name = specialCharTransfer(shape.get("text").toString());
|
||||||
_tr.put(OutputWordUtil.SHAPE_NAME, name.replace("\n", OutputWordUtil.WRAPSTRING));
|
_tr.put(OutputWordUtil.SHAPE_NAME, name.replace("\n", WRAPSTRING));
|
||||||
_tr.put(OutputWordUtil.SERIAL_NUMBER, index);
|
_tr.put(OutputWordUtil.SERIAL_NUMBER, index);
|
||||||
JSONArray dataAttributes = (JSONArray) shape.get("attributes");
|
JSONArray dataAttributes = (JSONArray) shape.get("attributes");
|
||||||
for (int j = 0; j < dataAttributes.size(); j++) {
|
for (int j = 0; j < dataAttributes.size(); j++) {
|
||||||
|
|||||||
@ -125,51 +125,51 @@ public class PrReportComment {
|
|||||||
|
|
||||||
// 流程图
|
// 流程图
|
||||||
|
|
||||||
String diagram = "";
|
// String diagram = "";
|
||||||
// 流程图
|
// // 流程图
|
||||||
int newWidth = 0;
|
// int newWidth = 0;
|
||||||
int newHeight = 0;
|
// int newHeight = 0;
|
||||||
String photo = "../apps/"+ CoEConstant.APP_ID +"/img/method/default.png";
|
// String photo = "../apps/"+ CoEConstant.APP_ID +"/img/method/default.png";
|
||||||
String imageFilePath = PALRepositoryQueryAPIManager.getInstance().getProcessImgPath(repositoryModel.getId());
|
// String imageFilePath = PALRepositoryQueryAPIManager.getInstance().getProcessImgPath(repositoryModel.getId());
|
||||||
if (UtilString.isEmpty(imageFilePath)) {
|
// if (UtilString.isEmpty(imageFilePath)) {
|
||||||
imageFilePath = photo;
|
// imageFilePath = photo;
|
||||||
}
|
// }
|
||||||
UtilFile utilFile = new UtilFile(imageFilePath);
|
// UtilFile utilFile = new UtilFile(imageFilePath);
|
||||||
if (utilFile != null && utilFile.exists()) {
|
// if (utilFile != null && utilFile.exists()) {
|
||||||
byte[] base64Bytes = Base64.encode(utilFile.readBytes());
|
// byte[] base64Bytes = Base64.encode(utilFile.readBytes());
|
||||||
diagram = new String(base64Bytes);
|
// diagram = new String(base64Bytes);
|
||||||
try {
|
// try {
|
||||||
BufferedImage sourceImg = ImageIO.read(new FileInputStream(utilFile));
|
// BufferedImage sourceImg = ImageIO.read(new FileInputStream(utilFile));
|
||||||
int width = sourceImg.getWidth();
|
// int width = sourceImg.getWidth();
|
||||||
int height = sourceImg.getHeight();
|
// int height = sourceImg.getHeight();
|
||||||
// 如果宽高比大于最大值的宽高比,说明图形较宽,需判断宽度是否大于最大值
|
// // 如果宽高比大于最大值的宽高比,说明图形较宽,需判断宽度是否大于最大值
|
||||||
if (width / height > OutputWordUtil.PL_DIAGRAM_MAX_WIDTH / OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT) {
|
// if (width / height > OutputWordUtil.PL_DIAGRAM_MAX_WIDTH / OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT) {
|
||||||
if (width > OutputWordUtil.PL_DIAGRAM_MAX_WIDTH) {
|
// if (width > OutputWordUtil.PL_DIAGRAM_MAX_WIDTH) {
|
||||||
newWidth = OutputWordUtil.PL_DIAGRAM_MAX_WIDTH;
|
// newWidth = OutputWordUtil.PL_DIAGRAM_MAX_WIDTH;
|
||||||
newHeight = height * OutputWordUtil.PL_DIAGRAM_MAX_WIDTH / width;
|
// newHeight = height * OutputWordUtil.PL_DIAGRAM_MAX_WIDTH / width;
|
||||||
} else {
|
// } else {
|
||||||
newWidth = width;
|
// newWidth = width;
|
||||||
newHeight = height;
|
// newHeight = height;
|
||||||
}
|
// }
|
||||||
} else {// 如果宽高比小于最大值的宽高比,说明图形较高,需判断高度是否大于最大值
|
// } else {// 如果宽高比小于最大值的宽高比,说明图形较高,需判断高度是否大于最大值
|
||||||
if (height > OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT) {
|
// if (height > OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT) {
|
||||||
newWidth = width * OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT / height;
|
// newWidth = width * OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT / height;
|
||||||
newHeight = OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT;
|
// newHeight = OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT;
|
||||||
} else {
|
// } else {
|
||||||
newWidth = width;
|
// newWidth = width;
|
||||||
newHeight = height;
|
// newHeight = height;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} catch (FileNotFoundException e) {
|
// } catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
} catch (IOException e) {
|
// } catch (IOException e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
dataMap.put(OutputWordUtil.PL_DIAGRAM, diagram);
|
// dataMap.put(OutputWordUtil.PL_DIAGRAM, diagram);
|
||||||
dataMap.put(OutputWordUtil.PL_DIAGRAM_WIDTH, String.valueOf(newWidth));
|
// dataMap.put(OutputWordUtil.PL_DIAGRAM_WIDTH, String.valueOf(newWidth));
|
||||||
dataMap.put(OutputWordUtil.PL_DIAGRAM_HEIGHT, String.valueOf(newHeight));
|
// dataMap.put(OutputWordUtil.PL_DIAGRAM_HEIGHT, String.valueOf(newHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
com.awspaas.user.apps.coe.pal.output.zd/制度-手册2.doc
Normal file
BIN
com.awspaas.user.apps.coe.pal.output.zd/制度-手册2.doc
Normal file
Binary file not shown.
6281
com.awspaas.user.apps.coe.pal.output.zd/制度-手册2.xml
Normal file
6281
com.awspaas.user.apps.coe.pal.output.zd/制度-手册2.xml
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user