From 0e3e13a62f884aaef1e8adbde9ce219cd72546da Mon Sep 17 00:00:00 2001 From: lihongyu <504404568@qq.com> Date: Fri, 14 Oct 2022 19:31:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=B5=81=E7=A8=8B=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extend/CreateOutputReportJob.java | 156 +++++++++++++++++- .../extend/PAlOnlinedocFileConvertJob.java | 11 +- .../extend/UpateFileStateController.java | 104 ++++++++++++ .../js/coe.pal.process.publish.multiple.js | 21 ++- 4 files changed, 275 insertions(+), 17 deletions(-) diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/CreateOutputReportJob.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/CreateOutputReportJob.java index f2354474..5c1b343a 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/CreateOutputReportJob.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/CreateOutputReportJob.java @@ -6,9 +6,12 @@ import java.util.List; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; +import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryAPIManager; import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager; import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; +import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao; import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; +import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil; import com.actionsoft.bpms.bo.engine.BO; import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance; import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance; @@ -16,7 +19,9 @@ import com.actionsoft.bpms.commons.database.RowMap; import com.actionsoft.bpms.schedule.IJob; 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; /** * 批量重新生成手册 @@ -29,6 +34,149 @@ public class CreateOutputReportJob implements IJob { public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { String jobParameter = SDK.getJobAPI().getJobParameter(jobExecutionContext); + + + //CARA1(); + /* + * System.err.println("本次共新增手册:" + createNum); System.err.println("本次共更新手册:" + + * updateNum); + */ + + } + + // 批量移动文件架构 + public void CARA3() { + System.err.println("开始移动文件=======>"); + String sql = "SELECT * FROM BO_EU_PAL_FRAMEWORK_TOOL where RESULT not like '%成功%'"; + List maps = DBSql.getMaps(sql); + for (RowMap rowMap : maps) { + String plName = rowMap.getString("PALNAME"); + String error = rowMap.getString("ERRORFRAMEWORK"); + String right = rowMap.getString("CORRECTFRAMEWORK"); + System.err.println("错误架构名=======>"+error); + System.err.println("正确架构名=======>"+right); + // 获取导入表的错误架构id + String sqlerror = "SELECT ID FROM App_Act_Coe_Pal_Repository WHERE PLNAME ='" + error + "'"; + String maperrorId = DBSql.getString(sqlerror); + + // 获取导入表的正确架构id + String sqlright = "SELECT ID FROM App_Act_Coe_Pal_Repository WHERE PLNAME ='" + right + "'"; + String maprightId = DBSql.getString(sqlright); + + // 获取文件id和父架构ID33 + String sqlS = "SELECT ID,PLPARENTID FROM App_Act_Coe_Pal_Repository WHERE PLNAME ='" + plName + "'"; + RowMap map = DBSql.getMap(sqlS); + String uuid = map.getString("ID"); + String prId = map.getString("PLPARENTID"); + // 获取文件库父架构名称 + String sqlT = "SELECT PLNAME FROM App_Act_Coe_Pal_Repository WHERE ID ='" + prId + "'"; + String prName = DBSql.getString(sqlT); + String prName3 = DBSql.getString(sqlT); + + String substring = right.substring(right.lastIndexOf(".") + 2); + // 判断是否是导入表的错误架构 + // + System.err.println("当前文件架构名=======>"+prName); + if (error.equals(prName)) { + String update = "UPDATE App_Act_Coe_Pal_Repository SET PLPARENTID = '" + maprightId + "' WHERE ID ='" + + uuid + "'"; + int update2 = DBSql.update(update); + PALRepositoryPropertyDao propertyDao = new PALRepositoryPropertyDao(); + + String name1 = right.substring(right.lastIndexOf(".") + 2).trim(); + // 设置三级架构名称 + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L3", name1); + + // 设置二级架构名称 + String sql2 = "SELECT PLPARENTID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + maprightId + "'"; + String prd2 = DBSql.getString(sql2); + String sqlp2 = "SELECT PLNAME,ID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + prd2 + "'"; + RowMap map2 = DBSql.getMap(sqlp2); + if (map2 != null) { + String uuid2 = map2.getString("ID"); + String plName2 = map2.getString("PLNAME"); + String name2 = plName2.substring(plName2.lastIndexOf(".") + 2).trim(); + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", name2); + + // 设置一级架构名称 + String sql1 = "SELECT PLPARENTID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + uuid2 + "'"; + String prd1 = DBSql.getString(sql1); + String sqlp1 = "SELECT PLNAME,ID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + prd1 + "'"; + RowMap map1 = DBSql.getMap(sqlp1); + + if (map1 != null) { + String uuid1 = map1.getString("ID"); + String plName1 = map1.getString("PLNAME"); + String name3 = plName1.substring(plName1.lastIndexOf(".") + 2).trim(); + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L1", name3); + + } else { + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L3", "/"); + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L1", name2); + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", name1); + } + + } else { + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", "/"); + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L3", "/"); + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L1", name1); + + } + String result = "文件从【"+error+"】移动到【"+right+"】成功!"; + String updateSql = "UPDATE BO_EU_PAL_FRAMEWORK_TOOL SET RESULT = '"+result+"',PAID = '"+uuid+"' WHERE PALNAME = '"+plName+"'"; + DBSql.update(updateSql); + + }else { + String updateSql = "UPDATE BO_EU_PAL_FRAMEWORK_TOOL SET RESULT ='文件移动失败,架构不匹配!' WHERE PALNAME = '"+plName+"'"; + DBSql.update(updateSql); + } + } + + } + + public static String getQuantity(String regular){ + int index = 0; + for (int i = 0; i < regular.length(); i++) { + char c = regular.charAt(i); + if (Character.isDigit(c)) { + if (i == regular.length() - 1) { + index = i + 1; + } else { + index = i; + } + continue; + } else { + index = i; + break; + } + } + return regular.substring(0, index); + } + + + public void CARA2() { + String sql1 = "SELECT PUBLISHFILEID FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHDESC = '批量发布'"; + List maps = DBSql.getMaps(sql1); + for (RowMap rowMap : maps) { + String uuid = rowMap.getString("PUBLISHFILEID"); + String sql2 = "SELECT PUBLISHFILEID FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID = '"+uuid+"' AND PUBLISHDESC ='待删除'"; + String uuid2 = DBSql.getString(sql2); + if(UtilString.isNotEmpty(uuid2)) { + String sql = "DELETE FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID = '"+uuid+"' AND PUBLISHDESC ='待删除'"; + int update = DBSql.update(sql1); + System.out.println("删除N表=======>"+update); + String sqls = "SELECT PLVERSIONID FROM App_Act_Coe_Pal_Repository WHERE ID = '"+uuid+"'"; + String versionId = DBSql.getString(sqls); + String sqlt = "DELETE FROM app_act_coe_pal_publish_list WHERE PALREPOSITORYID = '"+versionId+"' "; + int update2 = DBSql.update(sqlt); + System.out.println("删除List表=======>"+update2); + } + } + + + } + + public void CARA1() { int updateNum = 0; int createNum = 0; UserContext _uc = UserContext.fromUID("admin"); @@ -65,12 +213,10 @@ public class CreateOutputReportJob implements IJob { } SDK.getBOAPI().create("BO_ACT_COE_PUBLISH_N", boList, createProcessInstance, _uc); - /* - * System.err.println("本次共新增手册:" + createNum); System.err.println("本次共更新手册:" + - * updateNum); - */ - + + } + /** * 创建手册 * @param model diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/PAlOnlinedocFileConvertJob.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/PAlOnlinedocFileConvertJob.java index e0c433fe..1607b9c0 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/PAlOnlinedocFileConvertJob.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/PAlOnlinedocFileConvertJob.java @@ -4,8 +4,6 @@ import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -17,9 +15,7 @@ import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppProfile; import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel; import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; -import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel; import com.actionsoft.apps.resource.AppContext; -import com.actionsoft.bpms.api.Utils; import com.actionsoft.bpms.bo.engine.BO; import com.actionsoft.bpms.commons.database.RowMap; import com.actionsoft.bpms.commons.mvc.view.ResponseObject; @@ -33,7 +29,6 @@ import com.actionsoft.bpms.util.UtilFile; import com.actionsoft.bpms.util.UtilString; import com.actionsoft.sdk.local.SDK; import com.actionsoft.sdk.local.api.AppAPI; -import com.alibaba.fastjson.JSONObject; /** * 模型附件去重 * @author Administrator @@ -63,7 +58,11 @@ public class PAlOnlinedocFileConvertJob implements IJob { String sqld = "SELECT BINDID FROM BO_ACT_COE_PUBLISH_N WHERE TASKID = '" + taskId + "'"; String bindid = DBSql.getString(sqld); if (!"7964be16-dc8b-41b1-a10a-bc8a84885074".equals(bindid)) { - outputReportPreview(fromSessionId, session, taskId, plId); + try { + outputReportPreview(fromSessionId, session, taskId, plId); + } catch (Exception e) { + // TODO: handle exception + } } /* diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/UpateFileStateController.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/UpateFileStateController.java index 48570a3d..feb00a81 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/UpateFileStateController.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/UpateFileStateController.java @@ -1,11 +1,15 @@ package com.actionsoft.apps.coe.pal.publisher.extend; +import java.util.List; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager; import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; +import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao; import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; +import com.actionsoft.bpms.commons.database.RowMap; import com.actionsoft.bpms.commons.mvc.view.ResponseObject; import com.actionsoft.bpms.server.bind.annotation.Controller; import com.actionsoft.bpms.server.bind.annotation.Mapping; @@ -61,6 +65,106 @@ public class UpateFileStateController { return ro; } + + // 批量移动文件架构 + @Mapping("com.awspaas.user.apps.app.controller.movePalFile") + public ResponseObject move(String sid,String plname) { + ResponseObject ro = ResponseObject.newOkResponse(); + System.err.println("开始移动文件=======>"); + String sql = "SELECT * FROM BO_EU_PAL_FRAMEWORK_TOOL"; + if(UtilString.isNotEmpty(plname)) { + sql = "SELECT * FROM BO_EU_PAL_FRAMEWORK_TOOL WHERE ='"+plname+"'"; + } + List maps = DBSql.getMaps(sql); + for (RowMap rowMap : maps) { + String plName = rowMap.getString("PALNAME"); + String error = rowMap.getString("ERRORFRAMEWORK"); + String right = rowMap.getString("CORRECTFRAMEWORK"); + // 获取导入表的错误架构id + String sqlerror = "SELECT ID FROM App_Act_Coe_Pal_Repository WHERE PLNAME ='" + error + "'"; + String maperrorId = DBSql.getString(sqlerror); + + // 获取导入表的正确架构id + String sqlright = "SELECT ID FROM App_Act_Coe_Pal_Repository WHERE PLNAME ='" + right + "'"; + String maprightId = DBSql.getString(sqlright); + + // 获取文件id和父架构ID33 + String sqlS = "SELECT ID,PLPARENTID FROM App_Act_Coe_Pal_Repository WHERE PLNAME ='" + plName + "'"; + RowMap map = DBSql.getMap(sqlS); + String uuid = map.getString("ID"); + String prId = map.getString("PLPARENTID"); + // 获取文件库父架构名称 + String sqlT = "SELECT PLNAME FROM App_Act_Coe_Pal_Repository WHERE ID ='" + prId + "'"; + String prName = DBSql.getString(sqlT); + String prName3 = DBSql.getString(sqlT); + + String substring = right.substring(right.lastIndexOf(".") + 2); + // 判断是否是导入表的错误架构 + // + System.err.println("当前文件架构名=======>"+prName); + if (error.equals(prName)) { + String update = "UPDATE App_Act_Coe_Pal_Repository SET PLPARENTID = '" + maprightId + "' WHERE ID ='" + + uuid + "'"; + int update2 = DBSql.update(update); + PALRepositoryPropertyDao propertyDao = new PALRepositoryPropertyDao(); + + String name1 = right.substring(right.lastIndexOf(".") + 2).trim(); + // 设置三级架构名称 + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L3", name1); + + // 设置二级架构名称 + String sql2 = "SELECT PLPARENTID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + maprightId + "'"; + String prd2 = DBSql.getString(sql2); + String sqlp2 = "SELECT PLNAME,ID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + prd2 + "'"; + RowMap map2 = DBSql.getMap(sqlp2); + if (map2 != null) { + String uuid2 = map2.getString("ID"); + String plName2 = map2.getString("PLNAME"); + String name2 = plName2.substring(plName2.lastIndexOf(".") + 2).trim(); + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", name2); + + // 设置一级架构名称 + String sql1 = "SELECT PLPARENTID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + uuid2 + "'"; + String prd1 = DBSql.getString(sql1); + String sqlp1 = "SELECT PLNAME,ID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + prd1 + "'"; + RowMap map1 = DBSql.getMap(sqlp1); + + if (map1 != null) { + String uuid1 = map1.getString("ID"); + String plName1 = map1.getString("PLNAME"); + String name3 = plName1.substring(plName1.lastIndexOf(".") + 2).trim(); + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L1", name3); + + } else { + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L3", "/"); + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L1", name2); + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", name1); + } + + } else { + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", "/"); + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L3", "/"); + propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L1", name1); + + } + + ro.put("result", "ok"); + String result = "文件从【"+error+"】移动到【"+right+"】成功!"; + String updateSql = "UPDATE BO_EU_PAL_FRAMEWORK_TOOL SET RESULT = '"+result+"',PAID = '"+uuid+"' WHERE PALNAME = '"+plName+"'"; + DBSql.update(updateSql); + + }else { + ro.put("result", "error"); + String updateSql = "UPDATE BO_EU_PAL_FRAMEWORK_TOOL SET RESULT ='文件移动失败,架构不匹配!' WHERE PALNAME = '"+plName+"'"; + DBSql.update(updateSql); + } + } + return null; + + } + + + private String createOutputReport(PALRepositoryModel model, String wsId, String userId, String teamId, String uuid) { String taskId = ""; if (model.getMethodId().contains("process.")) { diff --git a/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/coe.pal.process.publish.multiple.js b/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/coe.pal.process.publish.multiple.js index 2bdc27c7..1958b9a9 100644 --- a/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/coe.pal.process.publish.multiple.js +++ b/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/coe.pal.process.publish.multiple.js @@ -49,7 +49,7 @@ $(document).ready(function(){ initPagination();// 初始化页码 initOptButton(); - listenCloseEvent();// 关闭窗口执行,关闭窗口/刷新都会造成流程实例被删除,注释掉 + //listenCloseEvent();// 关闭窗口执行,关闭窗口/刷新都会造成流程实例被删除,注释掉 }) @@ -306,9 +306,9 @@ function initHtml() { changeHtml += ''; changeHtml += ''; changeHtml += '序号'; - changeHtml += '流程制度模型'; - changeHtml += '变更后流程制度模型'; - changeHtml += '文件预览'; + changeHtml += '流程制度模型'; + changeHtml += '变更后流程制度模型'; + changeHtml += '文件预览'; changeHtml += '文件编号'; changeHtml += ''; changeHtml += ''; @@ -1277,11 +1277,11 @@ function getNewPublishBatchResult(type) { var L3old = ui("LEVEL_3_PROCESS_NAME"); if((L1old != '' && L1 != L1old) || (L2old != '' && L2 != L2old) || (L3old != '' && L3 != L3old)){ $('#publisher_dialog').find('div.dlg-button').find('button:first').prop('disabled', ''); - $.simpleAlert("只能选择同一级别下的流程,请重新选择"); + alert("只能选择同一级别下的流程,请重新选择"); return; }else if(info == true){ $('#publisher_dialog').find('div.dlg-button').find('button:first').prop('disabled', ''); - $.simpleAlert("只能选择同一级别下的流程,请重新选择"); + alert("只能选择同一级别下的流程,请重新选择"); return; }else{ @@ -2072,6 +2072,15 @@ function saveFormData(type) { // 点击办理时的校验+保存字表 function formSave(isTransact){ + + if(isTransact==true){ + uiRequiredClass("PROCESS_TITLE", isShow); + uiRequiredClass("SEND_SCOPE", isShow); + uiRequiredClass("ADAPT_NAME_THE_COMPANY", isShow); + uiRequiredClass("APPLICABLE_PRODUCT", isShow); + uiRequiredClass("ADAPT_REGION_NAME", isShow); + } + if (!editPerm) {// 只读状态不处理 return true; }