Merge branch 'apps_dev' of https://e.coding.net/yilidev/yilipalkaifa/apps into apps_dev
This commit is contained in:
commit
b248056865
Binary file not shown.
@ -168,7 +168,7 @@ public class VersionNoExcelImportRun {
|
||||
continue;
|
||||
}
|
||||
|
||||
String verNoStr = VersionUtil.getVersionStr(verNo);
|
||||
String verNoStr = VersionUtil.getVersionStrV(verNo);
|
||||
|
||||
boolean isSuccess = true;
|
||||
// 修改编号
|
||||
|
||||
@ -6,12 +6,9 @@
|
||||
<attribute key="Process_performance_indicator_Number" title="指标编号" type="string" value="" ref="" readonly="false" groupPath="baseAttribute" scope="*" isValid="true" desc="指标编号" isRequired="true"/>
|
||||
<attribute key="Name_process_performance_indicator" title="指标名称" type="string" value="" ref="" readonly="false" groupPath="baseAttribute" scope="*" isValid="true" desc="指标名称" isRequired="true"/>
|
||||
<attribute key="ndicator_User_defined_label" title="指标自定义标签" type="string" value="" ref="" readonly="false" groupPath="baseAttribute" scope="*" isValid="true" desc="指标自定义标签" isRequired="true"/>
|
||||
<attribute key="Data_fetch_logic" title="数据取数逻辑" type="string" value="" ref="" readonly="false" groupPath="baseAttribute" scope="*" isValid="true" desc="数据取数逻辑" isRequired="false"/>
|
||||
<attribute key="Take_the_number_aperture" title="取数口径" type="string" value="" ref="" readonly="false" groupPath="baseAttribute" scope="*" isValid="true" desc="取数口径" isRequired="false"/>
|
||||
<attribute key="unit_measurement" title="计量单位" type="select" value="" ref="天,%,金额" readonly="false" groupPath="baseAttribute" scope="*" isValid="true" desc="计量单位" isRequired="true"/>
|
||||
<attribute key="statistical_period" title="统计周期" type="select" value="" ref="月度,季度,半年度,年度" readonly="false" groupPath="baseAttribute" scope="*" isValid="true" desc="统计周期" isRequired="true"/>
|
||||
<attribute key="Platform_data_Display" title="平台数据展示" type="select" value="" ref="是,否" readonly="false" groupPath="baseAttribute" scope="*" isValid="true" desc="平台数据展示" isRequired="true"/>
|
||||
<attribute key="computational_formula" title="计算公式" type="string" value="" ref="" readonly="false" groupPath="baseAttribute" scope="*" isValid="true" desc="计算公式" isRequired="false"/>
|
||||
<attribute key="The_upstream_indicators" title="上游指标" type="relation" value="" ref="{"method":"process","type":"shape","multiple":false}" readonly="true" groupPath="baseAttribute" scope="*" isValid="true" desc="上游指标" isRequired="true"/>
|
||||
<attribute key="Downstream_target" title="下游指标" type="relation" value="" ref="{"method":"process","type":"shape","multiple":false}" readonly="true" groupPath="baseAttribute" scope="*" isValid="true" desc="下游指标" isRequired="true"/>
|
||||
<attribute key="Index_definition" title="指标定义" type="textarea" value="" ref="" readonly="false" groupPath="baseAttribute" scope="*" isValid="true" desc="指标定义" isRequired="true"/>
|
||||
@ -20,11 +17,14 @@
|
||||
<attribute key="Process_Architecture_L2" title="L2" type="string" value="" desc="L2" isRequired="true" ref="" readonly="true" groupPath="baseAttribute" scope="*" isValid="true"/>
|
||||
<attribute key="Process_Architecture_L3" title="L3" type="string" value="" desc="L3" isRequired="true" ref="" readonly="true" groupPath="baseAttribute" scope="*" isValid="true"/>
|
||||
<attribute key="set_the_purpose" title="设置目的" type="string" value="" desc="设置目的" isRequired="false" ref="" readonly="false" groupPath="baseAttribute" scope="*" isValid="true"/>
|
||||
<attribute key="data_sources" title="数据来源" type="string" value="" desc="数据来源" isRequired="false" ref="" readonly="false" groupPath="baseAttribute" scope="*" isValid="true"/>
|
||||
<attribute key="explain" title="说明" type="string" value="" desc="说明" isRequired="false" ref="" readonly="false" groupPath="baseAttribute" scope="*" isValid="true"/>
|
||||
<attribute key="number" title="编号" type="string" value="" desc="编号" isRequired="true" ref="" readonly="false" groupPath="baseAttribute" scope="%,*" isValid="true"/>
|
||||
<attribute key="desc" title="描述" type="textarea" value="" desc="描述" isRequired="false" ref="" readonly="false" groupPath="baseAttribute" scope="%,*" isValid="true"/>
|
||||
<attribute key="level" title="层次" type="string" value="" desc="层次" isRequired="false" ref="" readonly="false" groupPath="baseAttribute" scope="%,*" isValid="true"/>
|
||||
<attribute key="target_value" title="指标值" type="string" value="" desc="指标值" isRequired="false" ref="" readonly="false" groupPath="baseAttribute" scope="%,*" isValid="true"/>
|
||||
<attribute key="element" title="元素" type="table" value="" desc="元素" isRequired="false" ref="{"firstColumn":"元素","secondColumn":"数据来源"}" readonly="false" groupPath="baseAttribute" scope="*" isValid="true"/>
|
||||
<attribute key="element" title="元素" type="table" value="" desc="元素" isRequired="false" ref="{"firstColumn":"元素","secondColumn":"数据来源"}" readonly="false" groupPath="baseAttribute" scope="*" isValid="true"/>
|
||||
<attribute key="Data_fetch_logic" title="数据取数逻辑" type="textarea" value="" desc="数据取数逻辑" isRequired="false" ref="" readonly="false" groupPath="baseAttribute" scope="*" isValid="true"/>
|
||||
<attribute key="Take_the_number_aperture" title="取数路径" type="textarea" value="" desc="取数路径" isRequired="false" ref="" readonly="false" groupPath="baseAttribute" scope="*" isValid="true"/>
|
||||
<attribute key="data_sources" title="数据来源" type="textarea" value="" desc="数据来源" isRequired="false" ref="" readonly="false" groupPath="baseAttribute" scope="*" isValid="true"/>
|
||||
<attribute key="computational_formula" title="计算公式" type="textarea" value="" desc="计算公式" isRequired="false" ref="" readonly="false" groupPath="baseAttribute" scope="*" isValid="true"/>
|
||||
</attributes>
|
||||
|
||||
Binary file not shown.
@ -2,6 +2,7 @@ package com.awspaas.apps.coe.pal.output.zd.report1;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@ -32,6 +33,7 @@ import com.actionsoft.bpms.server.DispatcherRequest;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.bpms.server.fs.DCContext;
|
||||
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.UtilString;
|
||||
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.ReportRepositoryCompare;
|
||||
import com.awspaas.apps.coe.pal.output.zd.util.XMLUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.Element;
|
||||
@ -58,6 +61,9 @@ public class Report1Gener {
|
||||
public static final Object _lock = new Object();
|
||||
private UserContext userContext = null;
|
||||
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() {
|
||||
}
|
||||
|
||||
@ -89,9 +95,7 @@ public class Report1Gener {
|
||||
// ----预处理、校验----
|
||||
OutputAppProfile appModel = OutputAppManager.getProfile(model.getProfileId());
|
||||
String tempPath = appModel.getAppContext().getPath();
|
||||
//String tempName = "步骤横表-流程手册.xml";
|
||||
// String tempName = "制度-手册(修改中).xml";
|
||||
String tempName = "伊利集团流程制度类文件管理规范.xml";
|
||||
String tempName = "制度-手册2.xml";
|
||||
log.info("begin...");
|
||||
log.info("-------------------");
|
||||
// ----文件处理-----
|
||||
@ -164,7 +168,7 @@ public class Report1Gener {
|
||||
docName = docPath + fileName + ".doc";
|
||||
indexMap.put(fileName, 1);
|
||||
}
|
||||
JSONObject dataMap = getData(repositoryId, wizardJsonData, docPath, fileName);
|
||||
JSONObject dataMap = getData2(repositoryId, wizardJsonData, docPath, fileName);
|
||||
if (dataMap != null) {
|
||||
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);
|
||||
if (repositoryModel == null) {
|
||||
return null;
|
||||
return result;
|
||||
}
|
||||
JSONObject dataMap = new JSONObject();
|
||||
String content = "";
|
||||
StringBuilder listStr = new StringBuilder();
|
||||
// 读取附件
|
||||
// 流程附件列表
|
||||
UpFileDao upFileDao = new UpFileDao();
|
||||
StringBuffer sqlWhere = new StringBuffer();
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(repositoryModel.getId()).append("'");
|
||||
List<UpfileModel> search = upFileDao.search(sqlWhere.toString());
|
||||
List<UpfileModel> search = upFileDao.search(repositoryModel.getId(), controlShapeId, null);
|
||||
|
||||
DCContext dc = null;
|
||||
File file = null;
|
||||
if (search != null && search.size() > 0) {
|
||||
// 复制附件
|
||||
for (UpfileModel upfileModel : search) {
|
||||
if (!"f".equals(upfileModel.getType())) {// 文件
|
||||
continue;
|
||||
}
|
||||
if (upfileModel.getFileName().contains(".xml")) {
|
||||
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -209,32 +220,93 @@ public class Report1Gener {
|
||||
if (file != null) {
|
||||
// 解析xml文件
|
||||
// 校验xml文档是否能够正常解析
|
||||
// Document doc = analysisXMLFile(file.getPath(), true);
|
||||
// if (doc == null) {
|
||||
// System.out.println("解析xml失败");
|
||||
// return null;
|
||||
Document doc = analysisXMLFile(file.getPath(), true);
|
||||
if (doc == null) {
|
||||
System.out.println("解析xml失败");
|
||||
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");
|
||||
// if (body != null) {
|
||||
// // System.out.println(body.getName());
|
||||
// // System.out.println(body.asXML());
|
||||
// //System.out.println(body.asXML());
|
||||
// List<Element> childList = body.elements();
|
||||
// if (childList != null) {
|
||||
// for (Element e : childList) {
|
||||
// content += e.asXML();
|
||||
// //System.out.println(e.getName());
|
||||
// // str += e.asXML();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
// 获取字符串
|
||||
content = getFileContent(file);
|
||||
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);
|
||||
return dataMap;
|
||||
String listStr2 = listStr.toString();
|
||||
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) {
|
||||
@ -307,6 +379,7 @@ public class Report1Gener {
|
||||
if (repositoryModel == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
prReportComment.getCommentContent(dataMap, repositoryModel); //获取一些公共的数据(手册首页的手册岗位名称、部门、时间等)
|
||||
|
||||
JSONArray repositoryShapeTable = new JSONArray(); //流程步骤Table
|
||||
@ -323,7 +396,7 @@ public class Report1Gener {
|
||||
if (wizardJsonData.getBoolean("orderNuberFirst")) { // 根据页面选择进行排序
|
||||
OutputWordUtil.orderByNumber(repositoryFileElements);
|
||||
}
|
||||
|
||||
|
||||
// 流程附件列表
|
||||
UpFileDao upFileDao = new UpFileDao();
|
||||
StringBuffer sqlWhere = new StringBuffer();
|
||||
@ -336,18 +409,23 @@ public class Report1Gener {
|
||||
}
|
||||
if (search != null && search.size() > 0) {
|
||||
//创建附件目录及复制附件
|
||||
fileName = fileName + "_file";
|
||||
file = new File(docPath, fileName);
|
||||
if (!file.exists()) {
|
||||
log.info("创建附件");
|
||||
file.mkdir();
|
||||
}
|
||||
// fileName = fileName + "_file";
|
||||
// file = new File(docPath, fileName);
|
||||
// if (!file.exists()) {
|
||||
// log.info("创建附件");
|
||||
// file.mkdir();
|
||||
// }
|
||||
}
|
||||
String controlShapeId = "";
|
||||
if (repositoryFileElements != null) {
|
||||
int index = 1;// 流程步骤序号
|
||||
int dangerIndex = 1;// 风险序号
|
||||
int regulateIndex = 1;// 控制序号
|
||||
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) {
|
||||
// continue;
|
||||
@ -356,7 +434,7 @@ public class Report1Gener {
|
||||
OutputWordUtil.setShapeDefaultValue2(repositoryId, _tr); //设置默认值
|
||||
_tr.put(OutputWordUtil.SERIAL_NUMBER, index); //序号
|
||||
_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, ""); //序号置空
|
||||
@ -377,19 +455,19 @@ public class Report1Gener {
|
||||
continue;
|
||||
}
|
||||
// 复制doccenter下的文件
|
||||
DCContext dcContext = null;
|
||||
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
||||
if (dcProfile != null) {
|
||||
dcContext = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, upfileModel.getPl_uuid(), upfileModel.getShape_uuid(), upfileModel.getFileName());
|
||||
}
|
||||
File sourceFile = new UtilFile(dcContext.getFilePath());
|
||||
File targetFile = new UtilFile(file.toString() + File.separator + dcContext.getFileName());
|
||||
try {
|
||||
UtilFile.copyFile(sourceFile, targetFile);
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
// DCContext dcContext = null;
|
||||
// DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
||||
// if (dcProfile != null) {
|
||||
// dcContext = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, upfileModel.getPl_uuid(), upfileModel.getShape_uuid(), upfileModel.getFileName());
|
||||
// }
|
||||
// File sourceFile = new UtilFile(dcContext.getFilePath());
|
||||
// File targetFile = new UtilFile(file.toString() + File.separator + dcContext.getFileName());
|
||||
// try {
|
||||
// UtilFile.copyFile(sourceFile, targetFile);
|
||||
// } catch (Exception e) {
|
||||
// System.out.println(e);
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("shape_file_name", upfileModel.getFileName());
|
||||
String link = fileName + File.separator + upfileModel.getFileName();
|
||||
@ -411,19 +489,19 @@ public class Report1Gener {
|
||||
JSONObject obj = dataAttributes.getJSONObject(i);
|
||||
String attrId = obj.getString("key");
|
||||
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 ("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)) {
|
||||
_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)) {
|
||||
_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)) {
|
||||
_tr.put("shape_notify_i", attrValue.replace("\n", OutputWordUtil.WRAPSTRING));
|
||||
_tr.put("shape_notify_i", attrValue.replace("\n", WRAPSTRING));
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
if (search != null && search.size() > 0) {
|
||||
// 复制附件
|
||||
int index = 1;
|
||||
for (UpfileModel upfileModel : search) {
|
||||
if (!"f".equals(upfileModel.getType())) {// 文件
|
||||
continue;
|
||||
}
|
||||
// 复制doccenter下的文件
|
||||
DCContext dcContext = null;
|
||||
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
||||
if (dcProfile != null) {
|
||||
dcContext = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, "file", upfileModel.getPl_uuid(), upfileModel.getFileName());
|
||||
}
|
||||
File sourceFile = new UtilFile(dcContext.getFilePath());
|
||||
File targetFile = new UtilFile(file.toString() + File.separator + dcContext.getFileName());
|
||||
try {
|
||||
UtilFile.copyFile(sourceFile, targetFile);
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("file_name", index + "." + upfileModel.getFileName());
|
||||
String link = fileName + File.separator + upfileModel.getFileName();
|
||||
object.put("link", link);
|
||||
fileTable.add(object);
|
||||
index++;
|
||||
}
|
||||
// int index = 1;
|
||||
// for (UpfileModel upfileModel : search) {
|
||||
// if (!"f".equals(upfileModel.getType())) {// 文件
|
||||
// continue;
|
||||
// }
|
||||
// // 复制doccenter下的文件
|
||||
// DCContext dcContext = null;
|
||||
// DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
||||
// if (dcProfile != null) {
|
||||
// dcContext = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, "file", upfileModel.getPl_uuid(), upfileModel.getFileName());
|
||||
// }
|
||||
// File sourceFile = new UtilFile(dcContext.getFilePath());
|
||||
// File targetFile = new UtilFile(file.toString() + File.separator + dcContext.getFileName());
|
||||
// try {
|
||||
// UtilFile.copyFile(sourceFile, targetFile);
|
||||
// } catch (Exception e) {
|
||||
// System.out.println(e);
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// JSONObject object = new JSONObject();
|
||||
// object.put("file_name", index + "." + upfileModel.getFileName());
|
||||
// String link = fileName + File.separator + upfileModel.getFileName();
|
||||
// object.put("link", link);
|
||||
// fileTable.add(object);
|
||||
// index++;
|
||||
// }
|
||||
}
|
||||
JSONArray termTable = new JSONArray(); //术语定义Table
|
||||
// 属性特征 属性代码KEY
|
||||
@ -550,23 +633,6 @@ public class Report1Gener {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 2张表
|
||||
// 文件属性内容(文本内容)表
|
||||
// 文件属性内容关联表
|
||||
|
||||
// 根据绩效所属模型查询绩效形状的详细信息
|
||||
|
||||
|
||||
|
||||
// 流程文件属性术语与定义(表格类型)
|
||||
|
||||
|
||||
|
||||
// 流程文件属性绩效形状的信息
|
||||
|
||||
// 流程文件属性相关文件和支持文件
|
||||
|
||||
//术语
|
||||
dataMap.put("term_table", termTable);//table4
|
||||
//如果termTable.size()==0 则显示无
|
||||
@ -585,17 +651,88 @@ public class Report1Gener {
|
||||
|
||||
dataMap.put(OutputWordUtil.TABLE_REPOSITORY_SHAPE, repositoryShapeTable);
|
||||
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_REGULATE, regulateTable);
|
||||
dataMap.put(OutputWordUtil.TABLE_KPI, KPITable);
|
||||
ReportRepositoryCompare compare = new ReportRepositoryCompare();
|
||||
JSONArray historyVersionModify = compare.getModifyVersionHistory(repositoryId);
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修订记录
|
||||
* @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); //设置默认值
|
||||
String name = specialCharTransfer(shape.get("text").toString());
|
||||
_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);
|
||||
JSONArray dataAttributes = (JSONArray) shape.get("attributes");
|
||||
for (int j = 0; j < dataAttributes.size(); j++) {
|
||||
@ -717,7 +854,7 @@ public class Report1Gener {
|
||||
JSONObject _tr = new JSONObject();
|
||||
OutputWordUtil.setShapeDefaultValue2(shape.get("uuid").toString(), _tr); //设置默认值
|
||||
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);
|
||||
JSONArray dataAttributes = (JSONArray) shape.get("attributes");
|
||||
for (int j = 0; j < dataAttributes.size(); j++) {
|
||||
|
||||
@ -125,51 +125,51 @@ public class PrReportComment {
|
||||
|
||||
// 流程图
|
||||
|
||||
String diagram = "";
|
||||
// 流程图
|
||||
int newWidth = 0;
|
||||
int newHeight = 0;
|
||||
String photo = "../apps/"+ CoEConstant.APP_ID +"/img/method/default.png";
|
||||
String imageFilePath = PALRepositoryQueryAPIManager.getInstance().getProcessImgPath(repositoryModel.getId());
|
||||
if (UtilString.isEmpty(imageFilePath)) {
|
||||
imageFilePath = photo;
|
||||
}
|
||||
UtilFile utilFile = new UtilFile(imageFilePath);
|
||||
if (utilFile != null && utilFile.exists()) {
|
||||
byte[] base64Bytes = Base64.encode(utilFile.readBytes());
|
||||
diagram = new String(base64Bytes);
|
||||
try {
|
||||
BufferedImage sourceImg = ImageIO.read(new FileInputStream(utilFile));
|
||||
int width = sourceImg.getWidth();
|
||||
int height = sourceImg.getHeight();
|
||||
// 如果宽高比大于最大值的宽高比,说明图形较宽,需判断宽度是否大于最大值
|
||||
if (width / height > OutputWordUtil.PL_DIAGRAM_MAX_WIDTH / OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT) {
|
||||
if (width > OutputWordUtil.PL_DIAGRAM_MAX_WIDTH) {
|
||||
newWidth = OutputWordUtil.PL_DIAGRAM_MAX_WIDTH;
|
||||
newHeight = height * OutputWordUtil.PL_DIAGRAM_MAX_WIDTH / width;
|
||||
} else {
|
||||
newWidth = width;
|
||||
newHeight = height;
|
||||
}
|
||||
} else {// 如果宽高比小于最大值的宽高比,说明图形较高,需判断高度是否大于最大值
|
||||
if (height > OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT) {
|
||||
newWidth = width * OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT / height;
|
||||
newHeight = OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT;
|
||||
} else {
|
||||
newWidth = width;
|
||||
newHeight = height;
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
dataMap.put(OutputWordUtil.PL_DIAGRAM, diagram);
|
||||
dataMap.put(OutputWordUtil.PL_DIAGRAM_WIDTH, String.valueOf(newWidth));
|
||||
dataMap.put(OutputWordUtil.PL_DIAGRAM_HEIGHT, String.valueOf(newHeight));
|
||||
// String diagram = "";
|
||||
// // 流程图
|
||||
// int newWidth = 0;
|
||||
// int newHeight = 0;
|
||||
// String photo = "../apps/"+ CoEConstant.APP_ID +"/img/method/default.png";
|
||||
// String imageFilePath = PALRepositoryQueryAPIManager.getInstance().getProcessImgPath(repositoryModel.getId());
|
||||
// if (UtilString.isEmpty(imageFilePath)) {
|
||||
// imageFilePath = photo;
|
||||
// }
|
||||
// UtilFile utilFile = new UtilFile(imageFilePath);
|
||||
// if (utilFile != null && utilFile.exists()) {
|
||||
// byte[] base64Bytes = Base64.encode(utilFile.readBytes());
|
||||
// diagram = new String(base64Bytes);
|
||||
// try {
|
||||
// BufferedImage sourceImg = ImageIO.read(new FileInputStream(utilFile));
|
||||
// int width = sourceImg.getWidth();
|
||||
// int height = sourceImg.getHeight();
|
||||
// // 如果宽高比大于最大值的宽高比,说明图形较宽,需判断宽度是否大于最大值
|
||||
// if (width / height > OutputWordUtil.PL_DIAGRAM_MAX_WIDTH / OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT) {
|
||||
// if (width > OutputWordUtil.PL_DIAGRAM_MAX_WIDTH) {
|
||||
// newWidth = OutputWordUtil.PL_DIAGRAM_MAX_WIDTH;
|
||||
// newHeight = height * OutputWordUtil.PL_DIAGRAM_MAX_WIDTH / width;
|
||||
// } else {
|
||||
// newWidth = width;
|
||||
// newHeight = height;
|
||||
// }
|
||||
// } else {// 如果宽高比小于最大值的宽高比,说明图形较高,需判断高度是否大于最大值
|
||||
// if (height > OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT) {
|
||||
// newWidth = width * OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT / height;
|
||||
// newHeight = OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT;
|
||||
// } else {
|
||||
// newWidth = width;
|
||||
// newHeight = height;
|
||||
// }
|
||||
// }
|
||||
// } catch (FileNotFoundException e) {
|
||||
// e.printStackTrace();
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// dataMap.put(OutputWordUtil.PL_DIAGRAM, diagram);
|
||||
// dataMap.put(OutputWordUtil.PL_DIAGRAM_WIDTH, String.valueOf(newWidth));
|
||||
// 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
Binary file not shown.
File diff suppressed because one or more lines are too long
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