From 3d00447255c3fa17ef9c0b589c773ba37671fb19 Mon Sep 17 00:00:00 2001 From: lihongyu <504404568@qq.com> Date: Thu, 1 Dec 2022 14:15:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=8A=E5=88=A9=E9=9B=86=E6=88=90=EF=BC=8C?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9C=8B=E6=9D=BF=E4=BB=A3=E7=A0=81=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CreateFileContorller.java | 38 +- .../controller/GetmeritsController.java | 13 +- .../job/CreategetFlowListALLByWfidJob.java | 7 +- .../job/CreategetFlowListByWfidJob.java | 12 +- .../integration/job/SendOAReadByTaskBo.java | 2 +- .../integration/oauth/TaskController.java | 178 +++- .../user/apps/integration/web/UpfileWeb.java | 188 ++++ .../controller/AttrSynController.java | 41 + .../controller/DataViewController.java | 5 +- .../controller/FileManagementController.java | 41 +- .../apps/yili/reportform/job/SyncData.java | 2 +- .../reportform/service/DataViewService.java | 119 +-- .../reportform/service/DataViewService2.java | 10 +- .../service/FileManagementService.java | 826 +++++++++++------- .../reportform/service/ProcessPubService.java | 136 +-- .../reportform/service/ToPageService.java | 2 +- .../apps/yili/reportform/util/TreeUtil.java | 13 +- 17 files changed, 1089 insertions(+), 544 deletions(-) diff --git a/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/controller/CreateFileContorller.java b/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/controller/CreateFileContorller.java index 64b8a879..bc7b63ef 100644 --- a/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/controller/CreateFileContorller.java +++ b/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/controller/CreateFileContorller.java @@ -1,39 +1,14 @@ package com.awspaas.user.apps.integration.controller; -import com.actionsoft.apps.coe.pal.constant.CoEConstant; -import com.actionsoft.apps.coe.pal.log.CoEOpLogAPI; -import com.actionsoft.apps.coe.pal.log.CoEOpLogConst; -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.model.OutputTaskModel; -import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; -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 java.util.List; + import com.actionsoft.bpms.commons.database.RowMap; -import com.actionsoft.bpms.commons.mvc.view.ResponseObject; 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.conf.server.AWSServerConf; -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.DBSql; -import com.actionsoft.bpms.util.UUIDGener; -import com.actionsoft.bpms.util.UtilFile; -import com.actionsoft.bpms.util.UtilString; -import com.actionsoft.sdk.local.SDK; -import com.alibaba.fastjson.JSONObject; -import com.awspaas.user.apps.integration.event.OutputDCFileProcessor; import com.awspaas.user.apps.integration.web.UpfileWeb; -import java.io.File; -import java.util.LinkedHashMap; -import java.util.List; - /* * 文件阅览界面下载时创建手册 */ @@ -85,9 +60,12 @@ public class CreateFileContorller { if (map!=null){ method = map.getString("PLMETHODID"); } - String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+id+"'" + - ") and FILENAME not like '%.xml'"; + ") and FILENAME not like '%.xml'"; + if("control.policy".equals(method)) { + sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+id+"'" + + ") and FILETYPE = 'f'"; + } List maps = DBSql.getMaps(sql_upfile); String upfile_ids = ""; if (maps.size()>0){ @@ -96,7 +74,7 @@ public class CreateFileContorller { upfile_ids+=rowMap.getString("ID")+","; } } - String zip_url = upfileWeb.readZipFileDownLoad(upfile_ids, title, taskId, method); + String zip_url = upfileWeb.readZipFileDownLoad2(upfile_ids, title, taskId, method); return zip_url; } } diff --git a/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/controller/GetmeritsController.java b/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/controller/GetmeritsController.java index 9d8fd9a3..b6775cc6 100644 --- a/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/controller/GetmeritsController.java +++ b/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/controller/GetmeritsController.java @@ -18,16 +18,7 @@ import java.util.*; public class GetmeritsController { - /** - * 获取页面的方法 - */ - @Mapping("com.awspaas.user.apps.integration.controller.GetmeritsController.getHtml") - public String getHtml(){ - - String html = "territory.html"; - - return HtmlPageTemplate.merge("com.awspaas.user.apps.yili.integration",html,new LinkedHashMap<>()); - } + /** * 这是第一个图的筛选方法 @@ -1523,7 +1514,7 @@ public class GetmeritsController { jsonObject_child_content_3_last.put("content",jsonArray_child_content_3_last); - System.out.println("jsonObject_child_content_3_last>>>>>>>>>>>>>>"+jsonObject_child_content_3_last); + //System.out.println("jsonObject_child_content_3_last>>>>>>>>>>>>>>"+jsonObject_child_content_3_last); jsonArray_child_3_last.add(jsonObject_child_content_3_last); jsonObject_child_3_last.put("child",jsonArray_child_3_last); diff --git a/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/job/CreategetFlowListALLByWfidJob.java b/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/job/CreategetFlowListALLByWfidJob.java index b0263956..932be171 100644 --- a/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/job/CreategetFlowListALLByWfidJob.java +++ b/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/job/CreategetFlowListALLByWfidJob.java @@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.awspaas.user.apps.integration.util.UtilUrl; +import com.awspaas.user.apps.integration.util.UtilUrls; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; @@ -43,15 +44,15 @@ public class CreategetFlowListALLByWfidJob implements IJob { // HttpURLConnection 发送SOAP请求 System.out.println("HttpURLConnection 发送SOAP请求"); - String postSoap = UtilUrl.doPostSoap("http://10.105.1.59:80/services/WorkflowService", xmlStr, ""); + String postSoap = UtilUrls.doPostSoap("http://10.105.1.59:80/services/WorkflowService", xmlStr, ""); Document document = DocumentHelper.parseText(postSoap); Element rootElement = document.getRootElement(); - System.out.println("rootElement>>>>>>"+rootElement); + // System.out.println("rootElement>>>>>>"+rootElement); Element result = rootElement.element("Body").element("getAllWfIdResponse").element("out"); String resultString = result.getData().toString(); - System.out.println("resultString=>>>>>>>>>>"+resultString); + //System.out.println("resultString=>>>>>>>>>>"+resultString); JSONArray jsonArray = JSON.parseArray(resultString); for (int i=0;i\n" + " " + " " + @@ -71,21 +71,21 @@ public class CreategetFlowListByWfidJob implements IJob { // HttpURLConnection 发送SOAP请求 System.out.println("HttpURLConnection 发送SOAP请求"); - String postSoap = UtilUrl.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, ""); + String postSoap = UtilUrls.doPostSoap("http://10.105.1.59:80/services/WorkflowService", xmlStr, ""); Document document = DocumentHelper.parseText(postSoap); Element rootElement = document.getRootElement(); - System.out.println("rootElement>>>>>>"+rootElement); + // System.out.println("rootElement>>>>>>"+rootElement); Element result = rootElement.element("Body").element("getFlowListByWfIdResponse").element("out"); String resultString = result.getData().toString(); - System.out.println("resultString=>>>>>>>>>>"+resultString); + // System.out.println("resultString=>>>>>>>>>>"+resultString); //if (!StringUtils.isEmpty(resultString)){ JSONObject jsonObject1 = JSON.parseObject(resultString); String datas = jsonObject1.getString("datas"); System.out.println(""); JSONArray jsonArray = JSONArray.parseArray(datas); - System.out.println("jsonArrayData》》》》》》》》》》》》"+jsonArray); + // System.out.println("jsonArrayData》》》》》》》》》》》》"+jsonArray); if (jsonArray!=null&&jsonArray.size()!=0){ UserContext userContext = UserContext.fromUID("admin"); for (int i=0;i list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("BINDID=", processInstId).list(); - List lists = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true).addQuery("BINDID=", processInstId).list(); - List list_stop = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S", true).addQuery("BINDID=", processInstId).list(); + List list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("BINDID=", processInstId).orderByCreated().asc().list(); + List lists = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true).addQuery("BINDID=", processInstId).orderByCreated().asc().list(); + List list_stop = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S", true).addQuery("BINDID=", processInstId).orderByCreated().asc().list(); int num = 1; //发布 @@ -271,6 +271,70 @@ public class TaskController { jsonObject.put("taskId", id); jsonObject.put("id", bo.getString("PUBLISHFILEID")); jsonArray.add(jsonObject); + + + String sql_upfile ="select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"'" + ") ORDER BY CREATETIME ASC"; + String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"'"); + if(UtilString.isNotEmpty(methodId)) { + if(methodId.equals("control.policy")) { + sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"') AND FILETYPE = 'f' ORDER BY CREATETIME ASC"; + } + } + //String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"') AND FILETYPE = 'f'"; + List maps = DBSql.getMaps(conn,sql_upfile); + UserContext userContext = UserContext.fromSessionId(sid); + UpfileWeb upfileWeb = new UpfileWeb(userContext); + + for (RowMap row : maps) { + UpfileModel upfileModel = new UpfileModel(); + upfileModel.setType(row.getString("FILETYPE")); + upfileModel.setFileName(row.getString("FILENAME")); + upfileModel.setPl_uuid(row.getString("PALREPOSITORYID")); + upfileModel.setShape_uuid(row.getString("SHAPEID")); + DCContext dcContexts = upfileWeb.getDCContext(upfileModel); + Map params_previews = new HashMap(); + //文档是否允许下载,必填 + params_previews.put("isDownload", true); + //显示文件名,必填 + params_previews.put("fileNameOriginal", row.getString("FILENAME")); + //PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填 + params_previews.put("isPDFCovertPNG", 0); + //groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填 + params_previews.put("extParams", ""); + //文档是否允许打印,必填 + params_previews.put("isPrint", true); + //是否显示顶部工具栏的返回按钮,默认显示,非必填 + params_previews.put("isShowBackbtn", ""); + //原文件DC,必填 + params_previews.put("sourceDc", dcContexts); + //是否显示默认预览工具栏,必填 + params_previews.put("isShowDefaultToolbar", true); + //文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填 + params_previews.put("isCopy", true); + //sessionid,必填 + params_previews.put("sid", sid); + //文档是否加密,必填 + params_previews.put("isEncrypt", false); + AppAPI appAPIs = SDK.getAppAPI(); + //文档预览 + ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processInstId); + String sourceAppId = instanceById.getAppId(); + String aslp = "aslp://com.actionsoft.apps.addons.onlinedoc/filePreview"; + ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, params_previews); + JSONObject jsonObject1 = new JSONObject(); + jsonObject1.put("title",row.getString("FILENAME")); + String base_url = "https://bpm.yili.com:8088/portal/r"; + if (row.getString("FILENAME").toString().contains(".xls")||row.getString("FILENAME").toString().contains(".xlsx")){ + jsonObject1.put("link",ros.get("url").toString().substring(0)); + }else { + jsonObject1.put("link",base_url+ros.get("url").toString().substring(1)); + } + // jsonObject1.put("size","12k"); + jsonArray.add(jsonObject1); + } + + + num++; } @@ -310,6 +374,68 @@ public class TaskController { jsonObject.put("id", bo.get("CHANGEDFILEIDNEW")); jsonObject.put("taskId", id); jsonArray.add(jsonObject); + + String sql_upfile ="select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"'" + ") ORDER BY CREATETIME ASC"; + String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"'"); + if(UtilString.isNotEmpty(methodId)) { + if(methodId.equals("control.policy")) { + sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"') AND FILETYPE = 'f' ORDER BY CREATETIME ASC"; + } + } + //String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"') AND FILETYPE = 'f'"; + List maps = DBSql.getMaps(conn,sql_upfile); + UserContext userContext = UserContext.fromSessionId(sid); + UpfileWeb upfileWeb = new UpfileWeb(userContext); + + for (RowMap row : maps) { + UpfileModel upfileModel = new UpfileModel(); + upfileModel.setType(row.getString("FILETYPE")); + upfileModel.setFileName(row.getString("FILENAME")); + upfileModel.setPl_uuid(row.getString("PALREPOSITORYID")); + upfileModel.setShape_uuid(row.getString("SHAPEID")); + DCContext dcContexts = upfileWeb.getDCContext(upfileModel); + Map params_previews = new HashMap(); + //文档是否允许下载,必填 + params_previews.put("isDownload", true); + //显示文件名,必填 + params_previews.put("fileNameOriginal", row.getString("FILENAME")); + //PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填 + params_previews.put("isPDFCovertPNG", 0); + //groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填 + params_previews.put("extParams", ""); + //文档是否允许打印,必填 + params_previews.put("isPrint", true); + //是否显示顶部工具栏的返回按钮,默认显示,非必填 + params_previews.put("isShowBackbtn", ""); + //原文件DC,必填 + params_previews.put("sourceDc", dcContexts); + //是否显示默认预览工具栏,必填 + params_previews.put("isShowDefaultToolbar", true); + //文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填 + params_previews.put("isCopy", true); + //sessionid,必填 + params_previews.put("sid", sid); + //文档是否加密,必填 + params_previews.put("isEncrypt", false); + AppAPI appAPIs = SDK.getAppAPI(); + //文档预览 + ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processInstId); + String sourceAppId = instanceById.getAppId(); + String aslp = "aslp://com.actionsoft.apps.addons.onlinedoc/filePreview"; + ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, params_previews); + JSONObject jsonObject1 = new JSONObject(); + jsonObject1.put("title",row.getString("FILENAME")); + String base_url = "https://bpm.yili.com:8088/portal/r"; + if (row.getString("FILENAME").toString().contains(".xls")||row.getString("FILENAME").toString().contains(".xlsx")){ + jsonObject1.put("link",ros.get("url").toString().substring(0)); + }else { + jsonObject1.put("link",base_url+ros.get("url").toString().substring(1)); + } + // jsonObject1.put("size","12k"); + jsonArray.add(jsonObject1); + } + + num++; } @@ -438,9 +564,9 @@ public class TaskController { String substring = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId).addQuery("OPTIONTYPE IS NOT NULL",null).detail().getString("RELEASE_INSTRUCTIONS"); BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId).addQuery("OPTIONTYPE IS NOT NULL",null).detail(); - List list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("BINDID=", processInstId).list(); - List lists = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true).addQuery("BINDID=", processInstId).list(); - List list_stop = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S", true).addQuery("BINDID=", processInstId).list(); + List list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("BINDID=", processInstId).orderByCreated().asc().list(); + List lists = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true).addQuery("BINDID=", processInstId).orderByCreated().asc().list(); + List list_stop = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S", true).addQuery("BINDID=", processInstId).orderByCreated().asc().list(); int num = 1; for (BO bo:list) { @@ -514,9 +640,14 @@ public class TaskController { - - String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"'" + - ")"; + String sql_upfile ="select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"'" + ") ORDER BY CREATETIME ASC"; + String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"'"); + if(UtilString.isNotEmpty(methodId)) { + if(methodId.equals("control.policy")) { + sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"') AND FILETYPE = 'f' ORDER BY CREATETIME ASC"; + } + } + //String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"') AND FILETYPE = 'f'"; List maps = DBSql.getMaps(conn,sql_upfile); UserContext userContext = UserContext.fromSessionId(sid); UpfileWeb upfileWeb = new UpfileWeb(userContext); @@ -647,8 +778,19 @@ public class TaskController { - String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("STOPFILEID")+"'" + - ")"; + /* + * String sql_upfile = + * "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '" + * +bo.getString("STOPFILEID")+"'" + ")"; + */ + String sql_upfile ="select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("STOPFILEID")+"'" + ") ORDER BY CREATETIME ASC"; + String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("STOPFILEID")+"'"); + if(UtilString.isNotEmpty(methodId)) { + if(methodId.equals("control.policy")) { + sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("STOPFILEID")+"') AND FILETYPE = 'f' ORDER BY CREATETIME ASC"; + } + } + //String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("STOPFILEID")+"') AND FILETYPE = 'f'"; List maps = DBSql.getMaps(conn,sql_upfile); UserContext userContext = UserContext.fromSessionId(sid); UpfileWeb upfileWeb = new UpfileWeb(userContext); @@ -773,11 +915,15 @@ public class TaskController { } - - - - String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("CHANGEDFILEIDNEW")+"'" + - ")"; + + String sql_upfile ="select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("CHANGEDFILEIDNEW")+"'" + ") ORDER BY CREATETIME ASC"; + String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("CHANGEDFILEIDNEW")+"'"); + if(UtilString.isNotEmpty(methodId)) { + if(methodId.equals("control.policy")) { + sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("CHANGEDFILEIDNEW")+"') AND FILETYPE = 'f' ORDER BY CREATETIME ASC"; + } + } + List maps = DBSql.getMaps(conn,sql_upfile); UserContext userContext = UserContext.fromSessionId(sid); UpfileWeb upfileWeb = new UpfileWeb(userContext); diff --git a/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/web/UpfileWeb.java b/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/web/UpfileWeb.java index ff253ca5..e37bab84 100644 --- a/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/web/UpfileWeb.java +++ b/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/web/UpfileWeb.java @@ -480,9 +480,197 @@ public class UpfileWeb extends ActionWeb { return ro.toString(); } + + + /** + * 压缩附件下载功能 + * + * @param uuid + * @return + * @author zhaolei + */ + public String readZipFileDownLoad2(String splitId,String toolbarname,String taskId,String methodId) throws Exception { + + + UserContext me = super.getContext(); + ResponseObject ro = ResponseObject.newOkResponse(); + UpFileDao upfileDao = new UpFileDao(); + + try { + long times = System.currentTimeMillis(); + final String zipName = "批量下载"+ toolbarname + ".zip"; + String targetDir = AWSServerConf.getProperty("dc.path") + File.separator + "com.actionsoft.apps.coe.pal" + File.separator + "tmp/grouppackage/zip" + times + "/"; + File targetFileDir = new File(targetDir); + if (!targetFileDir.exists()) { + targetFileDir.mkdirs(); + } + + // 查找对应应用下模版 + if(UtilString.isNotEmpty(splitId)) { + String[] uuidSpilt=splitId.split(","); + if(uuidSpilt.length>0){ + for(String oneuuid:uuidSpilt){ + UpfileModel upfileModel = upfileDao.get(oneuuid); + DCContext dcContext = getDCContext(upfileModel); + + String filemodelName=null; + OutputTaskModel model = new OutputTask().getTaskReportById(taskId); + UtilFile file = OutputAPIManager.getInstance().getFilePath(model.getWsId(), taskId, model.getProfileId()); + if (file.exists()) { + File[] fileList = file.listFiles(); + if (fileList.length > 0) { + File docFile1 = null; + for (File file2 : fileList) { + if (file2.isFile() && "doc".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1)))) { + docFile1 = file2; + break; + } + } + if (docFile1 == null) { + return ResponseObject.newErrResponse("没有找到文件").toString(); + } + filemodelName= docFile1.getName(); + } + } + + if(UtilString.isNotEmpty(filemodelName)){ + filemodelName=filemodelName.substring(0, filemodelName.lastIndexOf(".")); + //判断文件目录是否存在,不存在则创建 + String bdir=targetDir + File.separator+filemodelName+"_file"+File.separator; + File targetFile1 = new File(bdir); + if (!targetFile1.exists()) { + targetFile1.mkdirs(); + } + File targetFile = new File(bdir + dcContext.getFileName()); + if (!targetFile.exists()) { + targetFile.createNewFile(); + } + OutputStream out = new FileOutputStream(targetFile); + InputStream in = DCUtil.decryptFile(dcContext); + if (in == null) { + String msg = "+ dcContext.getFileName() + "; + if (dcContext.getDCMessage() != null) { + msg = dcContext.getDCMessage().getMessage(); + } + return ResponseObject.newErrResponse(msg).toString(); + } + try { + IOUtils.copy(in, out); + in.close(); + out.close(); + } finally { + IOUtils.closeQuietly(in); + IOUtils.closeQuietly(out); + } + }else{ + return ResponseObject.newErrResponse("没有找到文件").toString(); + } + } + } + } + + //流程手册打包 + if (UtilString.isNotEmpty(taskId)) { + OutputTaskModel model = new OutputTask().getTaskReportById(taskId); + 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() && "doc".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1)))) { + docFile = file2; + break; + } + } + if (docFile == null) { + return ResponseObject.newErrResponse("没有找到文件").toString(); + } + + String sourceAppId = null; + if (methodId.equals("data.form")) { + sourceAppId = "com.awspaas.user.apps.coe.pal.output.bd"; + } + if (methodId.indexOf("process.") > -1) { + sourceAppId="com.actionsoft.apps.coe.pal.output.pr"; + } + if (methodId.equals("control.policy")) { + sourceAppId = "com.awspaas.user.apps.coe.pal.output.zd"; + } + String filename = docFile.getName(); + DCContext sourceDc = new DCContext(_uc, DCProfileManager.getDCProfile(sourceAppId, "output"), sourceAppId, model.getWsId(), taskId, filename); + + File targetFile = new File(targetDir + filename); + if (!targetFile.exists()) { + targetFile.createNewFile(); + } + OutputStream out = new FileOutputStream(targetFile); + InputStream in = DCUtil.decryptFile(sourceDc); + if (in == null) { + String msg = "+ dcContext.getFileName() + "; + if (sourceDc.getDCMessage() != null) { + msg = sourceDc.getDCMessage().getMessage(); + } + return ResponseObject.newErrResponse(msg).toString(); + } + try { + IOUtils.copy(in, out); + in.close(); + out.close(); + } finally { + IOUtils.closeQuietly(in); + IOUtils.closeQuietly(out); + } + + } + } + } catch (Exception e) { + e.printStackTrace(); + return ResponseObject.newErrResponse().toString(); + } + } + + + } + + + UtilFile.zipCompress(targetDir, new File(targetDir + zipName)); + + File[] files = targetFileDir.listFiles(new FilenameFilter() + { + @Override + public boolean accept(File dir, String name) { + if (name.equals(zipName)) { + return false; + } + return true; + } + }); + for (File file : files) { + try { + file.delete(); + } catch (Exception exception) {} + } + + DCContext zipDcContext = new DCContext(getContext(), DCProfileManager.getDCProfile("com.actionsoft.apps.coe.pal", "tmp"), "com.actionsoft.apps.coe.pal", "grouppackage", "zip" + times, zipName); + + String downUrl=SDK.getConfAPI().getPortalUrl() + "/r/" + zipDcContext.getDownloadURL().replace("./", ""); + ro.put("url",downUrl); + return ro.toString(); + + } catch (Exception e) { + e.printStackTrace(); + return ResponseObject.newErrResponse((e.getMessage() == null) ? e.getCause().getMessage() : e.getMessage()).toString(); + } + + } + + /** * 压缩附件下载功能 * diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/AttrSynController.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/AttrSynController.java index be0682a1..4165feb6 100644 --- a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/AttrSynController.java +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/AttrSynController.java @@ -1,10 +1,17 @@ package com.awspaas.user.apps.yili.reportform.controller; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate; 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.alibaba.fastjson.JSONObject; import com.awspaas.user.apps.yili.reportform.service.AttrSynService; +import com.awspaas.user.apps.yili.reportform.util.JwtUtils; /** @@ -19,5 +26,39 @@ public class AttrSynController { public String incrementSyn(UserContext uc, RequestParams params) { return new AttrSynService().incrementSyn(uc,params); } + + + + /** + * 流程运行看板领域流程绩效看板 + */ + + @Mapping("com.awspaas.user.apps.integration.controller.GetmeritsController.getHtml") + public String getHtml(String sid) { + LinkedHashMap map = new LinkedHashMap<>(); + map.put("sid", sid); + String html = "territory.html"; + return HtmlPageTemplate.merge("com.awspaas.user.apps.yili.integration", html, new LinkedHashMap<>()); + } + + + @Mapping(value = "com.awspaas.user.apps.yili.reportform.service.getToken") + public JSONObject achievements(String sid) { + UserContext fromSessionId = UserContext.fromSessionId(sid); + System.err.println("=====fromSessionId======="+fromSessionId); + JSONObject result = new JSONObject(); + Map claims = new HashMap<> (); + claims.put("userName","10036614"); + //生成token + String jwt_token = JwtUtils.getAccessToken ("userId",claims); + System.out.println ("jwt_token="+jwt_token); + String username = JwtUtils.getUserName (jwt_token); + System.out.println ("userName="+username); + result.put("token", jwt_token); + result.put("uid", username); + return result; + } + + } diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/DataViewController.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/DataViewController.java index 51d620d4..a1409abf 100644 --- a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/DataViewController.java +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/DataViewController.java @@ -7,6 +7,7 @@ import com.actionsoft.bpms.server.bind.annotation.Mapping; import com.actionsoft.bpms.util.DBSql; import com.actionsoft.sdk.local.SDK; import com.awspaas.user.apps.yili.reportform.service.DataViewService; +import com.awspaas.user.apps.yili.reportform.service.DataViewService2; import com.awspaas.user.apps.yili.reportform.service.ToPageService; import java.sql.Connection; @@ -67,10 +68,6 @@ public class DataViewController { desc = "部门视图") public String deptView(UserContext uc, RequestParams params) { String deptViewVal = deptViewVal = new DataViewService(uc).deptView(uc, params); - try { - } catch (Exception e) { - SDK.getLogAPI().consoleErr("deptView异常"); - } return deptViewVal; } } diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/FileManagementController.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/FileManagementController.java index 4eeb8b87..2680ed31 100644 --- a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/FileManagementController.java +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/FileManagementController.java @@ -1,5 +1,6 @@ package com.awspaas.user.apps.yili.reportform.controller; +import com.actionsoft.bpms.commons.database.RowMap; import com.actionsoft.bpms.server.RequestParams; import com.actionsoft.bpms.server.UserContext; import com.actionsoft.bpms.server.bind.annotation.Controller; @@ -9,6 +10,8 @@ import com.actionsoft.sdk.local.SDK; import com.awspaas.user.apps.yili.reportform.service.FileManagementService; import java.sql.Connection; +import java.text.ParseException; +import java.util.List; /** * @author:Lizj @@ -32,13 +35,7 @@ public class FileManagementController { @Mapping(value = "com.awspaas.user.apps.yili.reportform.service.FileManagementService_queryTerms5", desc = "制度管理看板筛选条件 文件类型、发布单位、所属领域") public String queryTerms5(UserContext uc, RequestParams params) { - String queryTerms5Val = null; - try { - queryTerms5Val = new FileManagementService(uc).queryTerms5(uc, params); - } catch (Exception e) { - SDK.getLogAPI().consoleErr("queryTerms5异常"); - } - return queryTerms5Val; + return new FileManagementService(uc).queryTerms5(uc, params); } @Mapping(value = "com.awspaas.user.apps.yili.reportform.service.FileManagementService_fileStatistics", desc = "制度管理看板") @@ -48,29 +45,19 @@ public class FileManagementController { @Mapping(value = "com.awspaas.user.apps.yili.reportform.service.FileManagementService_deptFileCount", desc = "部门文件数量") public String deptFileCount(UserContext uc, RequestParams params) { - String deptFileCountVal = null; - try { - deptFileCountVal = new FileManagementService(uc).deptFileCount(uc, params); - } catch (Exception e) { - SDK.getLogAPI().consoleErr("deptFileCount异常:"+e.toString()); - } - return deptFileCountVal; + List fileRowMaps = DBSql.getMaps("SELECT FILEID,PUBDEPT,PLPARENTID,PLMETHODID,POLICYTYPE,FILESTATE,VIEWCOUNT FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' OR PLMETHODID='process.flowchart' OR PLMETHODID='control.policy' OR PLMETHODID='data.form'"); + return new FileManagementService(uc).deptFileCount(uc, params,fileRowMaps); } @Mapping(value = "com.awspaas.user.apps.yili.reportform.service.FileManagementService_deptFileYearRenewRate", desc = "部门文件年度更新率") public String deptFileYearRenewRate(UserContext uc, RequestParams params) { - return new FileManagementService(uc).deptFileYearRenewRate(uc, params); + List fileRowMaps = DBSql.getMaps("SELECT FILEID,PUBDEPT,PLPARENTID,PLMETHODID,POLICYTYPE,FILESTATE,VIEWCOUNT FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' OR PLMETHODID='process.flowchart' OR PLMETHODID='control.policy' OR PLMETHODID='data.form'"); + return new FileManagementService(uc).deptFileYearRenewRate(uc, params,fileRowMaps); } @Mapping(value = "com.awspaas.user.apps.yili.reportform.service.FileManagementService_deptFileYearRenewSituation", desc = "部门文件年度更新情况") public String deptFileYearRenewSituation(UserContext uc, RequestParams params) { - String deptFileYearRenewSituationVal = null; - try { - deptFileYearRenewSituationVal = new FileManagementService(uc).deptFileYearRenewSituation(uc, params); - } catch (Exception e) { - SDK.getLogAPI().consoleErr("deptFileYearRenewSituation异常:"+e.toString()); - } - return deptFileYearRenewSituationVal; + return new FileManagementService(uc).deptFileYearRenewSituation(uc, params); } @Mapping(value = "com.awspaas.user.apps.yili.reportform.service.FileManagementService_queryTerms6", desc = "文件发布时间分布筛选条件:发布单位、所属领域") @@ -85,14 +72,8 @@ public class FileManagementController { } @Mapping(value = "com.awspaas.user.apps.yili.reportform.service.FileManagementService_filePubTimeDistribution", desc = "文件发布时间分布") - public String filePubTimeDistribution(UserContext uc, RequestParams params) { - String filePubTimeDistributionVal = null; - try { - filePubTimeDistributionVal = new FileManagementService(uc).filePubTimeDistribution(uc, params); - } catch (Exception e) { - SDK.getLogAPI().consoleErr("filePubTimeDistribution异常"); - } - return filePubTimeDistributionVal; + public String filePubTimeDistribution(UserContext uc, RequestParams params) throws ParseException { + return new FileManagementService(uc).filePubTimeDistribution(uc, params); } @Mapping(value = "com.awspaas.user.apps.yili.reportform.service.FileManagementService_queryTerms7", desc = "引用情况分析筛选条件:发布单位、所属领域、文件类型") diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData.java index dfc93d20..72e8accd 100644 --- a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData.java +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData.java @@ -41,7 +41,7 @@ public class SyncData implements IJob { @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - + SDK.getLogAPI().consoleInfo("全量定时同步文件信息开始执行"); long startTime = System.currentTimeMillis(); Date nowDateJ = new Date(System.currentTimeMillis()); diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService.java index 398c5a03..d43691eb 100644 --- a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService.java +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService.java @@ -26,6 +26,7 @@ import com.actionsoft.bpms.commons.mvc.view.ResponseObject; import com.actionsoft.bpms.server.RequestParams; import com.actionsoft.bpms.server.UserContext; import com.actionsoft.bpms.util.DBSql; +import com.actionsoft.bpms.util.UtilString; import com.actionsoft.sdk.local.SDK; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -140,7 +141,7 @@ public class DataViewService extends ActionWeb { } } nodeType = "position"; - List deptTreeNodes = TreeUtil.buildTree(deptNodes, null, "dept", null, nodeType); + List deptTreeNodes = TreeUtil.buildTree("0",deptNodes, null, "dept", null, nodeType); ro.put("positionTree", deptTreeNodes); return ro.toString(); } @@ -194,8 +195,8 @@ public class DataViewService extends ActionWeb { Integer aNum = 0; Integer bNum = 0; Object[] sqlParams = new Object[] {}; - List fileRowMaps = DBSql.getMaps( - "SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' AND FILESTATE='1' ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC"); + //List fileRowMaps = DBSql.getMaps("SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' AND FILESTATE='1' ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC"); + List fileRowMaps = DBSql.getMaps("SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' AND FILESTATE='1' ORDER BY PLLEVEL ASC, PLORDERINDEX ASC"); // AND FILESTATE='1' ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) // ASC if (null != positionIDs && !positionIDs.isEmpty()) { @@ -860,15 +861,8 @@ public class DataViewService extends ActionWeb { tempMaps.addAll(reYSMaps); } } - - - //所有数据 UoPProcessMaps.addAll(tempMaps); - - - - if (UoPProcessMaps.size() > 1) { for (Map uoPProcessMap : UoPProcessMaps) { if (String.valueOf(uoPProcessMap.get("fileType")).equals("UoPProcess")) { @@ -977,7 +971,7 @@ public class DataViewService extends ActionWeb { deptNode.put("nodeType", nodeType); deptNodes.add(deptNode); } - List deptTreeNodes = TreeUtil.buildTree(deptNodes, "0", "dept", "3", null); + List deptTreeNodes = TreeUtil.buildTree("0",deptNodes, "0", "dept", "3", null); ro.put("deptTree", deptTreeNodes); // 文件类型查询 HashMap fileType = new HashMap<>(); @@ -1024,7 +1018,7 @@ public class DataViewService extends ActionWeb { String deptString = params.get("dept"); String fileType = params.get("fileType"); ArrayList deptIDList = new ArrayList<>(); - String sql = "SELECT ID AS FILEID,PLNAME,PLPARENTID,PLMETHODID,PLLEVEL,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE ISPUBLISH = 1 AND ISUSE =1 AND ISSTOP =0 AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart')"; + String sql = "SELECT ID AS FILEID,PLNAME,PLPARENTID,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE ISPUBLISH = 1 AND ISSTOP =0 AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart')"; ArrayList fileHandleRowMaps = new ArrayList<>(); Map reFileMap = new HashMap<>(); RowMap reFileRowMap = new RowMap(reFileMap); @@ -1046,46 +1040,67 @@ public class DataViewService extends ActionWeb { deptString = deptIDList.toString(); } } + System.err.println("=====查询部门视图======"+fileListMap.size()); for (RowMap rowMap : fileListMap) { + String id = rowMap.getString("FILEID"); + /* + * String plVersionId = rowMap.getString("PLVERSIONID"); String sqly + * ="SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '" + * +plVersionId+"'"; List maps = DBSql.getMaps(sql); if(maps.size()>1) { + * String sqlu = + * "SELECT ID FROM (SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '" + * +plVersionId+"' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2"; + * String palId = DBSql.getString(sqlu); if(UtilString.isNotEmpty(palId)) { + * if(!id.equals(palId)) { continue; } } } + */ PALRepositoryModel model = PALRepositoryCache.getCache().get(id); - Integer PLLEVEL = model.getLevel(); - String methodId = model.getMethodId(); - Map queryRepositoryAttributeById = new RepositoryAttribute() - .queryRepositoryAttributeById(model.getId()); - if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) { - // 发布部门 - JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department"); - if (null != Issuing_department && !Issuing_department.equals("")) { - JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value"); - if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) { - for (Object PUBDEPTO : PUBDEPTJA) { - JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO)); - dempId = PUBDEPTJO.getString("id"); - if (deptString.contains(dempId)) { - // 默认添加所在部门的所有文件 - fileHandleRowMaps.add(rowMap); - if ("process.epc".equals(methodId) || "process.flowchart".equals(methodId)) { - // 支持文件 - getArrt("support_files", model, dempId, PLLEVEL, reFileRowMap, - fileHandleRowMaps); - // 相关文件 - getArrt("R_relevant_flies", model, dempId, PLLEVEL, reFileRowMap, - fileHandleRowMaps); - } else if ("control.policy".equals(methodId)) { - // 支持文件 - getArrt("support_files", model, dempId, PLLEVEL, reFileRowMap, - fileHandleRowMaps); - // 相关文件 - getArrt("related_files", model, dempId, PLLEVEL, reFileRowMap, - fileHandleRowMaps); + if(model!=null) { + try { + Integer PLLEVEL = model.getLevel(); + String methodId = model.getMethodId(); + + Map queryRepositoryAttributeById = new RepositoryAttribute().queryRepositoryAttributeById(model.getId()); + if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) { + // 发布部门 + JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department"); + if (null != Issuing_department && !Issuing_department.equals("")) { + JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value"); + if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) { + for (Object PUBDEPTO : PUBDEPTJA) { + JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO)); + dempId = PUBDEPTJO.getString("id"); + if (deptString.contains(dempId)) { + // 默认添加所在部门的所有文件 + fileHandleRowMaps.add(rowMap); + if ("process.epc".equals(methodId) || "process.flowchart".equals(methodId)) { + // 支持文件 + getArrt("support_files", model, dempId, PLLEVEL, reFileRowMap, + fileHandleRowMaps); + // 相关文件 + getArrt("R_relevant_flies", model, dempId, PLLEVEL, reFileRowMap, + fileHandleRowMaps); + } else if ("control.policy".equals(methodId)) { + // 支持文件 + getArrt("support_files", model, dempId, PLLEVEL, reFileRowMap, + fileHandleRowMaps); + // 相关文件 + getArrt("related_files", model, dempId, PLLEVEL, reFileRowMap, + fileHandleRowMaps); + } + } + } } - } + } + } catch (Exception e) { + + System.err.println("==有问题的模型===>"+model.getName()); + // TODO: handle exception } - + } } @@ -1094,9 +1109,12 @@ public class DataViewService extends ActionWeb { // System.err.println("------测试1---------" + fileHandleRowMaps); // System.err.println("------测试2---------" + fileRowMaps); // System.out.println("代码段执行时间:" + (endTime - startTime) + "ms"); + //System.err.println("=========fileRowMaps1========>"+fileRowMaps); + //System.err.println("=========fileType========>"+fileType); if (null != fileRowMaps && fileRowMaps.size() > 0) { if (null != fileType && !fileType.equals("")) { fileHandleRowMaps = new ArrayList<>(); + //System.err.println("=====fileRowMaps2========"+fileRowMaps); if (null != fileRowMaps && !fileRowMaps.isEmpty()) { for (RowMap fileRowMap : fileRowMaps) { if (fileType.equals("processFile")) { @@ -1153,6 +1171,7 @@ public class DataViewService extends ActionWeb { // reFileRowMap); } fileRowMaps = fileHandleRowMaps; + //System.err.println("=======fileRowMaps========="+fileRowMaps); // 遍历选择的结果 List fileMaps = new ArrayList<>(); List frameRowMaps = new ArrayList<>(); @@ -1191,6 +1210,7 @@ public class DataViewService extends ActionWeb { toCollection( () -> new TreeSet<>(Comparator.comparing(o -> o.getString("FRAMEID")))), ArrayList::new)); + for (RowMap frameRowMap : frameRowMaps) { frameMap = new HashMap(); nodeType = "frame"; @@ -1202,7 +1222,7 @@ public class DataViewService extends ActionWeb { frameMap.put("nodeType", nodeType); fileMaps.add(frameMap); } - /// System.err.println("=====fileRowMaps1=====>" + fileRowMaps); + //System.err.println("=====fileRowMaps1=====>" + fileRowMaps); for (RowMap fileRowMap : fileRowMaps) { fileMap = new HashMap(); @@ -1240,13 +1260,14 @@ public class DataViewService extends ActionWeb { fileMap.put("PUBDATETIME", fileRowMap.getString("PUBDATETIME")); fileMap.put("path", path); fileMap.put("ORDERINDEX", fileRowMap.getString("PLORDERINDEX")); - fileMap.put("TLEVEL", fileRowMap.getString("PLLEVEL")); + String sqlsss = "SELECT PLLEVEL FROM APP_ACT_COE_PAL_REPOSITORY_1124 WHERE ID = '"+fileRowMap.getString("FILEID")+"'"; + String leve = DBSql.getString(sqlsss); + fileMap.put("TLEVEL",leve); fileMap.put("nodeType", nodeType); fileMaps.add(fileMap); } - // System.err.println("=====fileMaps=====>" + fileMaps); - // System.err.println("=====返回参数4======>" + ro.toString()); - List fileTreeNodes = TreeUtil.buildTree(fileMaps, "process", "frame", null, null); + //System.err.println("=====fileMaps=====>" + fileMaps); + List fileTreeNodes = TreeUtil.buildTree("0",fileMaps, "process", "frame", null, null); filesCount = new LinkedHashMap<>(); filesCount.put("processFileNum", processFileNum); filesCount.put("policyFileNum", policyFileNum); diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService2.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService2.java index e8b8a9c7..073f84f4 100644 --- a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService2.java +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService2.java @@ -125,7 +125,7 @@ public class DataViewService2 extends ActionWeb { } } nodeType = "position"; - List deptTreeNodes = TreeUtil.buildTree(deptNodes,null,"dept",null,nodeType); + List deptTreeNodes = TreeUtil.buildTree("0",deptNodes,null,"dept",null,nodeType); ro.put("positionTree", deptTreeNodes); return ro.toString(); } @@ -887,7 +887,7 @@ public class DataViewService2 extends ActionWeb { deptNode.put("nodeType", nodeType); deptNodes.add(deptNode); } - List deptTreeNodes = TreeUtil.buildTree(deptNodes,"0","dept","3",null); + List deptTreeNodes = TreeUtil.buildTree("0",deptNodes,"0","dept","3",null); ro.put("deptTree", deptTreeNodes); //文件类型查询 HashMap fileType = new HashMap<>(); @@ -936,7 +936,7 @@ public class DataViewService2 extends ActionWeb { // AND FILESTATE='1' ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC List fileRowMaps = DBSql.getMaps("SELECT BF.FILEID,BF.PLNAME,BF.PLPARENTID,BF.PLMETHODID,BF.PUBDEPT,BF.PLLEVEL,BF.PLORDERINDEX,BF.SUPPORTFILE,BF.POLICYTYPE,BF.L1ID,PF.FRAMEID,PF.FRAMETYPE FROM BO_EU_PAL_FILE1 BF LEFT JOIN BO_EU_PAL_FRAME PF ON BF.L1ID=PF.FRAMEID" + " WHERE (BF.PLMETHODID='process.epc' OR BF.PLMETHODID='process.flowchart' OR BF.PLMETHODID='control.policy') AND " - + " BF.L1ID IS NOT NULL AND FILESTATE='1' AND PLNAME in ('关于各单位会计人员参加年度继续教育及相关费用报销事宜的通知','事业部预算追加与调整流程(集团部分)') ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC"); + + " BF.L1ID IS NOT NULL AND FILESTATE='1' ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC"); String sql = "SELECT ID as FILEID,PLNAME,PLPARENTID,PLMETHODID,PLLEVEL, from APP_ACT_COE_PAL_REPOSITORY where ISPUBLISH = 1 WHERE (.PLMETHODID='process.epc' OR PLMETHODID='process.flowchart' OR PLMETHODID='control.policy') AND PLNAME in ('关于各单位会计人员参加年度继续教育及相关费用报销事宜的通知'"; @@ -1163,7 +1163,7 @@ public class DataViewService2 extends ActionWeb { fileMap.put("nodeType", nodeType); fileMaps.add(fileMap); } - List fileTreeNodes = TreeUtil.buildTree(fileMaps,"process","frame",null,null); + List fileTreeNodes = TreeUtil.buildTree("0",fileMaps,"process","frame",null,null); filesCount = new LinkedHashMap<>(); filesCount.put("processFileNum", processFileNum); filesCount.put("policyFileNum", policyFileNum); @@ -1342,7 +1342,7 @@ public class DataViewService2 extends ActionWeb { fileMaps.add(fileMap); } - List fileTreeNodes = TreeUtil.buildTree(fileMaps,"process","frame",null,null); + List fileTreeNodes = TreeUtil.buildTree("0",fileMaps,"process","frame",null,null); filesCount = new LinkedHashMap<>(); filesCount.put("processFileNum", processFileNum); filesCount.put("policyFileNum", policyFileNum); diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/FileManagementService.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/FileManagementService.java index f6f18fe4..1a0f0491 100644 --- a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/FileManagementService.java +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/FileManagementService.java @@ -1,16 +1,5 @@ package com.awspaas.user.apps.yili.reportform.service; -import com.actionsoft.bpms.commons.database.RowMap; -import com.actionsoft.bpms.commons.mvc.view.ActionWeb; -import com.actionsoft.bpms.commons.mvc.view.ResponseObject; -import com.actionsoft.bpms.server.RequestParams; -import com.actionsoft.bpms.server.UserContext; -import com.actionsoft.bpms.util.DBSql; -import com.actionsoft.sdk.local.SDK; -import com.awspaas.user.apps.yili.reportform.util.GetNodesUtil; -import com.awspaas.user.apps.yili.reportform.util.TreeUtil; - -import java.sql.Connection; import java.sql.Timestamp; import java.text.NumberFormat; import java.text.ParseException; @@ -19,7 +8,22 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.Period; import java.time.format.DateTimeFormatter; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import com.actionsoft.bpms.commons.database.RowMap; +import com.actionsoft.bpms.commons.mvc.view.ActionWeb; +import com.actionsoft.bpms.commons.mvc.view.ResponseObject; +import com.actionsoft.bpms.server.RequestParams; +import com.actionsoft.bpms.server.UserContext; +import com.actionsoft.bpms.util.DBSql; +import com.actionsoft.bpms.util.UtilString; +import com.alibaba.fastjson.JSONObject; +import com.awspaas.user.apps.yili.reportform.util.GetNodesUtil; +import com.awspaas.user.apps.yili.reportform.util.TreeUtil; /** * @author:Lizj @@ -93,6 +97,11 @@ public class FileManagementService extends ActionWeb { //文件类型 HashMap fileType = new HashMap<>(); ArrayList fileTypes = new ArrayList<>(); + fileType = new HashMap(); + fileType.put("termsKey","totalFile"); + fileType.put("termsVal","全部"); + fileTypes.add(fileType); + fileType = new HashMap(); fileType.put("termsKey","processFile"); fileType.put("termsVal","流程"); fileTypes.add(fileType); @@ -111,7 +120,7 @@ public class FileManagementService extends ActionWeb { ro.put("fileTypes",fileTypes); //发布单位 List deptMaps = DBSql.getMaps("SELECT ID,PARENTDEPARTMENTID,DEPARTMENTNAME,LAYER,ORDERINDEX FROM ORGDEPARTMENT" - + " WHERE COMPANYID='8911e732-b42a-4556-853f-ad32761bcbee' AND CLOSED='0'"); + + " WHERE COMPANYID='8911e732-b42a-4556-853f-ad32761bcbee' AND CLOSED='0' AND ID not in ('5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe','e79281b1-2f81-4895-b30e-9f96e9ad0e2c','53d3076d-cd2d-4f5b-bacb-8e93273e9f44','9c795620-93c6-485c-b9fa-93536c988da8','12d42abb-a58f-411b-8c71-0a421a27eafc','65048aee-157f-49f2-a2dc-5903dd26f519')"); //demo3 //3e74f14d-852f-4f6f-a809-08a56697f103 //本地 @@ -131,7 +140,7 @@ public class FileManagementService extends ActionWeb { deptNode.put("nodeType", nodeType); deptNodes.add(deptNode); } - List deptTreeNodes = TreeUtil.buildTree(deptNodes,"0","dept","3",null); + List deptTreeNodes = TreeUtil.buildTree("1",deptNodes,"0","dept","3",null); //所属领域 ArrayList frameList = new ArrayList<>(); ArrayList fieldMaps = new ArrayList<>(); @@ -155,7 +164,7 @@ public class FileManagementService extends ActionWeb { fieldNode.put("TLEVEL", Integer.valueOf(String.valueOf(fieldMap.get("FRAMELEVEL")))); fieldNodes.add(fieldNode); } - List fieldTreeNodes = TreeUtil.buildTree(fieldNodes, "process", null, null, null); + List fieldTreeNodes = TreeUtil.buildTree("1",fieldNodes, "process", null, null, null); ro.put("deptTreeNodes",deptTreeNodes); ro.put("fieldTreeNodes",fieldTreeNodes); return ro.toString(); @@ -176,10 +185,16 @@ public class FileManagementService extends ActionWeb { String field = params.get("field"); ArrayList deptIDList = new ArrayList<>(); ArrayList fieldList = new ArrayList<>(); - List fileRowMaps = DBSql.getMaps("SELECT FILEID,PUBDEPT,PLMETHODID,POLICYTYPE,FILESTATE,VIEWCOUNT FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' OR PLMETHODID='process.flowchart' OR PLMETHODID='control.policy' OR PLMETHODID='data.form'"); + List fileRowMaps = DBSql.getMaps("SELECT FILEID,PUBDEPT,PLPARENTID,PLMETHODID,POLICYTYPE,FILESTATE,VIEWCOUNT FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' OR PLMETHODID='process.flowchart' OR PLMETHODID='control.policy' OR PLMETHODID='data.form'"); ArrayList fileHandleMaps = new ArrayList<>(); if (null!=fileType && !fileType.equals("")) { fileHandleMaps = new ArrayList<>(); + if (fileType.equals("totalFile")||fileType.equals("all")) { + for (RowMap fileRowMap : fileRowMaps) { + fileHandleMaps.add(fileRowMap); + + } + } if (fileType.equals("processFile")) { for (RowMap fileRowMap : fileRowMaps) { if (fileRowMap.getString("PLMETHODID").equals("process.epc") || fileRowMap.getString("PLMETHODID").equals("process.flowchart")) { @@ -211,30 +226,45 @@ public class FileManagementService extends ActionWeb { fileRowMaps = fileHandleMaps; } if (null!=unit && !unit.equals("")) { - fileHandleMaps = new ArrayList<>(); - deptIDList = new ArrayList(); - deptIDList = GetNodesUtil.getChildDept(unit, deptIDList); - for (String deptID : deptIDList) { - for (RowMap fileRowMap : fileRowMaps) { - if (fileRowMap.getString("PUBDEPT").contains(deptID)) { - fileHandleMaps.add(fileRowMap); - } + if("all".equals(unit)) { + for (RowMap fileRowMap : fileRowMaps) { + fileHandleMaps.add(fileRowMap); } - } + }else { + fileHandleMaps = new ArrayList<>(); + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(unit, deptIDList); + for (String deptID : deptIDList) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PUBDEPT").contains(deptID)) { + fileHandleMaps.add(fileRowMap); + } + } + } + + } fileRowMaps = fileHandleMaps; } if (null!=field && !field.equals("")) { - fileHandleMaps = new ArrayList<>(); - fieldList = new ArrayList(); - fieldList = GetNodesUtil.getChildFrame(field,"", fieldList); - for (Map fieldMap : fieldList) { - String fieldID = String.valueOf(fieldMap.get("FRAMEID")); - for (RowMap fileRowMap : fileRowMaps) { - if (fileRowMap.getString("PLPARENTID").equals(fieldID)) { - fileHandleMaps.add(fileRowMap); - } - } - } + + if("all".equals(field)) { + for (RowMap fileRowMap : fileRowMaps) { + fileHandleMaps.add(fileRowMap); + } + }else { + fileHandleMaps = new ArrayList<>(); + fieldList = new ArrayList(); + fieldList = GetNodesUtil.getChildFrame(field,"", fieldList); + for (Map fieldMap : fieldList) { + String fieldID = String.valueOf(fieldMap.get("FRAMEID")); + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PLPARENTID").equals(fieldID)) { + fileHandleMaps.add(fileRowMap); + } + } + } + + } fileRowMaps = fileHandleMaps; } //文件状态:已发布、审批中、已失效 查阅总数 @@ -242,6 +272,16 @@ public class FileManagementService extends ActionWeb { Integer inApprovalCount = 0; Integer expiredCount = 0; Integer consultCount = 0; + String sql = "SELECT count(*) FROM BO_EU_USER_LOGIN_LOG WHERE LOGTYPE = '3'"; + String count = DBSql.getString(sql); + + /* + * ExecutorService service = Executors.newFixedThreadPool(1); + * service.execute(new Runnable() { + * + * @Override public void run() { } }); + */ + if (null!=fileRowMaps && fileRowMaps.isEmpty()==false) { for (RowMap fileRowMap : fileRowMaps) { String fileState = fileRowMap.getString("FILESTATE"); @@ -260,7 +300,7 @@ public class FileManagementService extends ActionWeb { ro.put("publishedCount",publishedCount); ro.put("inApprovalCount",inApprovalCount); ro.put("expiredCount",expiredCount); - ro.put("consultCount",consultCount); + ro.put("consultCount",count); } else { ro.ok("暂无文件"); publishedCount = 0; @@ -275,178 +315,221 @@ public class FileManagementService extends ActionWeb { return ro.toString(); } - /** - * @methodName: - * @param: - * @return: - * @description:部门文件数量 - * @auther: Lizj - * @date: 2022/6/28 22:43 - */ - public String deptFileCount(UserContext uc, RequestParams params) { - /*文件数量=当日生效文档总数*/ - ResponseObject ro = ResponseObject.newOkResponse(); - HashMap deptFileCountMap = new HashMap<>(); - ArrayList deptIDList = new ArrayList<>(); - ArrayList BDFileCountMaps = new ArrayList<>(); - ArrayList FDFileCountMaps = new ArrayList<>(); - Integer fileCount = 0; - //事业部和职能部门ID,名称 list - List fileRowMaps = DBSql.getMaps("SELECT FILEID,PUBDEPT FROM BO_EU_PAL_FILE1 WHERE FILEUSESTATE='1'"); - List BDInfoMaps = DBSql.getMaps("SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='BD'"); - List FDInfoMaps = DBSql.getMaps("SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='FD'"); - if (null!=BDInfoMaps && !BDInfoMaps.isEmpty()) { - for (RowMap bdInfoMap : BDInfoMaps) { - deptFileCountMap = new HashMap(); - fileCount = 0; - String bdDeptID = bdInfoMap.getString("DEPTID"); - deptIDList = new ArrayList(); - deptIDList = GetNodesUtil.getChildDept(bdDeptID, deptIDList); - if (null!=deptIDList && !deptIDList.isEmpty()) { - for (String deptID : deptIDList) { - for (RowMap fileRowMap : fileRowMaps) { - if (fileRowMap.getString("PUBDEPT").contains(deptID)) { - fileCount += 1; - } - } - } - } - deptFileCountMap.put("deptID",bdDeptID); - deptFileCountMap.put("deptName",bdInfoMap.getString("ABBREVIATION")); - deptFileCountMap.put("fileCount",fileCount); - BDFileCountMaps.add(deptFileCountMap); - } - } - if (null!=FDInfoMaps && !FDInfoMaps.isEmpty()) { - for (RowMap fdInfoMap : FDInfoMaps) { - deptFileCountMap = new HashMap(); - fileCount = 0; - String fdDeptID = fdInfoMap.getString("DEPTID"); - deptIDList = new ArrayList(); - deptIDList = GetNodesUtil.getChildDept(fdDeptID, deptIDList); - if (null!=deptIDList && !deptIDList.isEmpty()) { - for (String deptID : deptIDList) { - for (RowMap fileRowMap : fileRowMaps) { - if (fileRowMap.getString("PUBDEPT").contains(deptID)) { - fileCount += 1; - } - } - } - } - deptFileCountMap.put("deptID",fdDeptID); - deptFileCountMap.put("deptName",fdInfoMap.getString("ABBREVIATION")); - deptFileCountMap.put("fileCount",fileCount); - FDFileCountMaps.add(deptFileCountMap); - } - } - ro.put("BDFileCount",BDFileCountMaps); - ro.put("FDFileCount",FDFileCountMaps); - return ro.toString(); - } - /** - * @methodName: - * @param: - * @return: - * @description:部门文件年度更新率 - * @auther: Lizj - * @date: 2022/6/28 22:49 - */ - public String deptFileYearRenewRate(UserContext uc, RequestParams params) { - /*年度更新率=(某单位年度新增文件+年度修订文件)/某单位当前文件总数*/ - ResponseObject ro = ResponseObject.newOkResponse(); - HashMap renewRateMap = new HashMap<>(); - ArrayList BDRenewRateMaps = new ArrayList<>(); - ArrayList FDRenewRateMaps = new ArrayList<>(); - ArrayList deptIDList = new ArrayList<>(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - Integer deptFileNum = 0; - Integer newFileNum = 0; - String renewRate = null; - //获取当前年 - LocalDateTime nowDate = LocalDateTime.now(); - int nowYear = nowDate.getYear(); - NumberFormat numberformat = NumberFormat.getInstance(); - numberformat.setMaximumFractionDigits(2); - //事业部和职能部门ID,名称 list - List fileRowMaps = DBSql.getMaps("SELECT FILEID,FILEVERSION,PUBDEPT,PUBDATETIME FROM BO_EU_PAL_FILE1 WHERE FILESTATE='1'"); - List BDInfoMaps = DBSql.getMaps("SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='BD'"); - List FDInfoMaps = DBSql.getMaps("SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='FD'"); - if (null!=BDInfoMaps && !BDInfoMaps.isEmpty()) { - for (RowMap bdInfoMap : BDInfoMaps) { - renewRateMap = new HashMap(); - deptFileNum = 0; - newFileNum = 0; - renewRate = null; - String bdDeptID = bdInfoMap.getString("DEPTID"); - deptIDList = new ArrayList(); - deptIDList = GetNodesUtil.getChildDept(bdDeptID, deptIDList); - if (null!=deptIDList && !deptIDList.isEmpty()) { - for (String deptID : deptIDList) { - for (RowMap fileRowMap : fileRowMaps) { - if (fileRowMap.getString("PUBDEPT").contains(deptID)) { - deptFileNum += 1; - Timestamp PUBDATETIME = fileRowMap.getTimestamp("PUBDATETIME"); - String FILEVERSION = fileRowMap.getString("FILEVERSION"); - String pubdatetimeString= sdf.format(PUBDATETIME); - LocalDate pubDate = LocalDate.parse(pubdatetimeString, DateTimeFormatter.ofPattern("yyyy-MM-dd")); - if (pubDate.getYear()==nowYear) { - newFileNum += 1; - } - } - } - } - } - if (deptFileNum!=0) { - renewRate = numberformat.format((float) newFileNum / (float) deptFileNum * 100); - } else { - renewRate = "0"; - } - renewRateMap.put("deptID",bdDeptID); - renewRateMap.put("deptName",bdInfoMap.getString("ABBREVIATION")); - renewRateMap.put("renewRate",renewRate); - BDRenewRateMaps.add(renewRateMap); - } - } - if (null!=FDInfoMaps && !FDInfoMaps.isEmpty()) { - for (RowMap fdInfoMap : FDInfoMaps) { - renewRateMap = new HashMap(); - deptFileNum = 0; - newFileNum = 0; - renewRate = null; - String fdDeptID = fdInfoMap.getString("DEPTID"); - deptIDList = new ArrayList(); - deptIDList = GetNodesUtil.getChildDept(fdDeptID, deptIDList); - if (null!=deptIDList && !deptIDList.isEmpty()) { - for (String deptID : deptIDList) { - for (RowMap fileRowMap : fileRowMaps) { - if (fileRowMap.getString("PUBDEPT").contains(deptID)) { - deptFileNum += 1; - Timestamp PUBDATETIME = fileRowMap.getTimestamp("PUBDATETIME"); - String FILEVERSION = fileRowMap.getString("FILEVERSION"); - String pubdatetimeString= sdf.format(PUBDATETIME); - LocalDate pubDate = LocalDate.parse(pubdatetimeString, DateTimeFormatter.ofPattern("yyyy-MM-dd")); - if (pubDate.getYear()==nowYear) { - newFileNum += 1; - } - } - } - } - } - if (deptFileNum!=0) { - renewRate = numberformat.format((float) newFileNum / (float) deptFileNum * 100); - } else { - renewRate = "0"; - } - renewRateMap.put("deptID",fdDeptID); - renewRateMap.put("deptName",fdInfoMap.getString("ABBREVIATION")); - renewRateMap.put("renewRate",renewRate); - FDRenewRateMaps.add(renewRateMap); - } - } - ro.put("BDRenewRate",BDRenewRateMaps); - ro.put("FDRenewRate",FDRenewRateMaps); - return ro.toString(); - } + + + //获取属性 + public String getArrtValue(String plId,String ArrtKey,String type) { + String arrtValue = ""; + try { + String sql = "select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '"+plId+"' and PROPERTYID = '"+ArrtKey+"'"; + String relatFileJson = DBSql.getString(sql); + if(UtilString.isNotEmpty(relatFileJson)) { + JSONObject parseObject = JSONObject.parseObject(relatFileJson); + String fileNames = parseObject.getString("relationShapeText"); + if(UtilString.isNotEmpty(fileNames)) { + arrtValue = fileNames; + } + + } + } catch (Exception e) { + // TODO: handle exception + } + return arrtValue; + + } + + /** + * @methodName: + * @param: + * @return: + * @description:部门文件数量 + * @auther: Lizj + * @date: 2022/6/28 22:43 + */ + public String deptFileCount(UserContext uc, RequestParams params,List fileRowMaps) { + /*文件数量=当日生效文档总数*/ + ResponseObject ro = ResponseObject.newOkResponse(); + HashMap deptFileCountMap = new HashMap<>(); + ArrayList deptIDList = new ArrayList<>(); + ArrayList BDFileCountMaps = new ArrayList<>(); + ArrayList FDFileCountMaps = new ArrayList<>(); + Integer fileCount = 0; + //事业部和职能部门ID,名称 list + List BDInfoMaps = DBSql.getMaps("SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='BD'"); + List FDInfoMaps = DBSql.getMaps("SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='FD'"); + if (null!=BDInfoMaps && !BDInfoMaps.isEmpty()) { + for (RowMap bdInfoMap : BDInfoMaps) { + deptFileCountMap = new HashMap(); + fileCount = 0; + String bdDeptID = bdInfoMap.getString("DEPTID"); + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(bdDeptID, deptIDList); + if (null!=deptIDList && !deptIDList.isEmpty()) { + for (String deptID : deptIDList) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PUBDEPT").contains(deptID)) { + fileCount += 1; + } + } + } + } + deptFileCountMap.put("deptID",bdDeptID); + deptFileCountMap.put("deptName",bdInfoMap.getString("ABBREVIATION")); + deptFileCountMap.put("fileCount",fileCount); + BDFileCountMaps.add(deptFileCountMap); + } + } + if (null!=FDInfoMaps && !FDInfoMaps.isEmpty()) { + for (RowMap fdInfoMap : FDInfoMaps) { + deptFileCountMap = new HashMap(); + fileCount = 0; + String fdDeptID = fdInfoMap.getString("DEPTID"); + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(fdDeptID, deptIDList); + if (null!=deptIDList && !deptIDList.isEmpty()) { + for (String deptID : deptIDList) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PUBDEPT").contains(deptID)) { + fileCount += 1; + } + } + } + } + deptFileCountMap.put("deptID",fdDeptID); + deptFileCountMap.put("deptName",fdInfoMap.getString("ABBREVIATION")); + deptFileCountMap.put("fileCount",fileCount); + FDFileCountMaps.add(deptFileCountMap); + } + } + ro.put("BDFileCount",BDFileCountMaps); + ro.put("FDFileCount",FDFileCountMaps); + return ro.toString(); + } + + /** + * @methodName: + * @param: + * @return: + * @description:部门文件年度更新率 + * @auther: Lizj + * @date: 2022/6/28 22:49 + */ + + public String deptFileYearRenewRate(UserContext uc, RequestParams params,List fileRowMaps) { + /* 年度更新率=(某单位年度新增文件+年度修订文件)/某单位当前文件总数 */ + ResponseObject ro = ResponseObject.newOkResponse(); + HashMap renewRateMap = new HashMap<>(); + ArrayList BDRenewRateMaps = new ArrayList<>(); + ArrayList FDRenewRateMaps = new ArrayList<>(); + ArrayList deptIDList = new ArrayList<>(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Integer deptFileNum = 0; + Integer newFileNum = 0; + String renewRate = null; + // 获取当前年 + LocalDateTime nowDate = LocalDateTime.now(); + int nowYear = nowDate.getYear(); + NumberFormat numberformat = NumberFormat.getInstance(); + numberformat.setMaximumFractionDigits(2); + // 事业部和职能部门ID,名称 list + // List fileRowMaps = DBSql.getMaps("SELECT + // FILEID,FILEVERSION,PUBDEPT,PUBDATETIME FROM BO_EU_PAL_FILE1 WHERE + // FILESTATE='1'"); + List BDInfoMaps = DBSql.getMaps( + "SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='BD'"); + List FDInfoMaps = DBSql.getMaps( + "SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='FD'"); + if (null != BDInfoMaps && !BDInfoMaps.isEmpty()) { + for (RowMap bdInfoMap : BDInfoMaps) { + renewRateMap = new HashMap(); + deptFileNum = 0; + newFileNum = 0; + renewRate = null; + String bdDeptID = bdInfoMap.getString("DEPTID"); + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(bdDeptID, deptIDList); + if (null != deptIDList && !deptIDList.isEmpty()) { + for (String deptID : deptIDList) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PUBDEPT").contains(deptID)) { + deptFileNum += 1; + String publishDate = fileRowMap.getString("PUBDATETIME"); + if (UtilString.isNotEmpty(publishDate)) { + if (publishDate.contains("2022")) { + newFileNum += 1; + } + } + /* + * Timestamp PUBDATETIME = fileRowMap.getTimestamp("PUBDATETIME"); String + * FILEVERSION = fileRowMap.getString("FILEVERSION"); String pubdatetimeString= + * sdf.format(PUBDATETIME); LocalDate pubDate = + * LocalDate.parse(pubdatetimeString, + * DateTimeFormatter.ofPattern("yyyy-MM-dd")); if (pubDate.getYear()==nowYear) { + * newFileNum += 1; } + */ + } + } + } + } + if (deptFileNum != 0) { + renewRate = numberformat.format((float) newFileNum / (float) deptFileNum * 100); + } else { + renewRate = "0"; + } + renewRateMap.put("deptID", bdDeptID); + renewRateMap.put("deptName", bdInfoMap.getString("ABBREVIATION")); + renewRateMap.put("renewRate", renewRate); + BDRenewRateMaps.add(renewRateMap); + } + } + if (null != FDInfoMaps && !FDInfoMaps.isEmpty()) { + for (RowMap fdInfoMap : FDInfoMaps) { + renewRateMap = new HashMap(); + deptFileNum = 0; + newFileNum = 0; + renewRate = null; + String fdDeptID = fdInfoMap.getString("DEPTID"); + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(fdDeptID, deptIDList); + if (null != deptIDList && !deptIDList.isEmpty()) { + for (String deptID : deptIDList) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PUBDEPT").contains(deptID)) { + deptFileNum += 1; + String publishDate = fileRowMap.getString("PUBDATETIME"); + if (UtilString.isNotEmpty(publishDate)) { + if (publishDate.contains("2022")) { + newFileNum += 1; + } + } + /* + * Timestamp PUBDATETIME = fileRowMap.getTimestamp("PUBDATETIME"); String + * FILEVERSION = fileRowMap.getString("FILEVERSION"); String pubdatetimeString= + * sdf.format(PUBDATETIME); LocalDate pubDate = + * LocalDate.parse(pubdatetimeString, + * DateTimeFormatter.ofPattern("yyyy-MM-dd")); if (pubDate.getYear()==nowYear) { + * newFileNum += 1; } + */ + } + } + } + } + if (deptFileNum != 0) { + renewRate = numberformat.format((float) newFileNum / (float) deptFileNum * 100); + } else { + renewRate = "0"; + } + renewRateMap.put("deptID", fdDeptID); + renewRateMap.put("deptName", fdInfoMap.getString("ABBREVIATION")); + renewRateMap.put("renewRate", renewRate); + FDRenewRateMaps.add(renewRateMap); + } + } + ro.put("BDRenewRate", BDRenewRateMaps); + ro.put("FDRenewRate", FDRenewRateMaps); + return ro.toString(); + } + /** * @methodName: * @param: @@ -483,31 +566,48 @@ public class FileManagementService extends ActionWeb { abolishCount = 0; String bdDeptID = bdInfoMap.getString("DEPTID"); deptIDList = new ArrayList(); - deptIDList = GetNodesUtil.getChildDept(bdDeptID, deptIDList); - if (null!=deptIDList && !deptIDList.isEmpty()) { - for (String deptID : deptIDList) { - for (RowMap fileRowMap : fileRowMaps) { - if (fileRowMap.getString("PUBDEPT").contains(deptID)) { - Timestamp PUBDATETIME = fileRowMap.getTimestamp("PUBDATETIME"); - String pubdatetimeString= sdf.format(PUBDATETIME); - LocalDate pubDate = LocalDate.parse(pubdatetimeString, DateTimeFormatter.ofPattern("yyyy-MM-dd")); - String FILESTATE = fileRowMap.getString("FILESTATE"); - String FILEVERSION = fileRowMap.getString("FILEVERSION"); - if (pubDate.getYear()==nowYear) { - if (FILESTATE.equals("1") && FILEVERSION.equals("1.0")) { - createCount += 1; - } - if (FILESTATE.equals("1") && !FILEVERSION.equals("1.0")) { - updateCount += 1; - } - if (FILESTATE.equals("3")) { - abolishCount += 1; - } - } - } - } - } - } + try { + + deptIDList = GetNodesUtil.getChildDept(bdDeptID, deptIDList); + if (null!=deptIDList && !deptIDList.isEmpty()) { + for (String deptID : deptIDList) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PUBDEPT").contains(deptID)) { + String FILESTATE = fileRowMap.getString("FILESTATE"); + String FILEVERSION = fileRowMap.getString("FILEVERSION"); + String publishDate = fileRowMap.getString("PUBDATETIME"); + if (UtilString.isNotEmpty(publishDate)) { + if (publishDate.contains("2022")) { + if (FILESTATE.equals("1") && FILEVERSION.equals("1.0")) { + createCount += 1; + } + if (FILESTATE.equals("1") && !FILEVERSION.equals("1.0")) { + updateCount += 1; + } + if (FILESTATE.equals("3")) { + abolishCount += 1; + } + } + } + + /* + * Timestamp PUBDATETIME = fileRowMap.getTimestamp("PUBDATETIME"); String + * pubdatetimeString= sdf.format(PUBDATETIME); LocalDate pubDate = + * LocalDate.parse(pubdatetimeString, + * DateTimeFormatter.ofPattern("yyyy-MM-dd")); + * + * if (pubDate.getYear()==nowYear) { if (FILESTATE.equals("1") && + * FILEVERSION.equals("1.0")) { createCount += 1; } if (FILESTATE.equals("1") && + * !FILEVERSION.equals("1.0")) { updateCount += 1; } if (FILESTATE.equals("3")) + * { abolishCount += 1; } } + */ + } + } + } + } + } catch (Exception e) { + // TODO: handle exception + } renewCountMap.put("deptID",bdDeptID); renewCountMap.put("deptName",bdInfoMap.getString("ABBREVIATION")); renewCountMap.put("createCount",createCount); @@ -524,31 +624,35 @@ public class FileManagementService extends ActionWeb { abolishCount = 0; String fdDeptID = fdInfoMap.getString("DEPTID"); deptIDList = new ArrayList(); - deptIDList = GetNodesUtil.getChildDept(fdDeptID, deptIDList); - if (null!=deptIDList && !deptIDList.isEmpty()) { - for (String deptID : deptIDList) { - for (RowMap fileRowMap : fileRowMaps) { - if (fileRowMap.getString("PUBDEPT").contains(deptID)) { - Timestamp PUBDATETIME = fileRowMap.getTimestamp("PUBDATETIME"); - String pubdatetimeString= sdf.format(PUBDATETIME); - LocalDate pubDate = LocalDate.parse(pubdatetimeString, DateTimeFormatter.ofPattern("yyyy-MM-dd")); - String FILESTATE = fileRowMap.getString("FILESTATE"); - String FILEVERSION = fileRowMap.getString("FILEVERSION"); - if (pubDate.getYear()==nowYear) { - if (FILESTATE.equals("1") && FILEVERSION.equals("1.0")) { - createCount += 1; - } - if (FILESTATE.equals("1") && !FILEVERSION.equals("1.0")) { - updateCount += 1; - } - if (FILESTATE.equals("3")) { - abolishCount += 1; - } - } - } - } - } - } + try { + deptIDList = GetNodesUtil.getChildDept(fdDeptID, deptIDList); + if (null!=deptIDList && !deptIDList.isEmpty()) { + for (String deptID : deptIDList) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PUBDEPT").contains(deptID)) { + String FILESTATE = fileRowMap.getString("FILESTATE"); + String FILEVERSION = fileRowMap.getString("FILEVERSION"); + String publishDate = fileRowMap.getString("PUBDATETIME"); + if (UtilString.isNotEmpty(publishDate)) { + if (publishDate.contains("2022")) { + if (FILESTATE.equals("1") && FILEVERSION.equals("1.0")) { + createCount += 1; + } + if (FILESTATE.equals("1") && !FILEVERSION.equals("1.0")) { + updateCount += 1; + } + if (FILESTATE.equals("3")) { + abolishCount += 1; + } + } + } + } + } + } + } + } catch (Exception e) { + // TODO: handle exception + } renewCountMap.put("deptID",fdDeptID); renewCountMap.put("deptName",fdInfoMap.getString("ABBREVIATION")); renewCountMap.put("createCount",createCount); @@ -574,7 +678,7 @@ public class FileManagementService extends ActionWeb { ResponseObject ro = ResponseObject.newOkResponse(); //发布单位 List deptMaps = DBSql.getMaps("SELECT ID,PARENTDEPARTMENTID,DEPARTMENTNAME,LAYER,ORDERINDEX FROM ORGDEPARTMENT" - + " WHERE COMPANYID='8911e732-b42a-4556-853f-ad32761bcbee' AND CLOSED='0'"); + + " WHERE COMPANYID='8911e732-b42a-4556-853f-ad32761bcbee' AND CLOSED='0' AND ID not in ('5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe','e79281b1-2f81-4895-b30e-9f96e9ad0e2c','53d3076d-cd2d-4f5b-bacb-8e93273e9f44','9c795620-93c6-485c-b9fa-93536c988da8','12d42abb-a58f-411b-8c71-0a421a27eafc','65048aee-157f-49f2-a2dc-5903dd26f519')"); //demo3 //3e74f14d-852f-4f6f-a809-08a56697f103 //本地 @@ -594,7 +698,7 @@ public class FileManagementService extends ActionWeb { deptNode.put("nodeType", nodeType); deptNodes.add(deptNode); } - List deptTreeNodes = TreeUtil.buildTree(deptNodes,"0","dept","3",null); + List deptTreeNodes = TreeUtil.buildTree("1",deptNodes,"0","dept","3",null); //所属领域 ArrayList frameList = new ArrayList<>(); ArrayList fieldMaps = new ArrayList<>(); @@ -618,7 +722,7 @@ public class FileManagementService extends ActionWeb { fieldNode.put("TLEVEL", Integer.valueOf(String.valueOf(fieldMap.get("FRAMELEVEL")))); fieldNodes.add(fieldNode); } - List fieldTreeNodes = TreeUtil.buildTree(fieldNodes, "process", null, null, null); + List fieldTreeNodes = TreeUtil.buildTree("1",fieldNodes, "process", null, null, null); ro.put("deptTreeNodes",deptTreeNodes); ro.put("fieldTreeNodes",fieldTreeNodes); return ro.toString(); @@ -627,11 +731,12 @@ public class FileManagementService extends ActionWeb { * @methodName: * @param: * @return: + * @throws ParseException * @description:文件发布时间分布 * @auther: Lizj * @date: 2022/6/28 22:57 */ - public String filePubTimeDistribution(UserContext uc, RequestParams params) { + public String filePubTimeDistribution(UserContext uc, RequestParams params) throws ParseException { ResponseObject ro = ResponseObject.newOkResponse(); String unit = params.get("unit"); String field = params.get("field"); @@ -641,33 +746,49 @@ public class FileManagementService extends ActionWeb { ArrayList fileHandleMaps = new ArrayList<>(); if (null!=unit && !unit.equals("")) { - fileHandleMaps = new ArrayList<>(); - deptIDList = new ArrayList(); - deptIDList = GetNodesUtil.getChildDept(unit, deptIDList); - for (String deptID : deptIDList) { - for (RowMap fileMap : fileMaps) { - if (fileMap.getString("PUBDEPT").contains(deptID)) { - fileHandleMaps.add(fileMap); - } - } - } + if("all".equals(unit)) { + for (RowMap fileRowMap : fileMaps) { + fileHandleMaps.add(fileRowMap); + } + }else { + fileHandleMaps = new ArrayList<>(); + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(unit, deptIDList); + for (String deptID : deptIDList) { + for (RowMap fileMap : fileMaps) { + if (fileMap.getString("PUBDEPT").contains(deptID)) { + fileHandleMaps.add(fileMap); + } + } + } + + } fileMaps = fileHandleMaps; } if (null!=field && !field.equals("")) { - fileHandleMaps = new ArrayList<>(); - fieldList = new ArrayList(); - fieldList = GetNodesUtil.getChildFrame(field,"", fieldList); - for (Map fieldMap : fieldList) { - String fieldID = String.valueOf(fieldMap.get("FRAMEID")); - for (RowMap fileMap : fileMaps) { - if (fileMap.getString("PLPARENTID").equals(fieldID)) { - fileHandleMaps.add(fileMap); - } - } - } + if("all".equals(field)) { + for (RowMap fileRowMap : fileMaps) { + fileHandleMaps.add(fileRowMap); + } + }else { + fileHandleMaps = new ArrayList<>(); + fieldList = new ArrayList(); + fieldList = GetNodesUtil.getChildFrame(field,"", fieldList); + for (Map fieldMap : fieldList) { + String fieldID = String.valueOf(fieldMap.get("FRAMEID")); + for (RowMap fileMap : fileMaps) { + if (fileMap.getString("PLPARENTID").equals(fieldID)) { + fileHandleMaps.add(fileMap); + } + } + } + } fileMaps = fileHandleMaps; } LocalDate nowDate = LocalDate.now(); + + + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); //6个月内fileMaps ArrayList month6InFileMaps = new ArrayList<>(); @@ -683,23 +804,43 @@ public class FileManagementService extends ActionWeb { ArrayList fileCountMaps = new ArrayList<>(); if (null!=fileMaps && fileMaps.isEmpty()==false) { for (RowMap fileMap : fileMaps) { - LocalDate PUBDATETIME = LocalDate.parse(fileMap.getString("PUBDATETIME"), DateTimeFormatter.ofPattern("yyyy-MM-dd")); - Period betweenDate = Period.between(PUBDATETIME, nowDate); - if (betweenDate.getMonths()<6) { - month6InFileMaps.add(fileMap); - } - if (betweenDate.getMonths()>=6 && betweenDate.getYears()<1) { - year1InFileMaps.add(fileMap); - } - if(betweenDate.getYears()>=1 && betweenDate.getYears()<2) { - year2InFileMaps.add(fileMap); - } - if(betweenDate.getYears()>=2 && betweenDate.getYears()<3) { - year3InFileMaps.add(fileMap); - } - if(betweenDate.getYears()>=3) { - year3OutFileMaps.add(fileMap); - } + try { + LocalDate PUBDATETIME = null; + String publishDate = fileMap.getString("PUBDATETIME"); + if(UtilString.isNotEmpty(publishDate)) { + if(publishDate.length()>11) { + publishDate = publishDate.substring(0, 10); + } + if(publishDate.contains("年")) { + //PUBDATETIME = LocalDate.parse(publishDate.substring(0,9), DateTimeFormatter.ofPattern("yyyy年MM月dd")); + }else if(publishDate.contains("-")) { + PUBDATETIME = LocalDate.parse(publishDate); + } + + } + if(PUBDATETIME==null) { + continue; + } + Period betweenDate = Period.between(PUBDATETIME, nowDate); + if (betweenDate.getMonths()<6) { + month6InFileMaps.add(fileMap); + } + if (betweenDate.getMonths()>=6 && betweenDate.getYears()<1) { + year1InFileMaps.add(fileMap); + } + if(betweenDate.getYears()>=1 && betweenDate.getYears()<2) { + year2InFileMaps.add(fileMap); + } + if(betweenDate.getYears()>=2 && betweenDate.getYears()<3) { + year3InFileMaps.add(fileMap); + } + if(betweenDate.getYears()>=3) { + year3OutFileMaps.add(fileMap); + } + + } catch (Exception e) { + // TODO: handle exception + } } } else { ro.ok("暂无文件"); @@ -847,7 +988,7 @@ public class FileManagementService extends ActionWeb { ResponseObject ro = ResponseObject.newOkResponse(); //发布单位 List deptMaps = DBSql.getMaps("SELECT ID,PARENTDEPARTMENTID,DEPARTMENTNAME,LAYER,ORDERINDEX FROM ORGDEPARTMENT" - + " WHERE COMPANYID='8911e732-b42a-4556-853f-ad32761bcbee' AND CLOSED='0'"); + + " WHERE COMPANYID='8911e732-b42a-4556-853f-ad32761bcbee' AND CLOSED='0' AND ID not in ('5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe','e79281b1-2f81-4895-b30e-9f96e9ad0e2c','53d3076d-cd2d-4f5b-bacb-8e93273e9f44','9c795620-93c6-485c-b9fa-93536c988da8','12d42abb-a58f-411b-8c71-0a421a27eafc','65048aee-157f-49f2-a2dc-5903dd26f519')"); //demo3 //3e74f14d-852f-4f6f-a809-08a56697f103 //本地 @@ -867,7 +1008,7 @@ public class FileManagementService extends ActionWeb { deptNode.put("nodeType", nodeType); deptNodes.add(deptNode); } - List deptTreeNodes = TreeUtil.buildTree(deptNodes,"0","dept","3",null); + List deptTreeNodes = TreeUtil.buildTree("1",deptNodes,"0","dept","3",null); //所属领域 ArrayList frameList = new ArrayList<>(); ArrayList fieldMaps = new ArrayList<>(); @@ -891,28 +1032,33 @@ public class FileManagementService extends ActionWeb { fieldNode.put("TLEVEL", Integer.valueOf(String.valueOf(fieldMap.get("FRAMELEVEL")))); fieldNodes.add(fieldNode); } - List fieldTreeNodes = TreeUtil.buildTree(fieldNodes, "process", null, null, null); + List fieldTreeNodes = TreeUtil.buildTree("1",fieldNodes, "process", null, null, null); ro.put("deptTreeNodes",deptTreeNodes); ro.put("fieldTreeNodes",fieldTreeNodes); //文件类型 - HashMap fileType = new HashMap<>(); - ArrayList fileTypes = new ArrayList<>(); - fileType.put("termsKey","processFile"); - fileType.put("termsVal","流程"); - fileTypes.add(fileType); - fileType = new HashMap(); - fileType.put("termsKey","policyFile"); - fileType.put("termsVal","制度"); - fileTypes.add(fileType); - fileType = new HashMap(); - fileType.put("termsKey","guideFile"); - fileType.put("termsVal","操作指导"); - fileTypes.add(fileType); - fileType = new HashMap(); - fileType.put("termsKey","formFile"); - fileType.put("termsVal","表单/模板"); - fileTypes.add(fileType); - ro.put("fileTypes",fileTypes); + HashMap fileType = new HashMap<>(); + ArrayList fileTypes = new ArrayList<>(); + fileType = new HashMap(); + fileType.put("termsKey", "totalFile"); + fileType.put("termsVal", "全部"); + fileTypes.add(fileType); + fileType = new HashMap(); + fileType.put("termsKey", "processFile"); + fileType.put("termsVal", "流程"); + fileTypes.add(fileType); + fileType = new HashMap(); + fileType.put("termsKey", "policyFile"); + fileType.put("termsVal", "制度"); + fileTypes.add(fileType); + fileType = new HashMap(); + fileType.put("termsKey", "guideFile"); + fileType.put("termsVal", "操作指导"); + fileTypes.add(fileType); + fileType = new HashMap(); + fileType.put("termsKey", "formFile"); + fileType.put("termsVal", "表单/模板"); + fileTypes.add(fileType); + ro.put("fileTypes", fileTypes); return ro.toString(); } @@ -933,11 +1079,16 @@ public class FileManagementService extends ActionWeb { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); ArrayList deptIDList = new ArrayList<>(); ArrayList fieldList = new ArrayList<>(); - List fileRowMaps = DBSql.getMaps("SELECT FILEID,PLMETHODID,POLICYTYPE,PLPARENTID,PUBDEPT,MODIFYDATETIME,RELEVANTFILE,SUPPORTFILE FROM BO_EU_PAL_FILE1 WHERE FILESTATE='1'"); + List fileRowMaps = DBSql.getMaps("SELECT FILEID,PLPARENTID,PLMETHODID,POLICYTYPE,PLPARENTID,PUBDEPT,MODIFYDATETIME,RELEVANTFILE,SUPPORTFILE FROM BO_EU_PAL_FILE1 WHERE FILESTATE='1'"); List fileRowMaps1 = fileRowMaps; ArrayList fileHandleMaps = new ArrayList<>(); if (null!=fileType && !fileType.equals("")) { fileHandleMaps = new ArrayList<>(); + if (fileType.equals("totalFile")||fileType.equals("all")) { + for (RowMap fileRowMap1 : fileRowMaps1) { + fileHandleMaps.add(fileRowMap1); + } + } if (fileType.equals("processFile")) { for (RowMap fileRowMap1 : fileRowMaps1) { if (fileRowMap1.getString("PLMETHODID").equals("process.epc") || fileRowMap1.getString("PLMETHODID").equals("process.flowchart")) { @@ -969,17 +1120,24 @@ public class FileManagementService extends ActionWeb { fileRowMaps1 = fileHandleMaps; } if (null!=unit && !unit.equals("")) { - fileHandleMaps = new ArrayList<>(); - deptIDList = new ArrayList(); - deptIDList = GetNodesUtil.getChildDept(unit, deptIDList); - for (String deptID : deptIDList) { - for (RowMap fileRowMap1 : fileRowMaps1) { - if (fileRowMap1.getString("PUBDEPT").contains(deptID)) { - fileHandleMaps.add(fileRowMap1); - } - } - } - fileRowMaps1 = fileHandleMaps; + if("all".equals(unit)) { + for (RowMap fileRowMap1 : fileRowMaps1) { + fileHandleMaps.add(fileRowMap1); + } + }else { + fileHandleMaps = new ArrayList<>(); + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(unit, deptIDList); + for (String deptID : deptIDList) { + for (RowMap fileRowMap1 : fileRowMaps1) { + if (fileRowMap1.getString("PUBDEPT").contains(deptID)) { + fileHandleMaps.add(fileRowMap1); + } + } + } + + } + fileRowMaps1 = fileHandleMaps; } if (null!=field && !field.equals("")) { fileHandleMaps = new ArrayList<>(); diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/ProcessPubService.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/ProcessPubService.java index 6b0e14b8..260ae0eb 100644 --- a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/ProcessPubService.java +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/ProcessPubService.java @@ -444,7 +444,8 @@ public class ProcessPubService extends ActionWeb { ResponseObject ro = ResponseObject.newOkResponse(); //所属单位 List deptMaps = DBSql.getMaps("SELECT ID,PARENTDEPARTMENTID,DEPARTMENTNAME,LAYER,ORDERINDEX FROM ORGDEPARTMENT" - + " WHERE COMPANYID='8911e732-b42a-4556-853f-ad32761bcbee' AND CLOSED='0'"); + + " WHERE COMPANYID='8911e732-b42a-4556-853f-ad32761bcbee' AND CLOSED='0' AND ID not in ('5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe','e79281b1-2f81-4895-b30e-9f96e9ad0e2c','53d3076d-cd2d-4f5b-bacb-8e93273e9f44','9c795620-93c6-485c-b9fa-93536c988da8','12d42abb-a58f-411b-8c71-0a421a27eafc','65048aee-157f-49f2-a2dc-5903dd26f519')"); + //demo3 //demo3 //3e74f14d-852f-4f6f-a809-08a56697f103 //本地 @@ -464,7 +465,7 @@ public class ProcessPubService extends ActionWeb { deptNode.put("nodeType", nodeType); deptNodes.add(deptNode); } - List deptTreeNodes = TreeUtil.buildTree(deptNodes,"0","dept","3",null); + List deptTreeNodes = TreeUtil.buildTree("1",deptNodes,"0","dept","3",null); //所属领域 ArrayList frameList = new ArrayList<>(); ArrayList fieldMaps = new ArrayList<>(); @@ -488,7 +489,7 @@ public class ProcessPubService extends ActionWeb { fieldNode.put("TLEVEL", Integer.valueOf(String.valueOf(fieldMap.get("FRAMELEVEL")))); fieldNodes.add(fieldNode); } - List fieldTreeNodes = TreeUtil.buildTree(fieldNodes, "process", null, null, null); + List fieldTreeNodes = TreeUtil.buildTree("1",fieldNodes, "process", null, null, null); ro.put("deptTreeNodes", deptTreeNodes); ro.put("fieldTreeNodes", fieldTreeNodes); return ro.toString(); @@ -1340,7 +1341,8 @@ public class ProcessPubService extends ActionWeb { ResponseObject ro = ResponseObject.newOkResponse(); //所属单位 List deptMaps = DBSql.getMaps("SELECT ID,PARENTDEPARTMENTID,DEPARTMENTNAME,LAYER,ORDERINDEX FROM ORGDEPARTMENT" - + " WHERE COMPANYID='8911e732-b42a-4556-853f-ad32761bcbee' AND CLOSED='0'"); + + " WHERE COMPANYID='8911e732-b42a-4556-853f-ad32761bcbee' AND CLOSED='0' AND ID not in ('5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe','e79281b1-2f81-4895-b30e-9f96e9ad0e2c','53d3076d-cd2d-4f5b-bacb-8e93273e9f44','9c795620-93c6-485c-b9fa-93536c988da8','12d42abb-a58f-411b-8c71-0a421a27eafc','65048aee-157f-49f2-a2dc-5903dd26f519')"); + //demo3 //demo3 //3e74f14d-852f-4f6f-a809-08a56697f103 //本地 @@ -1360,7 +1362,7 @@ public class ProcessPubService extends ActionWeb { deptNode.put("nodeType", nodeType); deptNodes.add(deptNode); } - List deptTreeNodes = TreeUtil.buildTree(deptNodes,"0","dept","3",null); + List deptTreeNodes = TreeUtil.buildTree("1",deptNodes,"0","dept","3",null); //所属领域 ArrayList frameList = new ArrayList<>(); ArrayList fieldMaps = new ArrayList<>(); @@ -1384,7 +1386,7 @@ public class ProcessPubService extends ActionWeb { fieldNode.put("TLEVEL", Integer.valueOf(String.valueOf(fieldMap.get("FRAMELEVEL")))); fieldNodes.add(fieldNode); } - List fieldTreeNodes = TreeUtil.buildTree(fieldNodes, "process", null, null, null); + List fieldTreeNodes = TreeUtil.buildTree("1",fieldNodes, "process", null, null, null); ro.put("deptTreeNodes", deptTreeNodes); ro.put("fieldTreeNodes", fieldTreeNodes); return ro.toString(); @@ -1409,32 +1411,48 @@ public class ProcessPubService extends ActionWeb { List nodeRowMaps = DBSql.getMaps("SELECT BN.NODEID,BN.NODETYPE,BF.FILEID,BF.PLPARENTID,BF.PUBDEPT FROM BO_EU_PAL_FILENODE5 BN LEFT JOIN BO_EU_PAL_FILE1 BF ON BN.PLID=BF.FILEID WHERE BF.FILESTATE='1' AND BF.PLMETHODID='process.epc'"); ArrayList nodeHandleMaps = new ArrayList<>(); if (null!=unit && !unit.equals("")) { - nodeHandleMaps = new ArrayList<>(); - deptIDList = new ArrayList(); - deptIDList = GetNodesUtil.getChildDept(unit, deptIDList); - for (String deptID : deptIDList) { - for (RowMap nodeRowMap : nodeRowMaps) { - if (nodeRowMap.getString("PUBDEPT").contains(deptID)) { - nodeHandleMaps.add(nodeRowMap); - } - } - } - nodeRowMaps = nodeHandleMaps; + if("all".equals(unit)) { + for (RowMap fileRowMap : nodeRowMaps) { + nodeHandleMaps.add(fileRowMap); + } + }else { + nodeHandleMaps = new ArrayList<>(); + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(unit, deptIDList); + for (String deptID : deptIDList) { + for (RowMap fileMap : nodeRowMaps) { + if (fileMap.getString("PUBDEPT").contains(deptID)) { + nodeHandleMaps.add(fileMap); + } + } + } + + } + nodeRowMaps = nodeHandleMaps; } if (null!=field && !field.equals("")) { - nodeHandleMaps = new ArrayList<>(); - fieldList = new ArrayList(); - fieldList = GetNodesUtil.getChildFrame(field,"", fieldList); - for (Map fieldMap : fieldList) { - String fieldID = String.valueOf(fieldMap.get("FRAMEID")); - for (RowMap nodeRowMap : nodeRowMaps) { - if (nodeRowMap.getString("PLPARENTID").equals(fieldID)) { - nodeHandleMaps.add(nodeRowMap); - } - } - } - nodeRowMaps = nodeHandleMaps; + if("all".equals(field)) { + for (RowMap fileRowMap : nodeRowMaps) { + nodeHandleMaps.add(fileRowMap); + } + }else { + nodeHandleMaps = new ArrayList<>(); + fieldList = new ArrayList(); + fieldList = GetNodesUtil.getChildFrame(field,"", fieldList); + for (Map fieldMap : fieldList) { + String fieldID = String.valueOf(fieldMap.get("FRAMEID")); + for (RowMap fileMap : nodeRowMaps) { + if (fileMap.getString("PLPARENTID").equals(fieldID)) { + nodeHandleMaps.add(fileMap); + } + } + } + } + nodeRowMaps = nodeHandleMaps; } + + + Integer nodeTotalNum = 0; Integer approvalNodeNum = 0; Integer operationNodeNum = 0; @@ -1532,7 +1550,7 @@ public class ProcessPubService extends ActionWeb { fieldNode.put("TLEVEL", Integer.valueOf(String.valueOf(fieldMap.get("FRAMELEVEL")))); fieldNodes.add(fieldNode); } - List fieldTreeNodes = TreeUtil.buildTree(fieldNodes, "process", null, null, null); + List fieldTreeNodes = TreeUtil.buildTree("1",fieldNodes, "process", null, null, null); ro.put("fieldTreeNodes", fieldTreeNodes); return ro.toString(); } @@ -1572,17 +1590,24 @@ public class ProcessPubService extends ActionWeb { String approvalOLRate = "0"; if (null!=field && !field.equals("")) { - nodeHandleMaps = new ArrayList<>(); - fieldList = new ArrayList(); - fieldList = GetNodesUtil.getChildFrame(field,"", fieldList); - for (Map fieldMap : fieldList) { - String fieldID = String.valueOf(fieldMap.get("FRAMEID")); - for (RowMap nodeRowMap : nodeRowMaps) { - if (nodeRowMap.getString("PLPARENTID").equals(fieldID)) { - nodeHandleMaps.add(nodeRowMap); - } - } - } + if("all".equals(field)) { + for (RowMap nodeRowMap : nodeRowMaps) { + nodeHandleMaps.add(nodeRowMap); + } + }else { + nodeHandleMaps = new ArrayList<>(); + fieldList = new ArrayList(); + fieldList = GetNodesUtil.getChildFrame(field,"", fieldList); + for (Map fieldMap : fieldList) { + String fieldID = String.valueOf(fieldMap.get("FRAMEID")); + for (RowMap nodeRowMap : nodeRowMaps) { + if (nodeRowMap.getString("PLPARENTID").equals(fieldID)) { + nodeHandleMaps.add(nodeRowMap); + } + } + } + + } nodeRowMaps = nodeHandleMaps; } @@ -1731,17 +1756,24 @@ public class ProcessPubService extends ActionWeb { String operationOLNodeRate = "0"; if (null!=field && !field.equals("")) { - nodeHandleMaps = new ArrayList<>(); - fieldList = new ArrayList(); - fieldList = GetNodesUtil.getChildFrame(field,"", fieldList); - for (Map fieldMap : fieldList) { - String fieldID = String.valueOf(fieldMap.get("FRAMEID")); - for (RowMap nodeRowMap : nodeRowMaps) { - if (nodeRowMap.getString("PLPARENTID").equals(fieldID)) { - nodeHandleMaps.add(nodeRowMap); - } - } - } + if("all".equals(field)) { + for (RowMap fileRowMap : nodeRowMaps) { + nodeHandleMaps.add(fileRowMap); + } + }else { + nodeHandleMaps = new ArrayList<>(); + fieldList = new ArrayList(); + fieldList = GetNodesUtil.getChildFrame(field,"", fieldList); + for (Map fieldMap : fieldList) { + String fieldID = String.valueOf(fieldMap.get("FRAMEID")); + for (RowMap nodeRowMap : nodeRowMaps) { + if (nodeRowMap.getString("PLPARENTID").equals(fieldID)) { + nodeHandleMaps.add(nodeRowMap); + } + } + } + + } nodeRowMaps = nodeHandleMaps; } diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/ToPageService.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/ToPageService.java index 1a7bae23..1d001b4f 100644 --- a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/ToPageService.java +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/ToPageService.java @@ -265,7 +265,7 @@ public class ToPageService extends ActionWeb { } fileMaps.add(fileMap); } - List fileTreeNodes = TreeUtil.buildTree(fileMaps,null,"frame",null,null); + List fileTreeNodes = TreeUtil.buildTree("1",fileMaps,null,"frame",null,null); ro.put("fileMaps",fileTreeNodes); return ro.toString(); } else { diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/util/TreeUtil.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/util/TreeUtil.java index 91ad505d..2be151df 100644 --- a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/util/TreeUtil.java +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/util/TreeUtil.java @@ -17,8 +17,19 @@ public class TreeUtil { //rootSign 根节点标识 //tLevel 节点层级,用于指定展示层数 //nodeType 节点类型,用于多数据类型合并 - public static List buildTree(List nodeMaps,String rootSign,String rootNodeType,String tLevel,String nodeType){ + public static List buildTree(String type,List nodeMaps,String rootSign,String rootNodeType,String tLevel,String nodeType){ List treeNodes =new ArrayList<>(); + if("1".equals(type)) { + HashMap deptNode = new HashMap<>(); + nodeType = "dept"; + deptNode.put("ID","all"); + deptNode.put("PARENTID","0"); + deptNode.put("name","全部"); + deptNode.put("ORDERINDEX","1"); + deptNode.put("TLEVEL",""); + deptNode.put("nodeType", "dept"); + treeNodes.add(deptNode); + } for (Map treeNode : getRootNode(nodeMaps,rootSign,rootNodeType)) { treeNode = buildChildTree(treeNode,nodeMaps,tLevel,nodeType); treeNodes.add(treeNode);