PAL提交

This commit is contained in:
zhal 2023-07-12 11:34:32 +08:00
parent 297c68760e
commit e748b93f57
6 changed files with 5017 additions and 5573 deletions

View File

@ -2,27 +2,14 @@ package com.actionsoft.apps.coe.pal;
import com.actionsoft.apps.AppsConst;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.designer.no.epc.web.EpcGraphWeb;
import com.actionsoft.bpms.bpmn.modeler.ProcessBPMNDesignerController;
import com.actionsoft.bpms.commons.htmlframework.AlertWindow;
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
import com.actionsoft.bpms.commons.login.constant.LoginConst;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.commons.session.SessionImpl;
import com.actionsoft.bpms.form.engine.FormEngine;
import com.actionsoft.bpms.server.RequestParams;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.bind.annotation.Controller;
import com.actionsoft.bpms.server.bind.annotation.Mapping;
import com.actionsoft.bpms.server.bind.annotation.Param;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.apps.coe.pal.pal.backup.web.CoEPALBackupWeb;
import com.actionsoft.apps.coe.pal.pal.home.web.PalHomeWeb;
import com.actionsoft.apps.coe.pal.pal.manage.method.PalManageWeb;
import com.actionsoft.apps.coe.pal.pal.output.OutPutReportWeb;
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.dao.CoeProcessLevelDaoFacotory;
import com.actionsoft.apps.coe.pal.pal.repository.designer.no.epc.web.EpcGraphWeb;
import com.actionsoft.apps.coe.pal.pal.repository.designer.realtime.web.CoeRealtimeWeb;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.manager.DesignerRelationShapeCacheManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.web.DesignerRelationShapeWeb;
@ -37,6 +24,19 @@ import com.actionsoft.apps.coe.pal.pal.ws.model.CoeWorkSpaceModel;
import com.actionsoft.apps.coe.pal.pal.ws.web.CoeWorkSpaceWeb;
import com.actionsoft.apps.coe.pal.teamwork.web.ProcessPublishWeb;
import com.actionsoft.apps.coe.pal.teamwork.web.TeamWorkManagerWeb;
import com.actionsoft.bpms.bpmn.modeler.ProcessBPMNDesignerController;
import com.actionsoft.bpms.commons.htmlframework.AlertWindow;
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
import com.actionsoft.bpms.commons.login.constant.LoginConst;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.commons.session.SessionImpl;
import com.actionsoft.bpms.form.engine.FormEngine;
import com.actionsoft.bpms.server.RequestParams;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.bind.annotation.Controller;
import com.actionsoft.bpms.server.bind.annotation.Mapping;
import com.actionsoft.bpms.server.bind.annotation.Param;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.exception.ExceptionUtil;
import com.actionsoft.i18n.I18nRes;
@ -196,6 +196,7 @@ public class CoEPALController {
/**
* 建模方法->查询所有建模方法
*
* @param me
* @return
*/
@ -207,6 +208,7 @@ public class CoEPALController {
/**
* 保存形状定义描述
*
* @return
*/
@Mapping("com.actionsoft.apps.coe.pal_pl_manage_method_object_desc_save")
@ -217,6 +219,7 @@ public class CoEPALController {
/**
* 建模方法->查询特定建模方法的形状定义数据
*
* @param me
* @param methodId
* @return
@ -229,6 +232,7 @@ public class CoEPALController {
/**
* 建模方法->设置更多特性->获取形状属性设置
*
* @param me
* @param wsId
* @param methodId
@ -243,6 +247,7 @@ public class CoEPALController {
/**
* 建模方法->设置更多特性->获取文件属性设置
*
* @param me
* @param wsId
* @param methodId
@ -256,6 +261,7 @@ public class CoEPALController {
/**
* 建模方法->设置更多特性-保存文件/形状属性(原更多特性)设置
*
* @param me
* @param wsId
* @param methodId
@ -272,6 +278,7 @@ public class CoEPALController {
/**
* 建模方法->设置更多特性-保存文件/形状属性(原更多特性)设置之后保存进度查询
*
* @param me
* @param logId
* @param timer
@ -285,6 +292,7 @@ public class CoEPALController {
/**
* 建模方法->连线关系
*
* @param me
* @param methodId
* @return
@ -297,6 +305,7 @@ public class CoEPALController {
/**
* 建模方法->数据特性->特性树
*
* @param me
* @param wsId
* @param methodId
@ -310,6 +319,7 @@ public class CoEPALController {
/**
* 建模方法->数据特性->表格数据
*
* @param me
* @param wsId
* @param methodId
@ -323,6 +333,7 @@ public class CoEPALController {
/**
* 建模方法->数据特性->获取指定建模方法所有形状
*
* @param me
* @param methodId
* @return
@ -335,6 +346,7 @@ public class CoEPALController {
/**
* 建模方法->数据特性->新增修改属性到xml保存
*
* @param me
* @return
*/
@ -349,6 +361,7 @@ public class CoEPALController {
/**
* 建模方法->数据特性->更新xml文件的只读和有效
*
* @param me
* @return
*/
@ -360,6 +373,7 @@ public class CoEPALController {
/**
* 建模方法->数据特性-更新xml文件的是否在bpm审批时显示通配
*
* @param me
* @param methodId
* @param key
@ -375,6 +389,7 @@ public class CoEPALController {
/**
* 建模方法->数据特性->删除xml文件指定属性
*
* @param me
* @param methodId
* @param attrId
@ -388,6 +403,7 @@ public class CoEPALController {
/**
* 建模方法->数据特性->更新文件属性和形状属性的属性名称
*
* @param me
* @param wsId
* @param methodId
@ -404,6 +420,7 @@ public class CoEPALController {
/**
* 建模方法->数据特性->更新文件属性和形状属性的属性排序
*
* @param me
* @param wsId
* @param methodId
@ -857,6 +874,7 @@ public class CoEPALController {
/**
* 查询服务器中待导入的资产库文件
*
* @param me
* @return
*/
@ -1069,6 +1087,7 @@ public class CoEPALController {
/**
* 获取流程属性信息填充绩效模型
*
* @param me
* @param params
* @return
@ -1082,7 +1101,6 @@ public class CoEPALController {
}
// 上传附件-load
// @Mapping("COE_PAL_PROCESSLEVEL_UPFILE_LOAD")
@Mapping("com.actionsoft.apps.coe.pal_processlevel_upfile_load")
@ -1099,6 +1117,7 @@ public class CoEPALController {
/**
* 三员管理下加载用户权限下所有密级文件包含未标密
*
* @param me
* @param params
* @return
@ -1117,6 +1136,7 @@ public class CoEPALController {
/**
* 更新附件密级
*
* @param me
* @param uuid
* @param securityLevel
@ -1130,6 +1150,7 @@ public class CoEPALController {
/**
* 获取流程树中第一个附件未标密文件在树中路径
*
* @return
*/
@Mapping("com.actionsoft.apps.coe.pal_processlevel_upfile_unmark_path")
@ -1195,6 +1216,7 @@ public class CoEPALController {
/**
* 相关文件/支持文件附件下载
*
* @param me
* @param params
* @return
@ -1211,6 +1233,7 @@ public class CoEPALController {
/**
* 流程手册单个下载
*
* @param me
* @param params
* @return
@ -1231,7 +1254,6 @@ public class CoEPALController {
}
// 文件属性的单个 修改
// @Mapping("COE_PAL_PROCESSLEVEL_MORE_ATTR_CONTENT_SAVE")
@Mapping("com.actionsoft.apps.coe.pal_processlevel_more_attr_content_save")
@ -1537,6 +1559,7 @@ public class CoEPALController {
/**
* 数据属性模型的快速搜索
*
* @param me
* @param wsId
* @param category
@ -1598,6 +1621,7 @@ public class CoEPALController {
/**
* 图形粘贴对附件的粘贴
*
* @param me
* @param shapeMap
* @return
@ -1865,6 +1889,7 @@ public class CoEPALController {
/**
* 下载模版
*
* @param me
* @param appId 模版所属应用
* @param templates 模版路径名称
@ -1879,6 +1904,7 @@ public class CoEPALController {
/**
* 上传模版
*
* @param me
* @param appId 模版所属应用
* @param param 模版在dc中的路径参数
@ -1914,6 +1940,7 @@ public class CoEPALController {
/**
* 新发布流程申请
*
* @param me
* @param processInstId
* @param taskInstId
@ -1951,6 +1978,7 @@ public class CoEPALController {
/**
* 新发布流程申请
*
* @param me
* @param processInstId
* @param taskInstId
@ -1988,6 +2016,7 @@ public class CoEPALController {
/**
* 新发布流程申请
*
* @param me
* @param processInstId
* @param taskInstId
@ -2183,7 +2212,6 @@ public class CoEPALController {
* @param id
* @return
* @throws Exception
*
*/
// @Mapping("COE_PAL_BACKUP_EXPORT")
@Mapping("com.actionsoft.apps.coe.pal_backup_export")
@ -2304,6 +2332,7 @@ public class CoEPALController {
/**
* 查询流程的链接
*
* @param me
* @param wsId
* @param plId
@ -2400,6 +2429,7 @@ public class CoEPALController {
/**
* shape同名符号提示
*
* @param me
* @param uuid
* @param shapeId
@ -2415,6 +2445,7 @@ public class CoEPALController {
/**
* 节点属性是deptAddress,获取关联的部门名称
*
* @param me
* @param deptIds
* @return
@ -2428,6 +2459,7 @@ public class CoEPALController {
/**
* 导出流程
*
* @param me
* @param wsId
* @param uuid
@ -2443,6 +2475,7 @@ public class CoEPALController {
/**
* 导入流程
*
* @param me
* @param wsId
* @param uuid
@ -2470,6 +2503,7 @@ public class CoEPALController {
/**
* 判断当前流程模型是否已经上锁 上锁人员
*
* @param me
* @param uuid
* @return
@ -2484,6 +2518,7 @@ public class CoEPALController {
/**
* 根据流程源文件校验节点关联属性是否存在有关联节点id但是数据库无该关联信息的情况
* 根据流程源文件反向插入关联数据到APP_ACT_COE_PAL_SHAPE_RLAT
*
* @param wsId
* @return
*/
@ -2496,6 +2531,7 @@ public class CoEPALController {
/**
* 关联关系DB数据恢复
*
* @param lossData 需要恢复的数据
*/
// @Mapping("COE_PAL_WS_SHAPE_RELATION_RESTORE")
@ -2507,6 +2543,7 @@ public class CoEPALController {
/**
* 特殊文件属性列表形式属性保存
*
* @return
*/
// @Mapping("COE_PAL_PROCESSLEVEL_SPECIAL_ATTRIBUTE_SAVE")
@ -2518,6 +2555,7 @@ public class CoEPALController {
/**
* 特殊文件属性列表形式属性删除
*
* @return
*/
// @Mapping("COE_PAL_PROCESSLEVEL_SPECIAL_ATTRIBUTE_DELETE")
@ -2529,6 +2567,7 @@ public class CoEPALController {
/**
* 检测是否可以导出流程手册
*
* @param me
* @param fileId
* @return
@ -2555,6 +2594,7 @@ public class CoEPALController {
/**
* 流程手册预览
*
* @param me
* @param taskId
* @return
@ -2568,10 +2608,10 @@ public class CoEPALController {
/**
* 流程阅览 流程手册下载
*
* @param me
* @param taskId
* @return
* by zhaolei
* @return by zhaolei
*/
@Mapping("com.actionsoft.apps.coe.pal_outputreport_output_process_download")
public String COEPALOUTPUTREPORTOutputProcessDownload(UserContext me, String taskId, String ruuid) {
@ -2579,10 +2619,10 @@ public class CoEPALController {
}
/**
* 查询导出组织模型等结构
* 简单查询
*
* @param me
* @param ruuid
* @param wsId
@ -2597,6 +2637,7 @@ public class CoEPALController {
/**
* 制度表单等工具栏中上传附件删除
*
* @param ruuid
* @param fileName
* @return
@ -2610,6 +2651,7 @@ public class CoEPALController {
/**
* 制度表单等工具栏中上传附件保存并生成相应活动节点
*
* @param ruuid
* @param fileNames
* @return
@ -2623,6 +2665,7 @@ public class CoEPALController {
/**
* 创建模型图片和缩略图
*
* @param uuid
* @return
*/
@ -2636,6 +2679,7 @@ public class CoEPALController {
/**
* 获取打开一个流程所需要的参数
* 应用于流程树结构双击打开流程设计器
*
* @param me
* @param wsId
* @param uuid
@ -2651,6 +2695,7 @@ public class CoEPALController {
/**
* 新版门户流程只读页面打开前校验
*
* @param me
* @param uuid
* @return
@ -2664,6 +2709,7 @@ public class CoEPALController {
/**
* 新版门户打开
*
* @param me
* @param uuid
* @return
@ -2676,6 +2722,7 @@ public class CoEPALController {
/**
* 保存节点的地址簿属性内容到关联表
*
* @return
*/
// @Mapping("COE_PAL_PL_RESPOSITORY_DESIGNER_ADDRESS_SHAPE_DATA_SAVE")
@ -2687,6 +2734,7 @@ public class CoEPALController {
/**
* 获取关联的地址簿id
*
* @param me
* @param objIds
* @param shapeId
@ -2703,6 +2751,7 @@ public class CoEPALController {
/**
* 获取关联的地址簿名称
* 只读情况下显示
*
* @param me
* @param objIds
* @param shapeId
@ -2719,6 +2768,7 @@ public class CoEPALController {
/**
* 获取aws平台的组织机构/岗位角色树
*
* @param me
* @param wsId
* @param fileId
@ -2735,6 +2785,7 @@ public class CoEPALController {
/**
* 获取aws平台树结构
*
* @param me
* @param pid
* @param uuid
@ -2751,6 +2802,7 @@ public class CoEPALController {
/**
* 获取子节点
*
* @param me
* @param uuid
* @param type
@ -2765,6 +2817,7 @@ public class CoEPALController {
/**
* 模糊查询
*
* @return
*/
// @Mapping("COE_PAL_PL_RESPOSITORY_DESIGNER_SHAPES_AWS_ORG_TREE_QUERY")
@ -2776,6 +2829,7 @@ public class CoEPALController {
/**
* 保存aws平台组织关联关系
*
* @param me
* @param relationAwsOrg
* @param shapeId
@ -2793,6 +2847,7 @@ public class CoEPALController {
/**
* 查询aws平台组织名称
*
* @param me
* @param fileId
* @param shapeId
@ -2808,6 +2863,7 @@ public class CoEPALController {
/**
* 报告生成器
* raci岗位手册关联awsorg相关
*
* @param me
* @param wsid
* @param teamId
@ -2825,6 +2881,7 @@ public class CoEPALController {
/**
* 报告生成器
* raci树结构aws org
*
* @param me
* @param wsid
* @param teamId
@ -2841,6 +2898,7 @@ public class CoEPALController {
/**
* 删除流程中的节点时记录日志
* 查看designer.extend.core.js文件
*
* @param me
* @param uuid
* @param delnode
@ -2855,8 +2913,10 @@ public class CoEPALController {
}
//======******======******====== COE CONSOLE 互调的命令 begin ======******======******======//
/**
* 调用平台流程属性形状属性
*
* @param me
* @param params
* @return
@ -2876,6 +2936,7 @@ public class CoEPALController {
/**
* 平台与PAL是否存在共享状态
*
* @param me
* @param processDefId
* @return
@ -2891,6 +2952,7 @@ public class CoEPALController {
/**
* 新建更新资产库查询数据
*
* @param me
* @param wsId 资产库id可为空
* @return
@ -2903,6 +2965,7 @@ public class CoEPALController {
/**
* 更新/保存资产库
*
* @param me
* @param wsId 为空则新建不为空则更新
* @param name 名称
@ -2919,6 +2982,7 @@ public class CoEPALController {
/**
* 管理中心 获取管理中心App
*
* @param me
* @return
*/
@ -2930,6 +2994,7 @@ public class CoEPALController {
/**
* 获取资产库管理数据
*
* @param me
* @return
*/
@ -2947,6 +3012,7 @@ public class CoEPALController {
/**
* 加载流程树
*
* @return
*/
@Mapping("com.actionsoft.apps.coe.pal_processlevel_tree_data")
@ -2957,6 +3023,7 @@ public class CoEPALController {
/**
* 查询新建文件类型
*
* @param me
* @return
*/
@ -2968,6 +3035,7 @@ public class CoEPALController {
/**
* 保存/修改新建文件夹层级
*
* @return
*/
@Mapping("com.actionsoft.apps.coe.pal_processlevel_folder_create_save")
@ -2978,6 +3046,7 @@ public class CoEPALController {
/**
* 创建空白模型
*
* @param me
* @param wsId
* @param teamId
@ -2994,12 +3063,9 @@ public class CoEPALController {
}
/**
* 创建空白模板
*
* @param me
* @param wsId
* @param teamId
@ -3009,8 +3075,8 @@ public class CoEPALController {
* @param container
* @param securityLevel
* @param name
* @author zhaolei
* @return
* @author zhaolei
*/
@Mapping("com.actionsoft.apps.coe.pal_processlevel_repository_create_save_Designer")
public String saveCreatePalProcessLevelRepositoryDesigner(UserContext me, String wsId, String teamId, String category, String method, String parentId, String container, Integer securityLevel, String name) {
@ -3020,6 +3086,7 @@ public class CoEPALController {
/**
* 获取路径
*
* @param me
* @param parentId
* @return
@ -3032,10 +3099,11 @@ public class CoEPALController {
/**
* 校验重名功能
*
* @param me
* @param title
* @author zhaolei
* @return
* @author zhaolei
*/
@Mapping("com.actionsoft.apps.coe.pal_pl_repository_designer_checkname")
public String checkCreatePalProcessLevelRepository(UserContext me, String title, String method) {
@ -3045,6 +3113,7 @@ public class CoEPALController {
/**
* 根据用户选择类型创建相应制度图形
*
* @param me
* @param type
* @return
@ -3058,6 +3127,7 @@ public class CoEPALController {
/**
* 创建角色/绩效/表单模型
*
* @param me
* @param
* @return
@ -3071,6 +3141,7 @@ public class CoEPALController {
/**
* 查询是否有相同角色/绩效图数据
*
* @param me
* @param
* @return
@ -3084,6 +3155,7 @@ public class CoEPALController {
/**
* 质量校验功能
*
* @param me
* @param sid
* @param uuid
@ -3104,9 +3176,9 @@ public class CoEPALController {
}
/**
* 添加回复功能
*
* @param me
* @param ruuid
* @param replyContent
@ -3120,6 +3192,7 @@ public class CoEPALController {
/**
* 加载回复列表
*
* @param me
* @param ruuid
* @param replyContent
@ -3149,6 +3222,7 @@ public class CoEPALController {
/**
* 删除评论功能
*
* @param me
* @param params
* @param sid
@ -3163,9 +3237,9 @@ public class CoEPALController {
}
/**
* 获取最近编辑的文件和收藏的文件
*
* @param me
* @param wsId
* @param teamId
@ -3179,6 +3253,7 @@ public class CoEPALController {
/**
* 收藏文件模型
*
* @param me
* @param wsId
* @param teamId
@ -3193,6 +3268,7 @@ public class CoEPALController {
/**
* 取消收藏
*
* @param me
* @param wsId
* @param teamId
@ -3207,6 +3283,7 @@ public class CoEPALController {
/**
* 查询子文件
*
* @param me
* @param wsId
* @param teamId
@ -3220,10 +3297,10 @@ public class CoEPALController {
}
/**
* Repository 树形子列表元素orderIndex调整
* 不允许跨级排序
*
* @param me
* @param wsId 所属资产库ID
* @param currentId 待调整位置uuid
@ -3239,6 +3316,7 @@ public class CoEPALController {
/**
* 获取模型文件详情
*
* @param me
* @param wsId
* @param teamId
@ -3253,6 +3331,7 @@ public class CoEPALController {
/**
* 批量移动文件
*
* @param uc
* @param sourceData
* @param targetData
@ -3266,6 +3345,7 @@ public class CoEPALController {
/**
* 复制文件
*
* @param uc
* @param wsId
* @param teamId
@ -3281,6 +3361,7 @@ public class CoEPALController {
/**
* 删除
*
* @param uc
* @param wsId
* @param teamId
@ -3295,6 +3376,7 @@ public class CoEPALController {
/**
* 设计器-查询版本数据
*
* @param uc
* @param wsId
* @param teamId
@ -3309,6 +3391,7 @@ public class CoEPALController {
/**
* 设计器-创建新版本
*
* @param uc
* @param wsId
* @param teamId
@ -3323,6 +3406,7 @@ public class CoEPALController {
/**
* 设计器-删除某版本文件(放入回收站)
*
* @param uc
* @param wsId
* @param teamId
@ -3337,6 +3421,7 @@ public class CoEPALController {
/**
* 设计器-切换版本状态为使用中
*
* @param uc
* @param wsId
* @param teamId
@ -3351,6 +3436,7 @@ public class CoEPALController {
/**
* 查询文件属性
*
* @param uc
* @param wsId
* @param teamId
@ -3397,6 +3483,7 @@ public class CoEPALController {
/**
* 单个更新流程文件三员管理密级
*
* @param me
* @param uuid 文件id
* @param securityLevel
@ -3410,6 +3497,7 @@ public class CoEPALController {
/**
* 批量更新流程文件三员管理密级
*
* @param me
* @param fileList
* @return
@ -3422,6 +3510,7 @@ public class CoEPALController {
/**
* 获取流程文件未标密数量
*
* @param me
* @param wsId
* @param teamId
@ -3435,6 +3524,7 @@ public class CoEPALController {
/**
* 校验用户是否有访问文件的权限
*
* @param me
* @param uuid
* @return
@ -3447,6 +3537,7 @@ public class CoEPALController {
/**
* 批量校验文件的密级权限
*
* @param me
* @param uuids
* @param isSub 是否进行下属列表密级权限校验
@ -3460,6 +3551,7 @@ public class CoEPALController {
/**
* 设计器页面右侧版本差异窗口接口
*
* @param me
* @param id 当前资产库文件ID
* @return
@ -3472,6 +3564,7 @@ public class CoEPALController {
/**
* 校验形状属性
*
* @param me
* @param uuid
* @param define 若为空字符串则获取系统当前保存的define进行校验
@ -3485,6 +3578,7 @@ public class CoEPALController {
/**
* 架构筛选条件查询
*
* @param me
* @param wsId
* @param teamId
@ -3498,6 +3592,7 @@ public class CoEPALController {
/**
* 编号刷
*
* @param uc
* @param uuid
* @return
@ -3510,6 +3605,7 @@ public class CoEPALController {
/**
* 前后置流程界面操作查询关联的模型的信息
*
* @param uc
* @param oldFileIds
* @param newFileIds
@ -3529,6 +3625,7 @@ public class CoEPALController {
/**
* 校验是否有前后置流程属性
*
* @param me
* @param removeProcedureShapes
* @param fileId

View File

@ -1,40 +1,13 @@
package com.actionsoft.apps.coe.pal.pal.output;
import java.io.File;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import com.actionsoft.apps.AppsConst;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
import com.actionsoft.apps.coe.pal.cooperation.CoeCooperationAPIManager;
import com.actionsoft.apps.coe.pal.cooperation.model.CoeCooperationTeamModel;
import com.actionsoft.apps.coe.pal.log.CoEOpLogAPI;
import com.actionsoft.apps.coe.pal.log.CoEOpLogConst;
import com.actionsoft.apps.coe.pal.util.BpmOrgUtil;
import com.actionsoft.apps.coe.pal.util.HighSecurityUtil;
import com.actionsoft.apps.resource.AppContext;
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
import com.actionsoft.bpms.commons.htmlframework.AlertWindow;
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.org.cache.RoleCache;
import com.actionsoft.bpms.org.model.RoleModel;
import com.actionsoft.bpms.org.model.UserModel;
import com.actionsoft.bpms.server.DispatcherRequest;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.conf.portal.LanguageModel;
import com.actionsoft.bpms.server.fs.DCContext;
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
import com.actionsoft.bpms.server.fs.dc.DCUtil;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.bpms.util.UtilDate;
import com.actionsoft.bpms.util.UtilFile;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
import com.actionsoft.apps.coe.pal.pal.output.dao.OutputTask;
import com.actionsoft.apps.coe.pal.pal.output.extend.GenerLogExd;
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;
@ -44,16 +17,41 @@ import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.web.Designer
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.ShapeUtil;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.apps.coe.pal.util.BpmOrgUtil;
import com.actionsoft.apps.coe.pal.util.HighSecurityUtil;
import com.actionsoft.apps.coe.pal.util.StringHandleUtil;
import com.actionsoft.apps.resource.AppContext;
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
import com.actionsoft.bpms.commons.htmlframework.AlertWindow;
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.org.cache.RoleCache;
import com.actionsoft.bpms.org.model.RoleModel;
import com.actionsoft.bpms.org.model.UserModel;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.conf.portal.LanguageModel;
import com.actionsoft.bpms.server.fs.DCContext;
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
import com.actionsoft.bpms.server.fs.dc.DCUtil;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.bpms.util.UtilDate;
import com.actionsoft.bpms.util.UtilFile;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.exception.AWSException;
import com.actionsoft.i18n.I18nRes;
import com.actionsoft.sdk.local.SDK;
import com.actionsoft.sdk.local.api.ORGAPI;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Sets;
import java.io.File;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 报告生成器web类
*
@ -63,6 +61,7 @@ import com.google.common.collect.Sets;
*/
public class OutPutReportWeb extends ActionWeb {
UserContext _uc;
GenerLogExd log = new GenerLogExd();
public OutPutReportWeb() {
}
@ -930,6 +929,7 @@ public class OutPutReportWeb extends ActionWeb {
/**
* 根据appId获取相应的流程手册
*
* @return
*/
public List<OutputAppProfile> getOutputAppByAppId(String appId) {
@ -945,6 +945,7 @@ public class OutPutReportWeb extends ActionWeb {
/**
* 检测是否可以导出流程手册
*
* @param fileId 流程id
* @return
*/
@ -983,6 +984,7 @@ public class OutPutReportWeb extends ActionWeb {
/**
* 报告生成器
* raci关联awsorg相关
*
* @param wsid
* @param teamId
* @param methodType
@ -1003,6 +1005,7 @@ public class OutPutReportWeb extends ActionWeb {
/**
* 报告生成器
* raci树结构aws org
*
* @param wsid
* @param teamId
* @param methodType
@ -1082,6 +1085,7 @@ public class OutPutReportWeb extends ActionWeb {
/**
* 获取岗位树
*
* @return
*/
private void getPositionTree(String root, JSONArray data) {
@ -1134,6 +1138,7 @@ public class OutPutReportWeb extends ActionWeb {
/**
* 获取角色树
*
* @return
*/
private void getRoleTree(String root, JSONArray data) {
@ -1247,6 +1252,7 @@ public class OutPutReportWeb extends ActionWeb {
/**
* 流程报告模版下载
*
* @param appId
* @param templates
* @return
@ -1310,6 +1316,7 @@ public class OutPutReportWeb extends ActionWeb {
/**
* 上传模版
*
* @param appId
* @param profileId
* @param param
@ -1421,4 +1428,5 @@ public class OutPutReportWeb extends ActionWeb {
return ro.toString();
}
}

View File

@ -1,45 +1,26 @@
package com.actionsoft.apps.coe.pal.pal.output.util;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
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.PALMethodModel;
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.designer.relation.cache.DesignerShapeRelationCache;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.dao.DesignerShapeRelationDao;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel;
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
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.resource.plugin.profile.DCPluginProfile;
import com.actionsoft.bpms.org.model.DepartmentModel;
import com.actionsoft.bpms.org.model.RoleModel;
import com.actionsoft.bpms.org.model.UserModel;
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.UtilFile;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.sini.com.spire.doc.*;
import com.sini.com.spire.doc.documents.*;
import com.sini.com.spire.doc.fields.DocPicture;
import com.sini.com.spire.doc.fields.TextRange;
import com.sini.com.spire.doc.formatting.CharacterFormat;
import com.sini.com.spire.doc.formatting.ParagraphFormat;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import java.awt.*;
import java.io.*;
import java.util.List;
import java.util.*;
public class OutputWordUtil {
@ -166,7 +147,7 @@ public class OutputWordUtil {
* @param tempName
* @param docName
*/
public static void createDoc2(JSONObject dataMap, String tempPath, String tempName, String docName) {
public static void createDoc2(com.alibaba.fastjson.JSONObject dataMap, String tempPath, String tempName, String docName) {
Configuration configuration = new Configuration();
configuration.setDefaultEncoding("UTF-8");
@ -205,623 +186,6 @@ public class OutputWordUtil {
}
}
/**
* 生成word文件
*
* @param dataMap
* @param tempPath
* @param tempName
* @param docName
*/
public static void createZdDoc2(JSONObject dataMap, String tempPath, String tempName, String docName, JSONObject wizardJsonData, String repositoryId) throws FileNotFoundException {
Configuration configuration = new Configuration();
configuration.setDefaultEncoding("UTF-8");
// 设置模本装置方法和路径
try {
UtilFile temps = new UtilFile(tempPath);
configuration.setDirectoryForTemplateLoading(temps);
} catch (IOException e2) {
e2.printStackTrace();
}
Template t = null;
try {
t = configuration.getTemplate(tempName, "UTF-8");
} catch (IOException e) {
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();
}
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); //流程文件内容
if (wizardJsonData.getBoolean("orderNuberFirst")) { // 根据页面选择进行排序
OutputWordUtil.orderByNumber(repositoryFileElements);
}
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();
}
}
}
UserContext userContext = DispatcherRequest.getUserContext();
Map<String, String> result = new HashMap<>();
result.put("listDef", "");
result.put("content", "");
if (UtilString.isEmpty(controlShapeId)) {
}
PALRepositoryModel repositoryModel = PALRepositoryQueryAPIManager.getInstance().queryPalRepositoryModelByPalId(repositoryId);
if (repositoryModel == null) {
}
String content = "";
StringBuilder listStr = new StringBuilder();
// 读取附件
// 流程附件列表
UpFileDao upFileDao = new UpFileDao();
List<UpfileModel> search = upFileDao.search(repositoryModel.getId(), controlShapeId, null);
DCContext dcContextpdf = null;
File file = null;
if (search != null && search.size() > 0) {
// 复制附件
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();
//创建 Document 类的对象并从磁盘加载 Word 文档
Document document = new Document(outFile.getPath());
//将另一个文档插入当前文档
document.insertTextFromFile(path + fileName, FileFormat.Docx_2013);
// document.insertTextFromFile("/Users/sunlh/Downloads/手册格式问题测试文档(3)new.docx", FileFormat.Docx_2013);
//保存结果文档
document.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
}
}
}
/****************************插入支持文件、相关文件、附则等信息********************************************************/
Document doc = new Document(outFile.getPath());
//获取最后一节
Section section = doc.getLastSection();
//相关文件 R_relevant_flies
JSONArray relevant_flies = new JSONArray(); //组织职责Table
List<DesignerShapeRelationModel> relationList2 = DesignerShapeRelationCache.getListByAttrId(repositoryModel.getId(), "", "related_files");
int count = 0;
if (relationList2.size() > 0) {
for (DesignerShapeRelationModel relation : relationList2) {
String relationFileId = relation.getRelationFileId();// 支持或相关文件的ID
PALRepositoryModel model = PALRepositoryCache.getCache().get(relationFileId);
if (model != null) {
count++;
String name = model.getName();
JSONObject tmp = new JSONObject();
tmp.put("name", name);
tmp.put("desc", count);
relevant_flies.add(tmp);
}
}
CharacterFormat format = new CharacterFormat();
//创建字体格式
format.setFontName("宋体");
//添加段落设置一级序列
Paragraph paragraph = section.addParagraph();
ParagraphFormat paragraphFormat1 = paragraph.getFormat();
paragraphFormat1.setHorizontalAlignment(HorizontalAlignment.Left);
TextRange tr = paragraph.appendText("相关文件");
tr.getCharacterFormat().setBold(true);
tr.getCharacterFormat().setFontName("宋体");
//tr.applyCharacterFormat(format); //应用字体格式
paragraph.applyStyle(BuiltinStyle.Heading_1); //应用标题1样式
Section section2 = doc.addSection();
//定义表格数据
String[] header = {"序号", "文件名称"};
String[][] strArray2 = new String[relevant_flies.size()][];
List<String[]> list = new LinkedList<>();
for (int i = 0; i < relevant_flies.size(); i++) {
JSONObject jsonObject = relevant_flies.getJSONObject(i);
String[] strArray = new String[2];
strArray[0] = jsonObject.getString("desc").toString();
strArray[1] = jsonObject.getString("name").toString();
list.add(strArray);
strArray2[i] = strArray;
}
String[][] data = strArray2;
//添加表格
Table table = section.addTable(true);
table.resetCells(data.length + 1, header.length);
TableRow row = table.getRows().get(0);
row.isHeader(true);
row.setHeight(20);
row.setHeightType(TableRowHeightType.Exactly);
for (int i = 0; i < header.length; i++) {
row.getCells().get(i).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle);
Paragraph p = row.getCells().get(i).addParagraph();
p.getFormat().setHorizontalAlignment(HorizontalAlignment.Center);
TextRange txtRange = p.appendText(header[i]);
txtRange.getCharacterFormat().setBold(true);
}
//将数据添加到其余行
for (int r = 0; r < data.length; r++) {
TableRow dataRow = table.getRows().get(r + 1);
dataRow.setHeight(25);
dataRow.setHeightType(TableRowHeightType.Exactly);
dataRow.getRowFormat().setBackColor(Color.white);
for (int c = 0; c < data[r].length; c++) {
dataRow.getCells().get(c).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle);
dataRow.getCells().get(c).addParagraph().appendText(data[r][c]);
}
}
}
//支持文件
JSONArray supportfiles = new JSONArray(); //组织职责Table
List<DesignerShapeRelationModel> relationList = DesignerShapeRelationCache.getListByAttrId(repositoryModel.getId(), "", "support_files");
int index = 0;
if (relationList.size() > 0) {
for (DesignerShapeRelationModel relation : relationList) {
String relationFileId = relation.getRelationFileId();// 支持或相关文件的ID
PALRepositoryModel model = PALRepositoryCache.getCache().get(relationFileId);
if (model != null) {
index++;
String name = model.getName();
JSONObject tmp = new JSONObject();
tmp.put("name", name);
tmp.put("desc", index);
supportfiles.add(tmp);
}
}
CharacterFormat format2 = new CharacterFormat();
//创建字体格式
format2.setFontName("宋体");
//添加段落设置一级序列
Paragraph paragraph2 = section.addParagraph();
ParagraphFormat paragraphFormat2 = paragraph2.getFormat();
paragraphFormat2.setHorizontalAlignment(HorizontalAlignment.Left);
TextRange tr2 = paragraph2.appendText("支持文件");
tr2.getCharacterFormat().setBold(true);
tr2.getCharacterFormat().setFontName("宋体");
paragraph2.applyStyle(BuiltinStyle.Heading_1); //应用标题1样式
//定义表格数据
String[] header = {"序号", "文件名称"};
String[][] strArray2 = new String[supportfiles.size()][];
List<String[]> list = new LinkedList<>();
for (int i = 0; i < supportfiles.size(); i++) {
JSONObject jsonObject = supportfiles.getJSONObject(i);
String[] strArray = new String[2];
strArray[0] = jsonObject.getString("desc").toString();
strArray[1] = jsonObject.getString("name").toString();
list.add(strArray);
strArray2[i] = strArray;
}
String[][] data = strArray2;
//添加表格
Table table = section.addTable(true);
table.resetCells(data.length + 1, header.length);
TableRow row = table.getRows().get(0);
row.isHeader(true);
row.setHeight(20);
row.setHeightType(TableRowHeightType.Exactly);
for (int i = 0; i < header.length; i++) {
row.getCells().get(i).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle);
Paragraph p = row.getCells().get(i).addParagraph();
p.getFormat().setHorizontalAlignment(HorizontalAlignment.Center);
TextRange txtRange = p.appendText(header[i]);
txtRange.getCharacterFormat().setBold(true);
}
//将数据添加到其余行
for (int r = 0; r < data.length; r++) {
TableRow dataRow = table.getRows().get(r + 1);
dataRow.setHeight(25);
dataRow.setHeightType(TableRowHeightType.Exactly);
dataRow.getRowFormat().setBackColor(Color.white);
for (int c = 0; c < data[r].length; c++) {
dataRow.getCells().get(c).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle);
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("宋体");*/
CharacterFormat format4 = new CharacterFormat();
//创建字体格式
format4.setFontName("宋体");
//添加段落
Paragraph paragraph4 = section.addParagraph();
ParagraphFormat paragraphFormat4 = paragraph4.getFormat();
paragraphFormat4.setHorizontalAlignment(HorizontalAlignment.Left);
TextRange tr4 = paragraph4.appendText("附件");
;
tr4.getCharacterFormat().setBold(true);
tr4.getCharacterFormat().setFontName("宋体");
paragraph4.applyStyle(BuiltinStyle.Heading_1); //应用标题1样式
//doc.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
//查询模型文件属性上传附件信息
List<UpfileModel> search2 = upFileDao.searchByRepositoryIdGroupByFilename(repositoryModel.getId(), "f");
System.out.println("search2==================" + search2.toString());
DCContext dcContextModel = null;
// 排序
Collections.sort(search2, new Comparator<UpfileModel>() {
@Override
public int compare(UpfileModel o1, UpfileModel o2) {
String p1 = o1.getFileName();
String p2 = o2.getFileName();
if ((p1.substring(0, 2).equals("附件") && p2.substring(0, 2).equals("附件") && p1.indexOf("") != -1 && p2.indexOf("") != -1)) {
return Integer.parseInt(p1.substring(2, p1.indexOf(""))) - Integer.parseInt(p2.substring(2, p2.indexOf("")));
} else {
return 0;
}
}
});
//读取模型附件插入手册中文档对象
if (search2 != null && search2.size() > 0) {
for (UpfileModel upfileModel : search2) {
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
if (dcProfile != null) {
// 处理DocCenter
dcContextModel = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, "file", upfileModel.getPl_uuid(), upfileModel.getFileName());
//添加段落
Paragraph paragraph5 = section.addParagraph();
//加载一个图片它将作为外部文件的符号显示在Word文档中
//获取最后一个.的位置
int lastIndexOf = dcContextModel.getFileName().lastIndexOf(".");
//获取文件的后缀名 .jpg
String suffix = dcContextModel.getFileName().substring(lastIndexOf);
DocPicture pdfIcon = new DocPicture(doc);
InputStream stream1 = new FileInputStream(dcContextModel.getFilePath());
DocPicture pic1 = new DocPicture(doc);
if (suffix.equals(".doc") || suffix.equals(".docx")) {
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/word.png");
paragraph5.appendText(dcContextModel.getFileName());
if (suffix.equals(".doc")) {
paragraph5.appendOleObject(stream1, pic1, "doc");
} else if (suffix.equals(".docx")) {
paragraph5.appendOleObject(stream1, pic1, "docx");
}
} else if (suffix.equals(".pdf")) {
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/pdf.png");
paragraph5.appendText(dcContextModel.getFileName());
paragraph5.appendOleObject(stream1, pic1, "pdf");
} else if (suffix.equals(".xls") || suffix.equals(".xlsx")) {
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/xls.png");
paragraph5.appendText(dcContextModel.getFileName());
if (suffix.equals(".xls")) {
paragraph5.appendOleObject(stream1, pic1, "xls");
} else if (suffix.equals(".xlsx")) {
paragraph5.appendOleObject(stream1, pic1, "xlsx");
}
} else if (suffix.equals(".png") || suffix.equals(".jgp")) {
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/png.png");
paragraph5.appendText(dcContextModel.getFileName());
if (suffix.equals(".png")) {
paragraph5.appendOleObject(stream1, pic1, "png");
} else if (suffix.equals(".jpg")) {
paragraph5.appendOleObject(stream1, pic1, "jpg");
}
} else if (suffix.equals(".zip") || suffix.equals(".rar")) {
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/zip.png");
paragraph5.appendText(dcContextModel.getFileName());
if (suffix.equals(".zip")) {
paragraph5.appendOleObject(stream1, pic1, "zip");
} else if (suffix.equals(".rar")) {
paragraph5.appendOleObject(stream1, pic1, "rar");
}
} else if (suffix.equals(".mp3") || suffix.equals(".mp4")) {
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/mp3.png");
paragraph5.appendText(dcContextModel.getFileName());
if (suffix.equals(".mp3")) {
paragraph5.appendOleObject(stream1, pic1, "mp3");
} else if (suffix.equals(".mp4")) {
paragraph5.appendOleObject(stream1, pic1, "mp4");
}
} else if (suffix.equals(".txt")) {
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/txt.png");
paragraph5.appendText(dcContextModel.getFileName());
paragraph5.appendOleObject(stream1, pic1, "txt");
} 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");
}
}
}
}
}
doc.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
}
/**
* 生成word文件
*
* @param dataMap
* @param tempPath
* @param tempName
* @param docName
*/
public static void createBdDoc2(JSONObject dataMap, String tempPath, String tempName, String docName, String repositoryId) throws FileNotFoundException {
Configuration configuration = new Configuration();
configuration.setDefaultEncoding("UTF-8");
// 设置模本装置方法和路径
try {
UtilFile temps = new UtilFile(tempPath);
configuration.setDirectoryForTemplateLoading(temps);
} catch (IOException e2) {
e2.printStackTrace();
}
Template t = null;
try {
t = configuration.getTemplate(tempName, "UTF-8");
} catch (IOException e) {
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();
}
try {
if (t != null && out != null) {
t.process(dataMap, out);
out.flush();
out.close();
}
} catch (TemplateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
/**************************************************插入文件对象**********************************************************************/
Document doc = new Document(outFile.getPath());
//获取最后一节
Section section = doc.getLastSection();
CharacterFormat format4 = new CharacterFormat();
//创建字体格式
format4.setFontName("宋体");
//添加段落
Paragraph paragraph = section.addParagraph();
ParagraphFormat paragraphFormat4 = paragraph.getFormat();
paragraphFormat4.setHorizontalAlignment(HorizontalAlignment.Left);
TextRange tr4 = paragraph.appendText("表单/模板");
tr4.getCharacterFormat().setBold(true);
tr4.getCharacterFormat().setFontName("宋体");
paragraph.applyStyle(BuiltinStyle.Heading_1); //应用标题1样式
//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;
UserContext userContext = DispatcherRequest.getUserContext();
if (search != null && search.size() > 0) {
// 复制附件
for (UpfileModel upfileModel : search) {
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
if (dcProfile != null) {
dcContextModel = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, upfileModel.getPl_uuid(), upfileModel.getShape_uuid(), upfileModel.getFileName());
String path = dcContextModel.getPath();
String fileName = dcContextModel.getFileName();
//添加段落
Paragraph paragraph5 = section.addParagraph();
//加载一个图片它将作为外部文件的符号显示在Word文档中
//获取最后一个.的位置
int lastIndexOf = dcContextModel.getFileName().lastIndexOf(".");
//获取文件的后缀名 .jpg
String suffix = dcContextModel.getFileName().substring(lastIndexOf);
DocPicture pdfIcon = new DocPicture(doc);
InputStream stream1 = new FileInputStream(dcContextModel.getFilePath());
DocPicture pic1 = new DocPicture(doc);
if (suffix.equals(".doc") || suffix.equals(".docx")) {
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/word.png");
paragraph5.appendText(dcContextModel.getFileName());
if (suffix.equals(".doc")) {
paragraph5.appendOleObject(stream1, pic1, "doc");
} else if (suffix.equals(".docx")) {
paragraph5.appendOleObject(stream1, pic1, "docx");
}
} else if (suffix.equals(".pdf")) {
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/pdf.png");
paragraph5.appendText(dcContextModel.getFileName());
paragraph5.appendOleObject(stream1, pic1, "pdf");
} else if (suffix.equals(".xls") || suffix.equals(".xlsx")) {
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/xls.png");
paragraph5.appendText(dcContextModel.getFileName());
if (suffix.equals(".xls")) {
paragraph5.appendOleObject(stream1, pic1, "xls");
} else if (suffix.equals(".xlsx")) {
paragraph5.appendOleObject(stream1, pic1, "xlsx");
}
} else if (suffix.equals(".png") || suffix.equals(".jgp")) {
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/png.png");
paragraph5.appendText(dcContextModel.getFileName());
if (suffix.equals(".png")) {
paragraph5.appendOleObject(stream1, pic1, "png");
} else if (suffix.equals(".jpg")) {
paragraph5.appendOleObject(stream1, pic1, "jpg");
}
} else if (suffix.equals(".zip") || suffix.equals(".rar")) {
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/zip.png");
paragraph5.appendText(dcContextModel.getFileName());
if (suffix.equals(".zip")) {
paragraph5.appendOleObject(stream1, pic1, "zip");
} else if (suffix.equals(".rar")) {
paragraph5.appendOleObject(stream1, pic1, "rar");
}
} else if (suffix.equals(".mp3") || suffix.equals(".mp4")) {
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/mp3.png");
paragraph5.appendText(dcContextModel.getFileName());
if (suffix.equals(".mp3")) {
paragraph5.appendOleObject(stream1, pic1, "mp3");
} else if (suffix.equals(".mp4")) {
paragraph5.appendOleObject(stream1, pic1, "mp4");
}
} else if (suffix.equals(".txt")) {
pic1.loadImage("../doccenter/com.awspaas.user.apps.coe.pal.output.zd/filepic/txt.png");
paragraph5.appendText(dcContextModel.getFileName());
paragraph5.appendOleObject(stream1, pic1, "txt");
} 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");
}
}
}
}
}
doc.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
}
/**
* 将文件的扩展属性设置默认值为空字符串防止没有设置扩展属性而使得导出文件出错
*
@ -1035,7 +399,7 @@ public class OutputWordUtil {
JSONObject dataAttributes = (JSONObject) element.get("attributes");
if (dataAttributes != null) {
JSONArray dataAttributesJsonArray = dataAttributes.getJSONArray("attributesJsonArray");
com.alibaba.fastjson.JSONArray dataAttributesJsonArray = dataAttributes.getJSONArray("attributesJsonArray");
for (int i = 0; i < dataAttributesJsonArray.size(); i++) {
JSONObject dataAttribute = dataAttributesJsonArray.getJSONObject(i);
if (dataAttribute == null || "null".equals(dataAttribute.toString())) {
@ -1084,7 +448,7 @@ public class OutputWordUtil {
* @param relationShapeIds
*/
@Deprecated
public static void setTableValue2(String repositoryId, JSONArray table, String relationShapeIds) {
public static void setTableValue2(String repositoryId, com.alibaba.fastjson.JSONArray table, String relationShapeIds) {
// 记录关联属性的流程节点防止多次查询重复文件信息耗费时间
Set<String> relationFileIds = new HashSet<>();
List<Map<String, Object>> relationFileElements2 = new ArrayList<Map<String, Object>>();
@ -1128,17 +492,17 @@ public class OutputWordUtil {
for (Map<String, Object> element : relationFileElements2) {
String id = (String) element.get("id");
if (relationShapeId.equals(id)) {
JSONObject _tr = new JSONObject();
com.alibaba.fastjson.JSONObject _tr = new com.alibaba.fastjson.JSONObject();
OutputWordUtil.setShapeDefaultValue2((String) element.get("pid"), _tr);
String name = specialCharTransfer(element.get("text").toString());
_tr.put(OutputWordUtil.SHAPE_NAME, name.replace("\n", OutputWordUtil.WRAPSTRING));
_tr.put(OutputWordUtil.SERIAL_NUMBER, index);
JSONObject dataAttributes = (JSONObject) element.get("attributes");
com.alibaba.fastjson.JSONObject dataAttributes = (com.alibaba.fastjson.JSONObject) element.get("attributes");
if (dataAttributes != null) {
JSONArray dataAttributesJsonArray = dataAttributes.getJSONArray("attributesJsonArray");
com.alibaba.fastjson.JSONArray dataAttributesJsonArray = dataAttributes.getJSONArray("attributesJsonArray");
for (int i = 0; i < dataAttributesJsonArray.size(); i++) {
JSONObject dataAttribute = dataAttributesJsonArray.getJSONObject(i);
com.alibaba.fastjson.JSONObject dataAttribute = dataAttributesJsonArray.getJSONObject(i);
if (dataAttribute == null || "null".equals(dataAttribute.toString())) {
continue;
}
@ -1151,7 +515,7 @@ public class OutputWordUtil {
if (!"".equals(privateAttributeContentStr) && !"[]".equals(privateAttributeContentStr)) {
String firstChart = privateAttributeContentStr.substring(0, 1);
if ("{".equals(firstChart)) {
JSONObject privateAttributeContent = dataAttributes.getJSONObject("privateAttributeContent");
com.alibaba.fastjson.JSONObject privateAttributeContent = dataAttributes.getJSONObject("privateAttributeContent");
for (String key : privateAttributeContent.keySet()) {
_tr.put("shape_" + key, specialCharTransfer(privateAttributeContent.getString(key)));
}
@ -1199,6 +563,7 @@ public class OutputWordUtil {
if (!shapeModelMap.containsKey(repositoryShape.getRelationShapeId())) {
continue;
}
String relationFileId = repositoryShape.getRelationFileId();
List<Map<String, Object>> relationFileElements = CoeDesignerUtil.getShapeMessageJson2(relationFileId); // 关联流程文件内容
if (relationFileElements != null) {
@ -1214,11 +579,11 @@ public class OutputWordUtil {
sbRole.append(",");
}
JSONObject dataAttributes = (JSONObject) element.get("attributes");
com.alibaba.fastjson.JSONObject dataAttributes = (com.alibaba.fastjson.JSONObject) element.get("attributes");
if (dataAttributes != null) {
JSONArray dataAttributesJsonArray = dataAttributes.getJSONArray("attributesJsonArray");
com.alibaba.fastjson.JSONArray dataAttributesJsonArray = dataAttributes.getJSONArray("attributesJsonArray");
for (int i = 0; i < dataAttributesJsonArray.size(); i++) {
JSONObject dataAttribute = dataAttributesJsonArray.getJSONObject(i);
com.alibaba.fastjson.JSONObject dataAttribute = dataAttributesJsonArray.getJSONObject(i);
if (dataAttribute == null || "null".equals(dataAttribute.toString())) {
continue;
}
@ -1413,7 +778,7 @@ public class OutputWordUtil {
* @param relationFileElements
*/
@Deprecated
public static void setRelationShapeValueByOrgAndRole(JSONObject _tr, JSONObject dataAttribute,
public static void setRelationShapeValueByOrgAndRole(com.alibaba.fastjson.JSONObject _tr, com.alibaba.fastjson.JSONObject dataAttribute,
Map<String, String> shapeModelMap, List<Map<String, Object>> relationFileElements, String shapeId, Set<String> relationFileIds) {
String key = dataAttribute.getString("key");
if ("organization".equals(dataAttribute.getString("groupPath")) && "relation".equals(dataAttribute.getString("type"))) {
@ -1485,7 +850,7 @@ public class OutputWordUtil {
* @return
*/
@Deprecated
public static void setShapeValue2(JSONObject _tr, JSONObject dataAttribute, Map<String, String> shapeRelationModelMap) {
public static void setShapeValue2(com.alibaba.fastjson.JSONObject _tr, com.alibaba.fastjson.JSONObject dataAttribute, Map<String, String> shapeRelationModelMap) {
String result = "";
String key = dataAttribute.getString("key");
if ("string".equals(dataAttribute.getString("type")) || "textarea".equals(dataAttribute.getString("type"))) {
@ -1599,8 +964,8 @@ public class OutputWordUtil {
return dataJson.getJSONObject("privateAttributeContent").getString("number");
}
}
if (json.get("attributes") instanceof JSONObject) {// fastJson
JSONObject dataJson = (JSONObject) json.get("attributes");
if (json.get("attributes") instanceof com.alibaba.fastjson.JSONObject) {// fastJson
com.alibaba.fastjson.JSONObject dataJson = (com.alibaba.fastjson.JSONObject) json.get("attributes");
if (dataJson.containsKey("privateAttributeContent") && dataJson.get("privateAttributeContent").getClass().getName().contains("JSONObject")) {
return dataJson.getJSONObject("privateAttributeContent").getString("number");
}

View File

@ -1,49 +1,13 @@
package com.actionsoft.apps.coe.pal.pal.repository.designer.relation.web;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import com.actionsoft.apps.AppsConst;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
import com.actionsoft.apps.coe.pal.cooperation.CoeCooperationAPIManager;
import com.actionsoft.apps.coe.pal.cooperation.cache.CooperationCache;
import com.actionsoft.apps.coe.pal.cooperation.cache.model.TeamInfo;
import com.actionsoft.apps.coe.pal.cooperation.cache.model.UserInfo;
import com.actionsoft.apps.coe.pal.pal.manage.publish.constant.PublishConst;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodAttributeModel;
import com.actionsoft.apps.coe.pal.pal.repository.designer.CoeDesignerShapeAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.manager.DesignerShapeCopyCache;
import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl;
import com.actionsoft.apps.coe.pal.pal.repository.web.CoeProcessLevelWeb;
import com.actionsoft.apps.coe.pal.system.util.StringUtil;
import com.actionsoft.apps.coe.pal.util.BpmOrgUtil;
import com.actionsoft.apps.coe.pal.util.HighSecurityUtil;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.commons.cache.Cache;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.commons.formfile.model.delegate.FormFile;
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.commons.security.ac.cache.AccessControlCache;
import com.actionsoft.bpms.commons.security.ac.constant.ACConst;
import com.actionsoft.bpms.commons.security.ac.model.AccessControlModel;
import com.actionsoft.bpms.org.cache.CompanyCache;
import com.actionsoft.bpms.org.cache.DepartmentCache;
import com.actionsoft.bpms.org.cache.RoleCache;
import com.actionsoft.bpms.org.cache.UserCache;
import com.actionsoft.bpms.org.model.*;
import com.actionsoft.bpms.org.web.CompanyWeb;
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.*;
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.PALMethodJsonModel;
import com.actionsoft.apps.coe.pal.pal.method.util.PALMethodUtil;
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
@ -51,11 +15,13 @@ 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.dao.CoeProcessLevelDaoFacotory;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository;
import com.actionsoft.apps.coe.pal.pal.repository.designer.CoeDesignerShapeAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.DesignerShapeRelationCache;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.dao.DesignerShapeRelationDao;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.manager.DesignerRelationShapeCacheManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.manager.DesignerShapeCopyCache;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeCopyModel;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeFileRelationModel;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapePasteModel;
@ -66,9 +32,32 @@ 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.PALRepositoryPropertyModel;
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.ws.web.VersionUtil;
import com.actionsoft.apps.coe.pal.util.BpmOrgUtil;
import com.actionsoft.apps.coe.pal.util.HighSecurityUtil;
import com.actionsoft.apps.coe.pal.util.StringHandleUtil;
import com.actionsoft.apps.coe.pal.util.UtilMapSort;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.commons.cache.Cache;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.commons.formfile.model.delegate.FormFile;
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.commons.security.ac.cache.AccessControlCache;
import com.actionsoft.bpms.commons.security.ac.model.AccessControlModel;
import com.actionsoft.bpms.org.cache.DepartmentCache;
import com.actionsoft.bpms.org.cache.RoleCache;
import com.actionsoft.bpms.org.cache.UserCache;
import com.actionsoft.bpms.org.model.CompanyModel;
import com.actionsoft.bpms.org.model.DepartmentModel;
import com.actionsoft.bpms.org.model.RoleModel;
import com.actionsoft.bpms.org.model.UserModel;
import com.actionsoft.bpms.org.web.CompanyWeb;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.fs.DCContext;
import com.actionsoft.bpms.util.*;
import com.actionsoft.exception.AWSException;
import com.actionsoft.exception.AWSObjectNotFindException;
import com.actionsoft.i18n.I18nRes;
@ -77,7 +66,12 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.hssf.record.DVALRecord;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.*;
import java.util.stream.Collectors;
public class DesignerRelationShapeWeb extends ActionWeb {
private UserContext _uc;
@ -4159,4 +4153,5 @@ public class DesignerRelationShapeWeb extends ActionWeb {
return ro.toString();
}
}

View File

@ -129,18 +129,6 @@ public class UpFileDao {
}
public List<UpfileModel> searchBGroup(String sqlWhere) {
StringBuffer sql = new StringBuffer();
sql.append("select ID,SHAPEID,FILETYPE,DOWNLOAD,PALREPOSITORYID,FILENAME from ").append(UpfileModel.DATABASE_ENTITY).append(" where 1 = 1 ").append(sqlWhere);
try {
return DBSql.query(sql.toString(), new UpfileModelMapper());
} catch (AWSDataAccessException e) {
e.printStackTrace();
}
return new ArrayList<UpfileModel>();
}
private class UpfileModelMapper implements RowMapper<UpfileModel> {
public UpfileModel mapRow(ResultSet rs, int arg1) throws SQLException {
UpfileModel model = new UpfileModel();
@ -210,21 +198,12 @@ public class UpFileDao {
public List<UpfileModel> searchByRepositoryId(String repositoryId, String type) {
StringBuffer sqlWhere = new StringBuffer();
if (!UtilString.isEmpty(type)) {
sqlWhere.append(" and PALREPOSITORYID ='").append(repositoryId).append("' and FILETYPE='").append(type).append("'");
sqlWhere.append(" and PALREPOSITORYID ='").append(repositoryId).append("' and FILETYPE='").append(type).append("'").append(" ").append("order by FILENAME");
}
return search(sqlWhere.toString());
}
public List<UpfileModel> searchByRepositoryIdGroupByFilename(String repositoryId, String type) {
StringBuffer sqlWhere = new StringBuffer();
if (!UtilString.isEmpty(type)) {
sqlWhere.append(" and PALREPOSITORYID ='").append(repositoryId).append("' and FILETYPE='").append(type).append("'").append("GROUP BY ID,SHAPEID,FILETYPE,DOWNLOAD,PALREPOSITORYID,FILENAME");
}
System.out.println("sqlWhere=============" + sqlWhere);
return searchBGroup(sqlWhere.toString());
}
/**
* 按照条件查询
*