diff --git a/com.actionsoft.apps.coe.pal.output.pr/lib/com.actionsoft.apps.coe.pal.output.pr.jar b/com.actionsoft.apps.coe.pal.output.pr/lib/com.actionsoft.apps.coe.pal.output.pr.jar index 32757db2..b403c212 100644 Binary files a/com.actionsoft.apps.coe.pal.output.pr/lib/com.actionsoft.apps.coe.pal.output.pr.jar and b/com.actionsoft.apps.coe.pal.output.pr/lib/com.actionsoft.apps.coe.pal.output.pr.jar differ diff --git a/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/report1/Report1Gener.java b/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/report1/Report1Gener.java index f50c7580..30d5dc6b 100644 --- a/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/report1/Report1Gener.java +++ b/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/report1/Report1Gener.java @@ -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 diff --git a/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/util/PrReportComment.java b/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/util/PrReportComment.java index 881313ad..3cb4eb2f 100644 --- a/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/util/PrReportComment.java +++ b/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/util/PrReportComment.java @@ -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 + ""); } diff --git a/com.actionsoft.apps.coe.pal.output.pr/步骤横表-流程手册3.xml b/com.actionsoft.apps.coe.pal.output.pr/步骤横表-流程手册3.xml index 69eb7bb7..5249ae2a 100644 --- a/com.actionsoft.apps.coe.pal.output.pr/步骤横表-流程手册3.xml +++ b/com.actionsoft.apps.coe.pal.output.pr/步骤横表-流程手册3.xml @@ -4855,7 +4855,7 @@ y7fdOgAAAABJRU5ErkJggk== - <#list diagramArr as table9> + @@ -4885,15 +4885,14 @@ y7fdOgAAAABJRU5ErkJggk== - ${table9.diagram} - - + ${pl_diagram} + + -