流程手册横表由图片分页改为单页显示整个流程图片
This commit is contained in:
parent
95bfd19f42
commit
1f51ebb7ba
Binary file not shown.
@ -252,7 +252,7 @@ public class Report1Gener {
|
||||
if (repositoryModel == null) {
|
||||
return null;
|
||||
}
|
||||
prReportComment.getCommentContent(dataMap, repositoryModel);//获取一些公共的数据(手册首页的手册岗位名称、部门、时间等)
|
||||
prReportComment.getCommentContent2(dataMap, repositoryModel);//获取一些公共的数据(手册首页的手册岗位名称、部门、时间等)
|
||||
JSONArray repositoryShapeTable = new JSONArray();//流程步骤Table
|
||||
|
||||
|
||||
|
||||
@ -215,6 +215,148 @@ public class PrReportComment {
|
||||
dataMap.put("diagramArr", imageArr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报告公共数据,用于横表生成单张图片
|
||||
* com.alibaba.fastjson
|
||||
* @param dataMap
|
||||
* @param repositoryModel
|
||||
*/
|
||||
public void getCommentContent2(com.alibaba.fastjson.JSONObject dataMap, PALRepositoryModel repositoryModel) {
|
||||
dataMap.put(OutputWordUtil.REPOSITORY_NAME, OutputWordUtil.specialCharTransfer(repositoryModel.getName().replace("\n", ""))); // 流程名称
|
||||
// TODO 所属部门/公司
|
||||
dataMap.put(OutputWordUtil.DEPARTMENT, "部门"); // 所属部门
|
||||
dataMap.put(OutputWordUtil.COMPANY, "公司"); // 所属公司
|
||||
// 创建日期
|
||||
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
||||
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
dataMap.put(OutputWordUtil.GENERATEDATE, sdf.format(nowTime));
|
||||
String createUser = repositoryModel.getCreateUser() == null ? "" : OutputWordUtil.specialCharTransfer(repositoryModel.getCreateUser());
|
||||
if (UserCache.getModel(createUser) != null) {
|
||||
createUser = OutputWordUtil.specialCharTransfer(UserCache.getModel(createUser).getUserName());
|
||||
}
|
||||
dataMap.put(OutputWordUtil.PL_CREATE_USER, createUser); // 编制人
|
||||
dataMap.put(OutputWordUtil.PL_VERSION, repositoryModel.getVersion()); // 版本
|
||||
|
||||
String date = "";
|
||||
if (repositoryModel.isPublish()) { // 发布版本
|
||||
PublishListHistory history = new PublishListHistory();
|
||||
String lastPublishDate = history.getLastPublishDateByModelId(repositoryModel.getId());
|
||||
if (lastPublishDate != null && !"".equals(lastPublishDate)) {
|
||||
lastPublishDate = lastPublishDate.substring(0, 10);
|
||||
Timestamp timestamp = UtilDate.parseTsFromDate(lastPublishDate);
|
||||
StringBuilder sb = new StringBuilder("(发布日期");
|
||||
sb.append(UtilDate.yearFormat(timestamp)).append("年")
|
||||
.append(UtilDate.monthFormat(timestamp)).append("月")
|
||||
.append(UtilDate.dayFormat(timestamp)).append("日)");
|
||||
date = sb.toString();
|
||||
}
|
||||
} else { // 未发布版本
|
||||
Timestamp createDate = repositoryModel.getCreateDate();
|
||||
if (createDate != null) {
|
||||
StringBuilder sb = new StringBuilder("(创建日期");
|
||||
sb.append(UtilDate.yearFormat(repositoryModel.getCreateDate())).append("年")
|
||||
.append(UtilDate.monthFormat(repositoryModel.getCreateDate())).append("月")
|
||||
.append(UtilDate.dayFormat(repositoryModel.getCreateDate())).append("日)");
|
||||
date = sb.toString();
|
||||
}
|
||||
}
|
||||
dataMap.put(OutputWordUtil.PL_VERSION, "V" + repositoryModel.getVersion()+ ".0 " + date); // 版本
|
||||
|
||||
OutputWordUtil.setRepositoryDefaultValue2(TARGET_METHOD_SCOPE, dataMap);// 设置属性默认值(空字符串)
|
||||
//System.out.println("表单数据内容获取==================");
|
||||
JSONArray propertyArr = CoeProcessLevelUtil.getProcessLevelPropertyArr(repositoryModel.getId());
|
||||
for (int i = 0; i < propertyArr.size(); i++) {
|
||||
JSONObject propertyObj = propertyArr.getJSONObject(i);
|
||||
if (propertyObj.getString("key").equals("goal")) {
|
||||
if (propertyObj.getString("value").equals("")) {
|
||||
dataMap.put("pl_" + propertyObj.getString("key"), "无");
|
||||
}else{
|
||||
dataMap.put("pl_" + propertyObj.getString("key"), OutputWordUtil.specialCharTransfer(propertyObj.getString("value")));
|
||||
}
|
||||
}
|
||||
if(propertyObj.getString("key").equals("T_supplementary_articles")) {
|
||||
if (propertyObj.getString("value").equals("")) {
|
||||
dataMap.put("pl_" + propertyObj.getString("key"), "无");
|
||||
}else{
|
||||
dataMap.put("pl_" + propertyObj.getString("key"), OutputWordUtil.specialCharTransfer(propertyObj.getString("value")));
|
||||
}
|
||||
}else{
|
||||
dataMap.put("pl_" + propertyObj.getString("key"), OutputWordUtil.specialCharTransfer(propertyObj.getString("value")));
|
||||
}
|
||||
|
||||
}
|
||||
// 责任人、责任部门单独处理,兼容流程手册中直接使用pl_key进行定义
|
||||
boolean dutyRelationType = SDK.getAppAPI().getPropertyBooleanValue("com.actionsoft.apps.coe.pal.output.pr", "DUTY_DEPARTMENT_PERSON_RELATION_TYPE", false);
|
||||
String relationPersion = "";
|
||||
String relationDept = "";
|
||||
if (dutyRelationType) {// 关联bpm组织架构部门和人员
|
||||
if (dataMap.containsKey("pl_" + "bpm_department")) {
|
||||
relationDept = dataMap.get("pl_" + "bpm_department").toString();
|
||||
}
|
||||
if (dataMap.containsKey("pl_" + "bpm_person")) {
|
||||
relationPersion = dataMap.get("pl_" + "bpm_person").toString();
|
||||
}
|
||||
} else {// 关联pal组织
|
||||
if (dataMap.containsKey("pl_" + "department")) {
|
||||
relationDept = dataMap.get("pl_" + "department").toString();
|
||||
}
|
||||
if (dataMap.containsKey("pl_" + "bpm_person")) {
|
||||
relationPersion = dataMap.get("pl_" + "person").toString();
|
||||
}
|
||||
}
|
||||
dataMap.put(OutputWordUtil.PL_RESPONSIBLE_PERSON, relationPersion); // 责任人
|
||||
dataMap.put(OutputWordUtil.PL_RESPONSIBLE_DEPARTMENT, relationDept); // 责任部门
|
||||
|
||||
// 流程图
|
||||
|
||||
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;
|
||||
}
|
||||
int maxHeight = OutputWordUtil.PL_DIAGRAM_MAX_HEIGHT - 30;
|
||||
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 / maxHeight) {
|
||||
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 > maxHeight) {
|
||||
newWidth = width * maxHeight / height;
|
||||
newHeight = maxHeight;
|
||||
} 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));
|
||||
}
|
||||
|
||||
private String getNoStr(int no) {
|
||||
return no <= 0 ? (no + "") : no < 10 ? ("0" + no) : (no + "");
|
||||
}
|
||||
|
||||
@ -4855,7 +4855,7 @@ y7fdOgAAAABJRU5ErkJggk==
|
||||
</w:r>
|
||||
<aml:annotation aml:id="3" w:type="Word.Bookmark.End"/>
|
||||
</w:p>
|
||||
<#list diagramArr as table9>
|
||||
|
||||
<w:p wsp:rsidR="00AC2941" wsp:rsidRDefault="00453AE4">
|
||||
<w:pPr>
|
||||
<w:spacing w:line="240" w:line-rule="at-least"/>
|
||||
@ -4885,15 +4885,14 @@ y7fdOgAAAABJRU5ErkJggk==
|
||||
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
|
||||
<o:lock v:ext="edit" aspectratio="t"/>
|
||||
</v:shapetype>
|
||||
<w:binData w:name="wordml://${table9.id}.emz" xml:space="preserve">${table9.diagram}</w:binData>
|
||||
<v:shape id="${table9.id}" o:spid="_x0000_i1026" type="#_x0000_t75" alt="" style="width:${table9.width}pt;height:${table9.height}pt;mso-width-percent:0;mso-height-percent:0;mso-position-horizontal-relative:page;mso-position-vertical-relative:page;mso-width-percent:0;mso-height-percent:0">
|
||||
<v:imagedata src="wordml://${table9.id}.emz" o:title=""/>
|
||||
<w:binData w:name="wordml://234723323.emz" xml:space="preserve">${pl_diagram}</w:binData>
|
||||
<v:shape id="234723323" o:spid="_x0000_i1026" type="#_x0000_t75" alt="" style="width:${pl_diagram_width}pt;height:${pl_diagram_height}pt;mso-width-percent:0;mso-height-percent:0;mso-position-horizontal-relative:page;mso-position-vertical-relative:page;mso-width-percent:0;mso-height-percent:0">
|
||||
<v:imagedata src="wordml://234723323.emz" o:title=""/>
|
||||
<o:lock v:ext="edit" aspectratio="f"/>
|
||||
</v:shape>
|
||||
</w:pict>
|
||||
</w:r>
|
||||
</w:p>
|
||||
</#list>
|
||||
<w:p wsp:rsidR="00AC2941" wsp:rsidRDefault="00AC2941">
|
||||
<w:pPr>
|
||||
<w:sectPr wsp:rsidR="00AC2941">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user