手册提交
This commit is contained in:
		
							parent
							
								
									e09bbaa61b
								
							
						
					
					
						commit
						f94cdd8bb1
					
				
										
											Binary file not shown.
										
									
								
							| @ -2606,6 +2606,20 @@ public class CoEPALController { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * 流程手册预览 | ||||||
|  |      * | ||||||
|  |      * @param me | ||||||
|  |      * @param taskId | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     // @Mapping("COE_PAL_OUTPUTREPORT_OUTPUT_PROCESS_PREVIEW") | ||||||
|  |     @Mapping("com.actionsoft.apps.coe.pal_outputreport_output_process_ppt_preview") | ||||||
|  |     public String COEPALOUTPUTREPORTOutputProcessPPTPreview(UserContext me, String taskId) { | ||||||
|  |         return PALRepositoryQueryAPIManager.getInstance().outputReportPPTPreview(me, taskId); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * 流程阅览 流程手册下载 |      * 流程阅览 流程手册下载 | ||||||
|      * |      * | ||||||
| @ -3698,4 +3712,50 @@ public class CoEPALController { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * 判断表单模型是否存在excel文件 | ||||||
|  |      * | ||||||
|  |      * @param me | ||||||
|  |      * @param uuids | ||||||
|  |      * @param teamId | ||||||
|  |      * @param wsId | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     @Mapping("com.actionsoft.apps.coe.pal.publisher_output_pr_estimateFile") | ||||||
|  |     public String createOutputPrReportsByEstimateFile(UserContext me, String fileId) { | ||||||
|  |         DesignerRelationShapeWeb web = new DesignerRelationShapeWeb(me); | ||||||
|  |         return web.createOutputPrReportsByEstimateFile(fileId); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 判断制度模型是否存在ppt文件 | ||||||
|  |      * | ||||||
|  |      * @param me | ||||||
|  |      * @param uuids | ||||||
|  |      * @param teamId | ||||||
|  |      * @param wsId | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     @Mapping("com.actionsoft.apps.coe.pal.publisher_output_pr_estimatePPTFile") | ||||||
|  |     public String createOutputPrReportsByEstimatePPTFile(UserContext me, String fileId) { | ||||||
|  |         DesignerRelationShapeWeb web = new DesignerRelationShapeWeb(me); | ||||||
|  |         return web.createOutputPrReportsByEstimatePPTFile(me, fileId); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 判断附件 | ||||||
|  |      * | ||||||
|  |      * @param me | ||||||
|  |      * @param uuids | ||||||
|  |      * @param teamId | ||||||
|  |      * @param wsId | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     @Mapping("com.actionsoft.apps.coe.pal.publisher_output_pr_downloadExcelFile") | ||||||
|  |     public String createOutputPrReportsByDownloadExcelFile(UserContext me, String taskIds) { | ||||||
|  |         DesignerRelationShapeWeb web = new DesignerRelationShapeWeb(me); | ||||||
|  |         return web.createOutputPrReportsByDownloadExcelFile(taskIds); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -15,6 +15,7 @@ import com.actionsoft.apps.coe.pal.pal.repository.upfile.constant.CoeFileConstan | |||||||
| import com.actionsoft.apps.coe.pal.pal.repository.upfile.dao.UpFileDao; | 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.coe.pal.pal.repository.upfile.model.UpfileModel; | ||||||
| import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile; | import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile; | ||||||
|  | import com.actionsoft.bpms.commons.mvc.view.ResponseObject; | ||||||
| import com.actionsoft.bpms.org.model.DepartmentModel; | import com.actionsoft.bpms.org.model.DepartmentModel; | ||||||
| import com.actionsoft.bpms.org.model.RoleModel; | import com.actionsoft.bpms.org.model.RoleModel; | ||||||
| import com.actionsoft.bpms.org.model.UserModel; | import com.actionsoft.bpms.org.model.UserModel; | ||||||
| @ -25,6 +26,7 @@ import com.actionsoft.bpms.server.fs.dc.DCProfileManager; | |||||||
| 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; | ||||||
|  | import com.actionsoft.sdk.local.api.AppAPI; | ||||||
| import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||||
| import com.sini.com.spire.doc.*; | import com.sini.com.spire.doc.*; | ||||||
| @ -232,30 +234,8 @@ public class OutputWordUtil { | |||||||
|         } catch (IOException e) { |         } catch (IOException e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(); | ||||||
|         } |         } | ||||||
|         // 输出文档路径及名称 |  | ||||||
|         File outFile = new File(docName); |  | ||||||
|         Writer out = null; |  | ||||||
|         try { |  | ||||||
|             out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "UTF-8")); |  | ||||||
|         } catch (Exception e1) { |  | ||||||
|             e1.printStackTrace(); |  | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
| 
 | //***********************************************************使用spire  生成模板后复制文件****************************************************/ | ||||||
|         try { |  | ||||||
|             if (t != null && out != null) { |  | ||||||
|                 t.process(dataMap, out); |  | ||||||
|                 out.flush(); |  | ||||||
|                 out.close(); |  | ||||||
|             } |  | ||||||
|         } catch (TemplateException e) { |  | ||||||
|             e.printStackTrace(); |  | ||||||
|         } catch (IOException e) { |  | ||||||
|             e.printStackTrace(); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|         //***********************************************************使用spire  生成模板后复制文件****************************************************/ |  | ||||||
|         List<Map<String, Object>> repositoryFileElements = CoeDesignerUtil.getShapeMessageJson4(repositoryId); //流程文件内容 |         List<Map<String, Object>> repositoryFileElements = CoeDesignerUtil.getShapeMessageJson4(repositoryId); //流程文件内容 | ||||||
|         if (wizardJsonData.getBoolean("orderNuberFirst")) { // 根据页面选择进行排序 |         if (wizardJsonData.getBoolean("orderNuberFirst")) { // 根据页面选择进行排序 | ||||||
|             OutputWordUtil.orderByNumber(repositoryFileElements); |             OutputWordUtil.orderByNumber(repositoryFileElements); | ||||||
| @ -299,6 +279,78 @@ public class OutputWordUtil { | |||||||
|         DCContext dcContextpdf = null; |         DCContext dcContextpdf = null; | ||||||
|         File file = null; |         File file = null; | ||||||
| 
 | 
 | ||||||
|  |         boolean isPPT = false; | ||||||
|  |         //如果为PPT,则生成PPT手册 | ||||||
|  |         if (search != null && search.size() > 0) { | ||||||
|  |             long b1 = System.currentTimeMillis(); | ||||||
|  |             // 复制附件 | ||||||
|  |             for (UpfileModel upfileModel : search) { | ||||||
|  |                 DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE); | ||||||
|  | 
 | ||||||
|  |                 if (dcProfile != null) { | ||||||
|  |                     dcContextpdf = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, upfileModel.getPl_uuid(), upfileModel.getShape_uuid(), upfileModel.getFileName()); | ||||||
|  |                     String path = dcContextpdf.getPath(); | ||||||
|  |                     String fileName = dcContextpdf.getFileName(); | ||||||
|  | 
 | ||||||
|  |                     String suffix = fileName.substring(fileName.lastIndexOf(".") + 1); | ||||||
|  |                     if (suffix.equals("pptx")) { | ||||||
|  |                         isPPT = true; | ||||||
|  |                         String pptUrl = docName.substring(0, docName.lastIndexOf("/") + 1); | ||||||
|  |                         // 调用App | ||||||
|  |                         String sourceAppId = "com.actionsoft.apps.coe.pal"; | ||||||
|  |                         // aslp服务地址 | ||||||
|  |                         String aslp = "aslp://com.awspaas.user.apps.new_performance_indicator_library/UpdatePptxAndExcelAslp"; | ||||||
|  |                         // 参数定义列表 | ||||||
|  |                         Map params = new HashMap<String, Object>(); | ||||||
|  |                         //文件id,必填 | ||||||
|  |                         params.put("pl_uuid", repositoryId); | ||||||
|  |                         //文件内容id,必填 | ||||||
|  |                         params.put("shape_uuid", search.get(0).getShape_uuid()); | ||||||
|  | 
 | ||||||
|  |                         //文件保存地址,必填 | ||||||
|  |                         params.put("fil_path", pptUrl + search.get(0).getFileName()); | ||||||
|  | 
 | ||||||
|  |                         //文件路径(不包含文件名称),必填 | ||||||
|  |                         params.put("file_url", pptUrl); | ||||||
|  | 
 | ||||||
|  |                         //文件名称,必填 | ||||||
|  |                         params.put("file_data", search.get(0).getFileName()); | ||||||
|  |                         //sid,必填 | ||||||
|  |                         params.put("sid", userContext.getSessionId()); | ||||||
|  |                         AppAPI appAPI = SDK.getAppAPI(); | ||||||
|  |                         //根据上传的文件进行更新相关的excel或者ppt | ||||||
|  |                         ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); | ||||||
|  | 
 | ||||||
|  |                     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (isPPT == false) { | ||||||
|  |             // 输出文档路径及名称 | ||||||
|  |             File outFile = new File(docName); | ||||||
|  |             Writer out = null; | ||||||
|  |             try { | ||||||
|  |                 out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "UTF-8")); | ||||||
|  |             } catch (Exception e1) { | ||||||
|  |                 e1.printStackTrace(); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |             try { | ||||||
|  |                 if (t != null && out != null) { | ||||||
|  |                     t.process(dataMap, out); | ||||||
|  |                     out.flush(); | ||||||
|  |                     out.close(); | ||||||
|  |                 } | ||||||
|  |             } catch (TemplateException e) { | ||||||
|  |                 e.printStackTrace(); | ||||||
|  |             } catch (IOException e) { | ||||||
|  |                 e.printStackTrace(); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
|             if (search != null && search.size() > 0) { |             if (search != null && search.size() > 0) { | ||||||
|                 long b1 = System.currentTimeMillis(); |                 long b1 = System.currentTimeMillis(); | ||||||
| @ -353,9 +405,14 @@ public class OutputWordUtil { | |||||||
|                             String substring = fileName.substring(0, fileName.lastIndexOf(".xml")); |                             String substring = fileName.substring(0, fileName.lastIndexOf(".xml")); | ||||||
|                             //保存为Word |                             //保存为Word | ||||||
|                             document.insertTextFromFile(docPath + substring + ".docx", FileFormat.Docx_2013); |                             document.insertTextFromFile(docPath + substring + ".docx", FileFormat.Docx_2013); | ||||||
|                     } else { |                         } else if (suffix.equals("doc") || suffix.equals("docx")) { | ||||||
|                             document.insertTextFromFile(path + fileName, FileFormat.Docx_2013); |                             document.insertTextFromFile(path + fileName, FileFormat.Docx_2013); | ||||||
|  |                         } else if (suffix.equals("pptx")) { | ||||||
|  |                             isPPT = true; | ||||||
|                         } |                         } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |                         if (isPPT == false) { | ||||||
|                             // document.insertTextFromFile("/Users/sunlh/Downloads/手册格式问题测试文档(3)new.docx", FileFormat.Docx_2013); |                             // document.insertTextFromFile("/Users/sunlh/Downloads/手册格式问题测试文档(3)new.docx", FileFormat.Docx_2013); | ||||||
|                             try { |                             try { | ||||||
|                                 //保存结果文档 |                                 //保存结果文档 | ||||||
| @ -450,6 +507,8 @@ public class OutputWordUtil { | |||||||
|                                 } |                                 } | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|  | 
 | ||||||
|  |                     } | ||||||
|                 } |                 } | ||||||
|                 long b2 = System.currentTimeMillis(); |                 long b2 = System.currentTimeMillis(); | ||||||
| 
 | 
 | ||||||
| @ -459,6 +518,8 @@ public class OutputWordUtil { | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|             /****************************插入支持文件、相关文件、附则等信息********************************************************/ |             /****************************插入支持文件、相关文件、附则等信息********************************************************/ | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|             Document doc = new Document(outFile.getPath()); |             Document doc = new Document(outFile.getPath()); | ||||||
|             //获取最后一节 |             //获取最后一节 | ||||||
|             Section section = doc.getLastSection(); |             Section section = doc.getLastSection(); | ||||||
| @ -466,7 +527,6 @@ public class OutputWordUtil { | |||||||
|             //添加段落,设置一级序列 |             //添加段落,设置一级序列 | ||||||
|             Paragraph paragraph = section.addParagraph(); |             Paragraph paragraph = section.addParagraph(); | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|             //paragraph.appendBreak(BreakType.Page_Break); |             //paragraph.appendBreak(BreakType.Page_Break); | ||||||
|             //Section section2 = doc.addSection(); |             //Section section2 = doc.addSection(); | ||||||
| 
 | 
 | ||||||
| @ -536,6 +596,9 @@ public class OutputWordUtil { | |||||||
|                 row.setHeightType(TableRowHeightType.Exactly); |                 row.setHeightType(TableRowHeightType.Exactly); | ||||||
|                 for (int i = 0; i < header.length; i++) { |                 for (int i = 0; i < header.length; i++) { | ||||||
|                     row.getCells().get(i).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle); |                     row.getCells().get(i).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle); | ||||||
|  |                     //设置固定列宽 | ||||||
|  |                     row.getCells().get(0).setWidth(150); | ||||||
|  |                     row.getCells().get(1).setWidth(500); | ||||||
|                     Paragraph p = row.getCells().get(i).addParagraph(); |                     Paragraph p = row.getCells().get(i).addParagraph(); | ||||||
|                     p.getFormat().setHorizontalAlignment(HorizontalAlignment.Center); |                     p.getFormat().setHorizontalAlignment(HorizontalAlignment.Center); | ||||||
|                     TextRange txtRange = p.appendText(header[i]); |                     TextRange txtRange = p.appendText(header[i]); | ||||||
| @ -546,10 +609,13 @@ public class OutputWordUtil { | |||||||
|                 for (int r = 0; r < data.length; r++) { |                 for (int r = 0; r < data.length; r++) { | ||||||
|                     TableRow dataRow = table.getRows().get(r + 1); |                     TableRow dataRow = table.getRows().get(r + 1); | ||||||
|                     dataRow.setHeight(25); |                     dataRow.setHeight(25); | ||||||
|                 dataRow.setHeightType(TableRowHeightType.Exactly); |                     dataRow.setHeightType(TableRowHeightType.Auto); | ||||||
|                     dataRow.getRowFormat().setBackColor(Color.white); |                     dataRow.getRowFormat().setBackColor(Color.white); | ||||||
|                     for (int c = 0; c < data[r].length; c++) { |                     for (int c = 0; c < data[r].length; c++) { | ||||||
|                         dataRow.getCells().get(c).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle); |                         dataRow.getCells().get(c).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle); | ||||||
|  |                         //设置固定列宽 | ||||||
|  |                         dataRow.getCells().get(0).setWidth(150); | ||||||
|  |                         dataRow.getCells().get(1).setWidth(500); | ||||||
|                         dataRow.getCells().get(c).addParagraph().appendText(data[r][c]); |                         dataRow.getCells().get(c).addParagraph().appendText(data[r][c]); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
| @ -616,6 +682,9 @@ public class OutputWordUtil { | |||||||
|                 row.setHeightType(TableRowHeightType.Exactly); |                 row.setHeightType(TableRowHeightType.Exactly); | ||||||
|                 for (int i = 0; i < header.length; i++) { |                 for (int i = 0; i < header.length; i++) { | ||||||
|                     row.getCells().get(i).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle); |                     row.getCells().get(i).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle); | ||||||
|  |                     //设置固定列宽 | ||||||
|  |                     row.getCells().get(0).setWidth(150); | ||||||
|  |                     row.getCells().get(1).setWidth(500); | ||||||
|                     Paragraph p = row.getCells().get(i).addParagraph(); |                     Paragraph p = row.getCells().get(i).addParagraph(); | ||||||
|                     p.getFormat().setHorizontalAlignment(HorizontalAlignment.Center); |                     p.getFormat().setHorizontalAlignment(HorizontalAlignment.Center); | ||||||
|                     TextRange txtRange = p.appendText(header[i]); |                     TextRange txtRange = p.appendText(header[i]); | ||||||
| @ -626,43 +695,19 @@ public class OutputWordUtil { | |||||||
|                 for (int r = 0; r < data.length; r++) { |                 for (int r = 0; r < data.length; r++) { | ||||||
|                     TableRow dataRow = table.getRows().get(r + 1); |                     TableRow dataRow = table.getRows().get(r + 1); | ||||||
|                     dataRow.setHeight(25); |                     dataRow.setHeight(25); | ||||||
|                 dataRow.setHeightType(TableRowHeightType.Exactly); |                     dataRow.setHeightType(TableRowHeightType.Auto); | ||||||
|                     dataRow.getRowFormat().setBackColor(Color.white); |                     dataRow.getRowFormat().setBackColor(Color.white); | ||||||
|                     for (int c = 0; c < data[r].length; c++) { |                     for (int c = 0; c < data[r].length; c++) { | ||||||
|                         dataRow.getCells().get(c).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle); |                         dataRow.getCells().get(c).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle); | ||||||
|  |                         //设置固定列宽 | ||||||
|  |                         dataRow.getCells().get(0).setWidth(150); | ||||||
|  |                         dataRow.getCells().get(1).setWidth(500); | ||||||
|                         dataRow.getCells().get(c).addParagraph().appendText(data[r][c]); |                         dataRow.getCells().get(c).addParagraph().appendText(data[r][c]); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
| 		/*CharacterFormat format3=new CharacterFormat(); |  | ||||||
| 		//创建字体格式 |  | ||||||
| 		format3.setFontName("宋体"); |  | ||||||
| 		//添加段落,设置一级序列 |  | ||||||
| 		Paragraph paragraph3 = section.addParagraph(); |  | ||||||
| 		TextRange tr3 = paragraph3.appendText("7.附则"); |  | ||||||
| 		tr3.getCharacterFormat().setBold(true); |  | ||||||
| 		tr3.getCharacterFormat().setFontName("宋体"); |  | ||||||
| 		paragraph3.applyStyle(BuiltinStyle.Heading_7); //应用标题1样式 |  | ||||||
| 
 |  | ||||||
|          //添加段落 |  | ||||||
| 		Paragraph paragraph5 = section.addParagraph(); |  | ||||||
| 
 |  | ||||||
| 		// 附则处理 |  | ||||||
| 		List<String> T_supplementary_articles_table = new ArrayList<>(); |  | ||||||
| 		String [] tmp = dataMap.getString("pl_T_supplementary_articles").split("\n"); |  | ||||||
| 		for (int i = 0; i < tmp.length; i++) { |  | ||||||
| 			if (UtilString.isNotEmpty(tmp[i])) { |  | ||||||
| 				T_supplementary_articles_table.add(tmp[i]); |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		TextRange tr5 = paragraph5.appendText(T_supplementary_articles_table.toString()); |  | ||||||
| 		tr5.getCharacterFormat().setFontName("宋体");*/ |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|             //查询模型文件属性上传附件信息 |             //查询模型文件属性上传附件信息 | ||||||
|             List<UpfileModel> search2 = upFileDao.searchByRepositoryId(repositoryModel.getId(), "f"); |             List<UpfileModel> search2 = upFileDao.searchByRepositoryId(repositoryModel.getId(), "f"); | ||||||
| 
 | 
 | ||||||
| @ -774,6 +819,14 @@ public class OutputWordUtil { | |||||||
|                             } else if (suffix.equals(".mp4")) { |                             } else if (suffix.equals(".mp4")) { | ||||||
|                                 paragraph5.appendOleObject(stream1, pic1, "mp4"); |                                 paragraph5.appendOleObject(stream1, pic1, "mp4"); | ||||||
|                             } |                             } | ||||||
|  |                         } else if (suffix.equals(".ppt") || suffix.equals(".pptx")) { | ||||||
|  |                             pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/ppt.png"); | ||||||
|  |                             paragraph5.appendText(dcContextModel.getFileName()); | ||||||
|  |                             if (suffix.equals(".ppt")) { | ||||||
|  |                                 paragraph5.appendOleObject(stream1, pic1, "ppt"); | ||||||
|  |                             } else if (suffix.equals(".pptx")) { | ||||||
|  |                                 paragraph5.appendOleObject(stream1, pic1, "pptx"); | ||||||
|  |                             } | ||||||
|                         } else if (suffix.equals(".txt")) { |                         } else if (suffix.equals(".txt")) { | ||||||
|                             pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/txt.png"); |                             pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/txt.png"); | ||||||
|                             paragraph5.appendText(dcContextModel.getFileName()); |                             paragraph5.appendText(dcContextModel.getFileName()); | ||||||
| @ -797,6 +850,10 @@ public class OutputWordUtil { | |||||||
|                 // 关闭文档对象 |                 // 关闭文档对象 | ||||||
|                 doc.close(); |                 doc.close(); | ||||||
|             } |             } | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -825,6 +882,59 @@ public class OutputWordUtil { | |||||||
|         } catch (IOException e) { |         } catch (IOException e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(); | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|  |         //判断表单图是否为单一模型并且只上传excel一种附件,导出手册直接导出excel手册 | ||||||
|  |         PALRepositoryModel repositoryModel = PALRepositoryQueryAPIManager.getInstance().queryPalRepositoryModelByPalId(repositoryId); | ||||||
|  | 
 | ||||||
|  |         UpFileDao upFileDao = new UpFileDao(); | ||||||
|  |         //查询模型文件属性上传附件信息 | ||||||
|  |         List<UpfileModel> search = upFileDao.searchByRepositoryId(repositoryModel.getId(), "s"); | ||||||
|  | 
 | ||||||
|  |         if (search.size() > 0) { | ||||||
|  |             if (search.size() == 1) { | ||||||
|  |                 DCContext dcContextModel = null; | ||||||
|  |                 //获取 | ||||||
|  |                 String getExcelFileName = search.get(0).getFileName(); | ||||||
|  | 
 | ||||||
|  |                 //获取文件的后缀名 | ||||||
|  |                 int lastIndexOf = getExcelFileName.lastIndexOf("."); | ||||||
|  |                 String suffix = getExcelFileName.substring(lastIndexOf); | ||||||
|  |                 if (suffix.equals(".xls") || suffix.equals(".xlsx")) { | ||||||
|  | 
 | ||||||
|  |                     DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE); | ||||||
|  | 
 | ||||||
|  |                     UserContext userContext = DispatcherRequest.getUserContext(); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |                     String excelUrl = docName.substring(0, docName.lastIndexOf("/") + 1); | ||||||
|  | 
 | ||||||
|  |                     // 调用App | ||||||
|  |                     String sourceAppId = "com.actionsoft.apps.coe.pal"; | ||||||
|  |                     // aslp服务地址 | ||||||
|  |                     String aslp = "aslp://com.awspaas.user.apps.new_performance_indicator_library/UpdatePptxAndExcelAslp"; | ||||||
|  |                     // 参数定义列表 | ||||||
|  |                     Map params = new HashMap<String, Object>(); | ||||||
|  |                     //文件id,必填 | ||||||
|  |                     params.put("pl_uuid", repositoryId); | ||||||
|  |                     //文件内容id,必填 | ||||||
|  |                     params.put("shape_uuid", search.get(0).getShape_uuid()); | ||||||
|  | 
 | ||||||
|  |                     //文件保存地址,必填 | ||||||
|  |                     params.put("fil_path", excelUrl + search.get(0).getFileName()); | ||||||
|  | 
 | ||||||
|  |                     //文件路径(不包含文件名称),必填 | ||||||
|  |                     params.put("file_url", excelUrl); | ||||||
|  | 
 | ||||||
|  |                     //文件名称,必填 | ||||||
|  |                     params.put("file_data", search.get(0).getFileName()); | ||||||
|  |                     //sid,必填 | ||||||
|  |                     params.put("sid", userContext.getSessionId()); | ||||||
|  |                     AppAPI appAPI = SDK.getAppAPI(); | ||||||
|  |                     //根据上传的文件进行更新相关的excel或者ppt | ||||||
|  |                     ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |                 } else { | ||||||
|                     // 输出文档路径及名称 |                     // 输出文档路径及名称 | ||||||
|                     File outFile = new File(docName); |                     File outFile = new File(docName); | ||||||
|                     Writer out = null; |                     Writer out = null; | ||||||
| @ -845,9 +955,42 @@ public class OutputWordUtil { | |||||||
|                     } catch (IOException e) { |                     } catch (IOException e) { | ||||||
|                         e.printStackTrace(); |                         e.printStackTrace(); | ||||||
|                     } |                     } | ||||||
|  |                     ConcatenationformBySpire(outFile.getPath(), search); | ||||||
|  |                 } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  |             } else { | ||||||
|  |                 // 输出文档路径及名称 | ||||||
|  |                 File outFile = new File(docName); | ||||||
|  |                 Writer out = null; | ||||||
|  |                 try { | ||||||
|  |                     out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "UTF-8")); | ||||||
|  |                 } catch (Exception e1) { | ||||||
|  |                     e1.printStackTrace(); | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 try { | ||||||
|  |                     if (t != null && out != null) { | ||||||
|  |                         t.process(dataMap, out); | ||||||
|  |                         out.flush(); | ||||||
|  |                         out.close(); | ||||||
|  |                     } | ||||||
|  |                 } catch (TemplateException e) { | ||||||
|  |                     e.printStackTrace(); | ||||||
|  |                 } catch (IOException e) { | ||||||
|  |                     e.printStackTrace(); | ||||||
|  |                 } | ||||||
|  |                 ConcatenationformBySpire(outFile.getPath(), search); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public static void ConcatenationformBySpire(String filePath, List<UpfileModel> search) throws FileNotFoundException { | ||||||
|         /**************************************************插入文件对象**********************************************************************/ |         /**************************************************插入文件对象**********************************************************************/ | ||||||
|         Document doc = new Document(outFile.getPath()); |         Document doc = new Document(filePath); | ||||||
|         //获取最后一节 |         //获取最后一节 | ||||||
|         Section section = doc.getLastSection(); |         Section section = doc.getLastSection(); | ||||||
| 
 | 
 | ||||||
| @ -871,13 +1014,6 @@ public class OutputWordUtil { | |||||||
|         //doc.saveToFile(outFile.getPath(), FileFormat.Docx_2013); |         //doc.saveToFile(outFile.getPath(), FileFormat.Docx_2013); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         PALRepositoryModel repositoryModel = PALRepositoryQueryAPIManager.getInstance().queryPalRepositoryModelByPalId(repositoryId); |  | ||||||
| 
 |  | ||||||
|         UpFileDao upFileDao = new UpFileDao(); |  | ||||||
|         //查询模型文件属性上传附件信息 |  | ||||||
|         List<UpfileModel> search = upFileDao.searchByRepositoryId(repositoryModel.getId(), "s"); |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|         DCContext dcContextModel = null; |         DCContext dcContextModel = null; | ||||||
|         UserContext userContext = DispatcherRequest.getUserContext(); |         UserContext userContext = DispatcherRequest.getUserContext(); | ||||||
|         if (search != null && search.size() > 0) { |         if (search != null && search.size() > 0) { | ||||||
| @ -961,10 +1097,9 @@ public class OutputWordUtil { | |||||||
| 
 | 
 | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         doc.saveToFile(outFile.getPath(), FileFormat.Docx_2013); |         doc.saveToFile(filePath, FileFormat.Docx_2013); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     /** |     /** | ||||||
|      * 将文件的扩展属性设置默认值为空字符串(防止没有设置扩展属性而使得导出文件出错) |      * 将文件的扩展属性设置默认值为空字符串(防止没有设置扩展属性而使得导出文件出错) | ||||||
|      * |      * | ||||||
|  | |||||||
| @ -3525,6 +3525,68 @@ public class PALRepositoryQueryAPIManager { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |     public String outputReportPPTPreview(UserContext _uc, String taskId) { | ||||||
|  |         OutputTaskModel model = new OutputTask().getTaskReportById(taskId); | ||||||
|  |         ResponseObject result = ResponseObject.newOkResponse(); | ||||||
|  |         if (model != null) { | ||||||
|  |             try { | ||||||
|  |                 UtilFile file = OutputAPIManager.getInstance().getFilePath(model.getWsId(), taskId, model.getProfileId()); | ||||||
|  |                 if (file.exists()) { | ||||||
|  |                     File[] fileList = file.listFiles(); | ||||||
|  |                     if (fileList.length > 0) { | ||||||
|  |                         File docFile = null; | ||||||
|  |                         for (File file2 : fileList) { | ||||||
|  |                             if (file2.isFile() && "pptx".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1)))) { | ||||||
|  |                                 docFile = file2; | ||||||
|  |                                 break; | ||||||
|  |                             } | ||||||
|  |                         } | ||||||
|  |                         if (docFile == null) { | ||||||
|  |                             return ResponseObject.newErrResponse("没有找到文件").toString(); | ||||||
|  |                         } | ||||||
|  |                         if (SDK.getAppAPI().isActive("com.actionsoft.apps.addons.onlinedoc")) { | ||||||
|  |                             OutputAppProfile appFile = OutputAppManager.getProfile(model.getProfileId()); | ||||||
|  |                             String sourceAppId = appFile.getAppContext().getId(); | ||||||
|  |                             String filename = docFile.getName(); | ||||||
|  |                             DCContext sourceDc = new DCContext(_uc, DCProfileManager.getDCProfile(sourceAppId, "output"), sourceAppId, model.getWsId(), taskId, filename); | ||||||
|  |                             Map<String, Object> aslpParams = new HashMap<String, Object>(); | ||||||
|  | 
 | ||||||
|  |                             aslpParams.put("sid", _uc.getSessionId()); | ||||||
|  |                             aslpParams.put("fileNameOriginal", filename); | ||||||
|  |                             aslpParams.put("sourceDc", sourceDc); | ||||||
|  |                             aslpParams.put("isShowDefaultToolbar", true); | ||||||
|  |                             aslpParams.put("isShowBackbtn", false); | ||||||
|  |                             aslpParams.put("isEncrypt", true); | ||||||
|  |                             aslpParams.put("isCopy", true); | ||||||
|  |                             aslpParams.put("isPrint", true); | ||||||
|  |                             aslpParams.put("isDownload", true); | ||||||
|  |                             AppAPI appAPI = SDK.getAppAPI(); | ||||||
|  |                             ResponseObject responseObject = appAPI.callASLP(appAPI.getAppContext(sourceAppId), "aslp://com.actionsoft.apps.addons.onlinedoc/filePreview", aslpParams); | ||||||
|  |                             if (responseObject != null) { | ||||||
|  |                                 if (responseObject.isOk()) { | ||||||
|  |                                     String url = responseObject.get("url").toString(); | ||||||
|  |                                     result.put("url", url); | ||||||
|  |                                     result.put("filename", filename); | ||||||
|  |                                 } else { | ||||||
|  |                                     result = ResponseObject.newErrResponse("文档转换服务不可用,请联系管理员"); | ||||||
|  |                                 } | ||||||
|  |                             } | ||||||
|  |                         } else { | ||||||
|  |                             result = ResponseObject.newErrResponse("文档转换服务不可用,请联系管理员"); | ||||||
|  |                         } | ||||||
|  |                     } | ||||||
|  |                 } else { | ||||||
|  |                     result = ResponseObject.newErrResponse("没有可预览文件"); | ||||||
|  |                 } | ||||||
|  |             } catch (Exception e) { | ||||||
|  |                 e.printStackTrace(); | ||||||
|  |                 return ResponseObject.newErrResponse().toString(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return result.toString(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * 流程手册下载 |      * 流程手册下载 | ||||||
|      * |      * | ||||||
|  | |||||||
| @ -10,6 +10,11 @@ import com.actionsoft.apps.coe.pal.pal.method.cache.PALMethodCache; | |||||||
| import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodAttributeModel; | import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodAttributeModel; | ||||||
| import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodJsonModel; | import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodJsonModel; | ||||||
| import com.actionsoft.apps.coe.pal.pal.method.util.PALMethodUtil; | import com.actionsoft.apps.coe.pal.pal.method.util.PALMethodUtil; | ||||||
|  | import com.actionsoft.apps.coe.pal.pal.output.OutputAPIManager; | ||||||
|  | import com.actionsoft.apps.coe.pal.pal.output.dao.OutputTask; | ||||||
|  | import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppManager; | ||||||
|  | import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppProfile; | ||||||
|  | import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel; | ||||||
| import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager; | import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager; | ||||||
| import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; | import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; | ||||||
| import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryPropertyCache; | import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryPropertyCache; | ||||||
| @ -31,6 +36,9 @@ import com.actionsoft.apps.coe.pal.pal.repository.designer.util.ShapeUtil; | |||||||
| import com.actionsoft.apps.coe.pal.pal.repository.model.CoeProcessLevelAutoBean; | import com.actionsoft.apps.coe.pal.pal.repository.model.CoeProcessLevelAutoBean; | ||||||
| import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; | import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; | ||||||
| import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel; | import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel; | ||||||
|  | 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.coe.pal.pal.repository.util.CoeProcessLevelUtil; | import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil; | ||||||
| import com.actionsoft.apps.coe.pal.pal.repository.web.CoeProcessLevelWeb; | import com.actionsoft.apps.coe.pal.pal.repository.web.CoeProcessLevelWeb; | ||||||
| import com.actionsoft.apps.coe.pal.pal.ws.web.VersionUtil; | import com.actionsoft.apps.coe.pal.pal.ws.web.VersionUtil; | ||||||
| @ -38,6 +46,7 @@ import com.actionsoft.apps.coe.pal.util.BpmOrgUtil; | |||||||
| import com.actionsoft.apps.coe.pal.util.HighSecurityUtil; | import com.actionsoft.apps.coe.pal.util.HighSecurityUtil; | ||||||
| import com.actionsoft.apps.coe.pal.util.StringHandleUtil; | import com.actionsoft.apps.coe.pal.util.StringHandleUtil; | ||||||
| import com.actionsoft.apps.coe.pal.util.UtilMapSort; | import com.actionsoft.apps.coe.pal.util.UtilMapSort; | ||||||
|  | import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile; | ||||||
| import com.actionsoft.bpms.bo.engine.BO; | import com.actionsoft.bpms.bo.engine.BO; | ||||||
| import com.actionsoft.bpms.commons.cache.Cache; | import com.actionsoft.bpms.commons.cache.Cache; | ||||||
| import com.actionsoft.bpms.commons.database.RowMap; | import com.actionsoft.bpms.commons.database.RowMap; | ||||||
| @ -57,11 +66,13 @@ import com.actionsoft.bpms.org.model.UserModel; | |||||||
| import com.actionsoft.bpms.org.web.CompanyWeb; | import com.actionsoft.bpms.org.web.CompanyWeb; | ||||||
| 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.util.*; | import com.actionsoft.bpms.util.*; | ||||||
| import com.actionsoft.exception.AWSException; | import com.actionsoft.exception.AWSException; | ||||||
| import com.actionsoft.exception.AWSObjectNotFindException; | import com.actionsoft.exception.AWSObjectNotFindException; | ||||||
| import com.actionsoft.i18n.I18nRes; | import com.actionsoft.i18n.I18nRes; | ||||||
| import com.actionsoft.sdk.local.SDK; | import com.actionsoft.sdk.local.SDK; | ||||||
|  | import com.actionsoft.sdk.local.api.AppAPI; | ||||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||||
| import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||||
| @ -4098,19 +4109,45 @@ public class DesignerRelationShapeWeb extends ActionWeb { | |||||||
|         for (FormFile formFile : formFiles) { |         for (FormFile formFile : formFiles) { | ||||||
|             DCContext fileDCContext = SDK.getBOAPI().getFileDCContext(formFile); |             DCContext fileDCContext = SDK.getBOAPI().getFileDCContext(formFile); | ||||||
|             fileDCContext.setSession(_uc); |             fileDCContext.setSession(_uc); | ||||||
|             String downloadURL = fileDCContext.getDownloadURL(); |             String downloadURL = ""; | ||||||
|  |             Map<String, Object> aslpParams = new HashMap<String, Object>(); | ||||||
|  | 
 | ||||||
|  |             String sourceAppId = "com.actionsoft.apps.coe.pal"; | ||||||
|  |             aslpParams.put("sid", _uc.getSessionId()); | ||||||
|  |             aslpParams.put("fileNameOriginal", fileDCContext.getFileName()); | ||||||
|  |             aslpParams.put("sourceDc", fileDCContext); | ||||||
|  |             aslpParams.put("isShowDefaultToolbar", true); | ||||||
|  |             aslpParams.put("isShowBackbtn", false); | ||||||
|  |             aslpParams.put("isEncrypt", true); | ||||||
|  |             aslpParams.put("isCopy", true); | ||||||
|  |             aslpParams.put("isPrint", true); | ||||||
|  |             aslpParams.put("isDownload", true); | ||||||
|  |             AppAPI appAPI = SDK.getAppAPI(); | ||||||
|  |             ResponseObject responseObject = appAPI.callASLP(appAPI.getAppContext(sourceAppId), "aslp://com.actionsoft.apps.addons.onlinedoc/filePreview", aslpParams); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |             if (responseObject != null) { | ||||||
|  |                 if (responseObject.isOk()) { | ||||||
|  |                     String url = responseObject.get("url").toString(); | ||||||
|  |                     downloadURL = SDK.getPortalAPI().getPortalUrl() + "/r" + url.substring(1, url.length()); | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|                 JSONObject jo = new JSONObject(); |                 JSONObject jo = new JSONObject(); | ||||||
|                 String fileName = fileDCContext.getFileName(); |                 String fileName = fileDCContext.getFileName(); | ||||||
|                 //视频支持mp4类型 |                 //视频支持mp4类型 | ||||||
|                 if (fileName.contains("mp4")) { |                 if (fileName.contains("mp4")) { | ||||||
|                 jo.put("video", downloadURL); |                     jo.put("video", fileDCContext.getDownloadURL()); | ||||||
|  |                     jo.put("video_url", downloadURL); | ||||||
|                 } else if (fileName.contains("png") || fileName.contains("gif") || fileName.contains("jpg")) { |                 } else if (fileName.contains("png") || fileName.contains("gif") || fileName.contains("jpg")) { | ||||||
|                 jo.put("picture", downloadURL); |                     jo.put("picture", fileDCContext.getDownloadURL()); | ||||||
|  |                     jo.put("picture_url", downloadURL); | ||||||
|                 } |                 } | ||||||
|                 jo.put("picTitle", fileName.split("\\.")[0]); |                 jo.put("picTitle", fileName.split("\\.")[0]); | ||||||
|                 filePathArray.add(jo); |                 filePathArray.add(jo); | ||||||
|             } |             } | ||||||
|             macroLibraries.put("filePaths", filePathArray); |             macroLibraries.put("filePaths", filePathArray); | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|         return HtmlPageTemplate.merge(CoEConstant.APP_ID, "carousel.map.html", macroLibraries); |         return HtmlPageTemplate.merge(CoEConstant.APP_ID, "carousel.map.html", macroLibraries); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -4209,4 +4246,129 @@ public class DesignerRelationShapeWeb extends ActionWeb { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * 判断是否为第一个节点为excel | ||||||
|  |      * | ||||||
|  |      * @param wsId | ||||||
|  |      * @param teamId | ||||||
|  |      * @param uuids | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     public String createOutputPrReportsByEstimateFile(String fileId) { | ||||||
|  |         //判断表单图是否为单一模型并且只上传excel一种附件,导出手册直接导出excel手册 | ||||||
|  |         PALRepositoryModel repositoryModel = PALRepositoryQueryAPIManager.getInstance().queryPalRepositoryModelByPalId(fileId); | ||||||
|  |         ResponseObject ro = ResponseObject.newOkResponse(); | ||||||
|  |         UpFileDao upFileDao = new UpFileDao(); | ||||||
|  |         //查询模型文件属性上传附件信息 | ||||||
|  |         List<UpfileModel> search = upFileDao.searchByRepositoryId(repositoryModel.getId(), "s"); | ||||||
|  | 
 | ||||||
|  |         if (search.size() > 0) { | ||||||
|  |             if (search.size() == 1) { | ||||||
|  |                 DCContext dcContextModel = null; | ||||||
|  |                 //获取 | ||||||
|  |                 String getExcelFileName = search.get(0).getFileName(); | ||||||
|  |                 //获取文件的后缀名 | ||||||
|  |                 int lastIndexOf = getExcelFileName.lastIndexOf("."); | ||||||
|  |                 String suffix = getExcelFileName.substring(lastIndexOf); | ||||||
|  |                 if (suffix.equals(".xls") || suffix.equals(".xlsx")) { | ||||||
|  |                     ro.put("result", "existExcel"); | ||||||
|  |                 } else { | ||||||
|  |                     ro.put("result", "noexistExcel"); | ||||||
|  |                 } | ||||||
|  |             } else { | ||||||
|  |                 ro.put("result", "noexistExcel"); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         return ro.toString(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public String createOutputPrReportsByEstimatePPTFile(UserContext me, String fileId) { | ||||||
|  |         ResponseObject ro = ResponseObject.newOkResponse(); | ||||||
|  |         List<Map<String, Object>> repositoryFileElements = CoeDesignerUtil.getShapeMessageJson4(fileId); //流程文件内容 | ||||||
|  |         PALRepositoryModel repositoryModel = PALRepositoryQueryAPIManager.getInstance().queryPalRepositoryModelByPalId(fileId); | ||||||
|  |         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(); | ||||||
|  |                 } else if ("I/O_L4".equals(type)) { | ||||||
|  |                     controlShapeId = shape.get("id").toString(); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // 流程附件列表 | ||||||
|  |         UpFileDao upFileDao = new UpFileDao(); | ||||||
|  |         List<UpfileModel> search = upFileDao.search(repositoryModel.getId(), controlShapeId, null); | ||||||
|  |         DCContext dcContextpdf = null; | ||||||
|  |         //如果为PPT,则生成PPT手册 | ||||||
|  |         if (search != null && search.size() > 0) { | ||||||
|  |             long b1 = System.currentTimeMillis(); | ||||||
|  |             // 复制附件 | ||||||
|  |             for (UpfileModel upfileModel : search) { | ||||||
|  |                 DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE); | ||||||
|  | 
 | ||||||
|  |                 if (dcProfile != null) { | ||||||
|  |                     dcContextpdf = new DCContext(me, dcProfile, CoEConstant.APP_ID, upfileModel.getPl_uuid(), upfileModel.getShape_uuid(), upfileModel.getFileName()); | ||||||
|  |                     String path = dcContextpdf.getPath(); | ||||||
|  |                     String fileName = dcContextpdf.getFileName(); | ||||||
|  |                     String suffix = fileName.substring(fileName.lastIndexOf(".") + 1); | ||||||
|  |                     if (suffix.equals("pptx")) { | ||||||
|  |                         ro.put("result", "existPPT"); | ||||||
|  |                     } else { | ||||||
|  |                         ro.put("result", "noexistPPT"); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return ro.toString(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public String createOutputPrReportsByDownloadExcelFile(String taskIds) { | ||||||
|  |         OutputTaskModel model = new OutputTask().getTaskReportById(taskIds); | ||||||
|  |         ResponseObject result = ResponseObject.newOkResponse(); | ||||||
|  |         if (model != null) { | ||||||
|  |             try { | ||||||
|  |                 UtilFile file = OutputAPIManager.getInstance().getFilePath(model.getWsId(), taskIds, model.getProfileId()); | ||||||
|  |                 if (file.exists()) { | ||||||
|  |                     File[] fileList = file.listFiles(); | ||||||
|  |                     if (fileList.length > 0) { | ||||||
|  |                         System.out.println("fileList==========" + fileList); | ||||||
|  |                         File docFile = null; | ||||||
|  |                         for (File file2 : fileList) { | ||||||
|  |                             System.out.println("file2==============" + file2); | ||||||
|  |                             if (file2.isFile() && "xlsx".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1)))) { | ||||||
|  |                                 docFile = file2; | ||||||
|  |                                 break; | ||||||
|  |                             } | ||||||
|  |                         } | ||||||
|  |                         if (docFile == null) { | ||||||
|  |                             return ResponseObject.newErrResponse("没有找到文件").toString(); | ||||||
|  |                         } | ||||||
|  |                         OutputAppProfile appFile = OutputAppManager.getProfile(model.getProfileId()); | ||||||
|  |                         String sourceAppId = appFile.getAppContext().getId(); | ||||||
|  |                         String filename = docFile.getName(); | ||||||
|  |                         DCContext sourceDc = new DCContext(_uc, DCProfileManager.getDCProfile(sourceAppId, "output"), sourceAppId, model.getWsId(), taskIds, filename); | ||||||
|  |                         String downUrl = SDK.getConfAPI().getPortalUrl() + "/r/" | ||||||
|  |                                 + sourceDc.getDownloadURL().replace("./", ""); | ||||||
|  |                         result.put("url", downUrl); | ||||||
|  |                     } | ||||||
|  |                 } else { | ||||||
|  |                     result = ResponseObject.newErrResponse("没有可预览文件"); | ||||||
|  |                 } | ||||||
|  |             } catch (Exception e) { | ||||||
|  |                 e.printStackTrace(); | ||||||
|  |                 return ResponseObject.newErrResponse().toString(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return result.toString(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user