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 5c1b343a..220df5b8 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 @@ -9,6 +9,7 @@ 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.CoeProcessLevelDaoFacotory; 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; @@ -36,7 +37,7 @@ public class CreateOutputReportJob implements IJob { String jobParameter = SDK.getJobAPI().getJobParameter(jobExecutionContext); - //CARA1(); + CARA1(); /* * System.err.println("本次共新增手册:" + createNum); System.err.println("本次共更新手册:" + * updateNum); @@ -175,14 +176,15 @@ public class CreateOutputReportJob implements IJob { } - + //批量发布文件 public void CARA1() { int updateNum = 0; int createNum = 0; UserContext _uc = UserContext.fromUID("admin"); ProcessInstance createProcessInstance = SDK.getProcessAPI().createProcessInstance("obj_7cb02971312c47febd508bdffa122614", "admin", "批量发布文件-"); TaskInstance taskInst = SDK.getProcessAPI().start(createProcessInstance).fetchActiveTasks().get(0); - String sql = "SELECT PLID,PLNAME FROM BO_EU_PAL_OUTPUTREPORT WHERE RESULT != '手册转换成功!'"; + //String sql = "SELECT PLID,PLNAME FROM BO_EU_PAL_OUTPUTREPORT WHERE RESULT != '手册转换成功!'"; + String sql = "SELECT PLNAME FROM BO_EU_PAL_PLFB "; BO bo = new BO(); bo.set("OPTIONTYPE", "流程制度发布"); bo.set("PROCESS_TITLE", "文件发布_批量发布"); @@ -192,24 +194,34 @@ public class CreateOutputReportJob implements IJob { List maps = DBSql.getMaps(sql); System.err.println("批量发布文件数量为:"+maps.size()); for (RowMap rowMap : maps) { - subBo = new BO(); - String uuid = rowMap.getString("PLID"); - subBo.set("PUBLISTHTYPE", "N"); - subBo.set("PUBLISHFILENAME", rowMap.getString("PLNAME")); - subBo.set("PUBLISHDESC", "批量发布"); - subBo.set("PUBLISHFILEID", uuid); - PALRepositoryModel model = PALRepositoryCache.getCache().get(uuid); - String sqly = "UPDATE BO_ACT_COE_PUBLISH_N SET PUBLISHDESC ='待删除' WHERE PUBLISHFILEID = '"+uuid+"'"; - DBSql.update(sqly); - String taskId = "N"; - try { - System.err.println("批量转换模型名称=========>"+rowMap.getString("PLNAME")); - taskId = createOutputReport(model, "7d3ca852-a0bd-42e6-80b1-3dcea6f55083", "admin","", uuid); - System.err.println("批量转换模型名称=========>"+rowMap.getString("PLNAME")+"===>"+taskId); - } catch (Exception e) { + String plname = rowMap.getString("PLNAME"); + if(UtilString.isNotEmpty(plname)) { + PALRepositoryModel repositoryByName = getRepositoryByName("7d3ca852-a0bd-42e6-80b1-3dcea6f55083", plname); + //String sqls = "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME = '"+plname+"'"; + //System.err.println("======sqls======="+sqls); + if(repositoryByName!=null) { + subBo = new BO(); + //String uuid = rowMap.getString("PLID"); + String uuid = repositoryByName.getId(); + subBo.set("PUBLISTHTYPE", "N"); + subBo.set("PUBLISHFILENAME", plname); + subBo.set("PUBLISHDESC", "批量发布"); + subBo.set("PUBLISHFILEID", uuid); + PALRepositoryModel model = PALRepositoryCache.getCache().get(uuid); + String sqly = "UPDATE BO_ACT_COE_PUBLISH_N SET PUBLISHDESC ='待删除' WHERE PUBLISHFILEID = '"+uuid+"'"; + DBSql.update(sqly); + String taskId = "N"; + try { + System.err.println("批量转换模型名称=========>"+rowMap.getString("PLNAME")); + taskId = createOutputReport(model, "7d3ca852-a0bd-42e6-80b1-3dcea6f55083", "admin","", uuid); + System.err.println("批量转换模型名称=========>"+rowMap.getString("PLNAME")+"===>"+taskId); + } catch (Exception e) { + } + subBo.set("TASKID", taskId); + boList.add(subBo); + } - subBo.set("TASKID", taskId); - boList.add(subBo); + } } SDK.getBOAPI().create("BO_ACT_COE_PUBLISH_N", boList, createProcessInstance, _uc); @@ -250,6 +262,15 @@ public class CreateOutputReportJob implements IJob { return taskId; } - + public static PALRepositoryModel getRepositoryByName(String wsId, String repositoryName) { + List palRepositoryModels = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getAllCoeProcessLevelByWsId(wsId); + for (PALRepositoryModel palRepositoryModel : palRepositoryModels) { + + if (palRepositoryModel.getName().equals(repositoryName)&&palRepositoryModel.isUse()) { + return palRepositoryModel; + } + } + return null; + } } diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/CreateOutputReportJob2.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/CreateOutputReportJob2.java new file mode 100644 index 00000000..39a9e11b --- /dev/null +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/CreateOutputReportJob2.java @@ -0,0 +1,146 @@ +package com.actionsoft.apps.coe.pal.publisher.extend; + +import java.util.List; + +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; +import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager; +import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel; +import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; +import com.actionsoft.bpms.bo.engine.BO; +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.JSONObject; +import com.sun.org.apache.xalan.internal.xsltc.compiler.sym; +/** + * 批量修改文件发布状态 + * @author Administrator + * + */ +public class CreateOutputReportJob2 implements IJob { + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + + int updateNum = 0; + int createNum = 0; + String sqls = "DELETE FROM BO_EU__PAL_NULL_L"; + DBSql.update(sqls); + // String sql = "select ID from App_Act_Coe_Pal_Repository where PUBLISHDATE < + // to_date('2022/10/5 9:46:18 ','yyyy-mm-dd hh24:mi:ss')"; + // String sql = "select ID from App_Act_Coe_Pal_Repository where PUBLISHDATE > + // '2022/7/5 9:46:18'"; + String sql = "select ID from App_Act_Coe_Pal_Repository "; + // String sql = "select ID from App_Act_Coe_Pal_Repository where PLNAME = + // '测试文件测'"; + List maps = DBSql.getMaps(sql); + for (RowMap rowMap : maps) { + String id = rowMap.getString("ID"); + PALRepositoryModel model = PALRepositoryCache.getCache().get(id); + // 查询对应绩效模型中数据模型进行填充数据 + + /* + * String s = "SELECT * FROM BO_ACT_BATCH_PUBLIS_N WHERE PLNAME = '" + + * model.getName() + "'"; if (UtilString.isNotEmpty(DBSql.getString(s))) { + * String updataSql = + * "UPDATE App_Act_Coe_Pal_Repository SET ISPUBLISH = 0 , PUBLISHDATE = null WHERE ID = '" + * + id + "'"; updateNum += DBSql.update(updataSql); + * System.err.println("刷新为设计的模型:" + model.getName()); + * + * } + */ + if (model != null) { + CoeDesignerAPIManager instance = CoeDesignerAPIManager.getInstance(); + if (instance != null) { + BaseModel defineModel = null; + try { + defineModel = instance.getDefinition(id, 0); + } catch (Exception e) { + System.out.println("有问题的模型=====>" + model.getName()); + } + if (null == defineModel) { + } else { + String define = defineModel.getDefinition(); + JSONObject definition = JSONObject.parseObject(define); + JSONObject elements = definition.getJSONObject("elements"); + if (elements.size() == 0) { + BO bo = new BO(); + BO bo2 = new BO(); + bo.set("PLNAME", model.getName()); + PALRepositoryModel prmodel = PALRepositoryCache.getCache().get(model.getParentId()); + if (prmodel != null) { + bo.set("FRAMEWORK", prmodel.getName()); + bo2.set("FRAMEWORK", prmodel.getName()); + } + bo.set("VERSION", model.getVersion()); + bo2.set("VERSION", model.getVersion()); + if(model.isPublish()) { + bo.set("ISPUBLISH","已发布"); + bo2.set("ISPUBLISH","已发布"); + }else { + bo.set("ISPUBLISH","未发布"); + bo2.set("ISPUBLISH","未发布"); + } + String methodId = model.getMethodId(); + if (methodId.contains("data")) { + bo.set("TYPE", "表单"); + bo2.set("TYPE", "表单"); + createNum += SDK.getBOAPI().createDataBO("BO_EU__PAL_NULL_L", bo, UserContext.fromUID("admin")); + String sqlt ="UPDATE BO_EU_PAL_FILE1 SET FILESTATE = 0 WHERE PLNAME = '"+model.getName()+"'"; + int a = DBSql.update(sqlt); + if(a!=0) { + System.err.println("刷新为设计的模型:" +model.getName()); + updateNum += SDK.getBOAPI().createDataBO("BO_EU_PAL_FILE_NULL_L", bo2, UserContext.fromUID("admin")); + } + + } else if (methodId.contains("control.policy")) { + bo.set("TYPE", "制度"); + bo2.set("TYPE", "制度"); + createNum += SDK.getBOAPI().createDataBO("BO_EU__PAL_NULL_L", bo, UserContext.fromUID("admin")); + String sqlt ="UPDATE BO_EU_PAL_FILE1 SET FILESTATE = 0 WHERE PLNAME = '"+model.getName()+"'"; + int a = DBSql.update(sqlt); + if(a!=0) { + System.err.println("刷新为设计的模型:" +model.getName()); + updateNum += SDK.getBOAPI().createDataBO("BO_EU_PAL_FILE_NULL_L", bo2, UserContext.fromUID("admin")); + } + } else if (methodId.contains("process")) { + bo.set("TYPE", "流程"); + bo2.set("TYPE", "流程"); + createNum += SDK.getBOAPI().createDataBO("BO_EU__PAL_NULL_L", bo, UserContext.fromUID("admin")); + String sqlt ="UPDATE BO_EU_PAL_FILE1 SET FILESTATE = 0 WHERE PLNAME = '"+model.getName()+"'"; + int a = DBSql.update(sqlt); + if(a!=0) { + updateNum+=a; + System.err.println("刷新为设计的模型:" +model.getName()); + } + } + + + /* + * String updataSql = + * "UPDATE App_Act_Coe_Pal_Repository SET ISPUBLISH = 0 , PUBLISHDATE = null WHERE ID = '" + * + id + "'"; DBSql.update(updataSql); + */ + + + } + + } + } + + } + + } + System.err.println("更新文件表数量:" + updateNum); + System.err.println("本次共查询到的模型:" + createNum); + + } + + + +} diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/CreateProcessController.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/CreateProcessController.java new file mode 100644 index 00000000..e88f0c24 --- /dev/null +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/CreateProcessController.java @@ -0,0 +1,271 @@ +package com.actionsoft.apps.coe.pal.publisher.extend; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao; +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; +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.util.DBSql; +import com.actionsoft.bpms.util.UUIDGener; +import com.actionsoft.bpms.util.UtilString; +import com.actionsoft.sdk.local.SDK; +import com.alibaba.fastjson.JSONObject; + +import bsh.util.Util; + +/* + * 新建流程 + */ +@Controller +public class CreateProcessController { + @Mapping("com.awspaas.user.apps.xitongfankui.createProcess") + public JSONObject CheckUser(String sid,String processDefId) { + JSONObject result = new JSONObject(); + UserContext uc = UserContext.fromSessionId(sid); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + ProcessInstance processInst = SDK.getProcessAPI().createProcessInstance(processDefId, uc.getUID(), "流程管理平台问题反馈"+"-"+uc.getUserName()+"-"+df.format(new Date())); + TaskInstance taskInst = SDK.getProcessAPI().start(processInst).fetchActiveTasks().get(0); + String portalUrl = SDK.getPortalAPI().getPortalUrl(); + String url = portalUrl + "/r/w?sid=" + uc.getSessionId() + + "&cmd=CLIENT_BPM_FORM_MAIN_PAGE_OPEN&processInstId=" + processInst.getId() + "&taskInstId=" + + taskInst.getId() + "&openState=1&reloadedFile=1"; + result.put("url",url); + return result; + } + + + // 批量移动文件架构 + @Mapping("com.awspaas.user.apps.app.controller.movePalFile") + public ResponseObject move(String sid,String plname) { + ResponseObject ro = ResponseObject.newOkResponse(); + System.err.println("开始移动文件=======>"+plname); + String sql = "SELECT * FROM BO_EU_PAL_FRAMEWORK_TOOL WHERE RESULT NOT LIKE '%成功%' "; + if(UtilString.isNotEmpty(plname)) { + sql = "SELECT * FROM BO_EU_PAL_FRAMEWORK_TOOL WHERE PALNAME ='"+plname+"'"; + } + + List maps = DBSql.getMaps(sql); + System.err.println("maps===>"+maps); + if(maps.size()>0) { + 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.trim().equals(prName.trim())) { + 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 ro; + + } + + + @Mapping("com.awspaas.user.apps.xitongfankui.createPrem") + public JSONObject createPrem(String sid,String processDefId) { + JSONObject result = new JSONObject(); + UserContext uc = UserContext.fromSessionId(sid); + + + List list = SDK.getBOAPI().query("BO_ACT_PUBLISH_SCOPE_IMPORT").list(); + for (BO bos : list) { + String palName = bos.getString("PALNAME"); + String orgPerm = bos.getString("ORGPERM"); + String postPerm = bos.getString("POSTPERM"); + String levelPrem = bos.getString("LEVELPERM"); + String sendScope = bos.getString("SEND_SCOP"); + + StringBuffer orgSuccess = new StringBuffer(); + StringBuffer orgFail = new StringBuffer(); + + StringBuffer orgPermBuf = new StringBuffer(); + String[] orgPermArr = orgPerm.split(","); + for (String str : orgPermArr) { + String dsql = "SELECT ID FROM ORGDEPARTMENT WHERE DEPARTMENTNAME = '"+str+"'"; + String depId = DBSql.getString(dsql); + if(UtilString.isNotEmpty(depId)) { + if(str.equals(orgPermArr[orgPermArr.length-1])) { + orgPermBuf.append(depId); + }else { + orgPermBuf.append(depId).append(","); + } + + }else { + orgFail.append(str).append(","); + } + } + bos.set("ORGFAIL", orgFail); + + StringBuffer postFail = new StringBuffer(); + StringBuffer postPermBuf = new StringBuffer(); + String[] postPermArr = postPerm.split(","); + for (String str : postPermArr) { + String postNbrSql = "SELECT POSITION_NBR FROM BO_EU_ORG_POSTS WHERE DESCR = '"+str+"'"; + String postNbr = DBSql.getString(postNbrSql); + if(UtilString.isNotEmpty(postNbr)) { + if(str.equals(postPermArr[postPermArr.length-1])) { + postPermBuf.append(postNbr); + }else { + postPermBuf.append(postNbr).append(","); + } + + }else { + postFail.append(str).append(","); + } + } + bos.set("POSTFAIL", postFail); + StringBuffer levelFail = new StringBuffer(); + StringBuffer levelPremArrBuf = new StringBuffer(); + String[] levelPremArr = levelPrem.split(","); + for (String str : levelPremArr) { + String levelSql = "SELECT RANKSUB_NO FROM BO_ACT_PAL_LEVEL_SUB WHERE RANKSUB_NAME = '"+str+"'"; + String leveNo = DBSql.getString(levelSql); + if(UtilString.isNotEmpty(leveNo)) { + if(str.equals(levelPremArr[levelPremArr.length-1])) { + levelPremArrBuf.append(str); + }else { + levelPremArrBuf.append(str).append(","); + } + }else { + levelFail.append(str).append(","); + } + } + bos.set("LEVELFAIL", postFail); + + if("1".equals(sendScope)||orgPermBuf.length()!=0||postPermBuf.length()!=0||levelPremArrBuf.length()!=0) { + List premlist = new ArrayList<>(); + String sqls = "SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME = '"+palName+"'"; + List maps = DBSql.getMaps(sqls); + + Set removeIds = new HashSet<>(); + for (RowMap rowMap : maps) { + List delList = SDK.getBOAPI().query("BO_ACT_PUBLISH_PERM_SCOPE2").addQuery("PALVERSIONID=", rowMap.getString("PALVERSIONID")).list(); + if (delList != null && delList.size() > 0) { + for (BO del : delList) { + removeIds.add(del.getId()); + } + } + } + for (String removeId : removeIds) { + SDK.getBOAPI().remove("BO_ACT_PUBLISH_PERM_SCOPE2", removeId); + } + + + + for (RowMap rowMap : maps) { + + BO bo = new BO(); + bo.set("PERMID", UUIDGener.getUUID()); + bo.set("WSID", rowMap.getString("WSID")); + bo.set("PALVERSIONID", rowMap.getString("PLVERSIONID")); + bo.set("PALNAME", rowMap.getString("PLNAME")); + bo.set("PERMTYPE", sendScope); + bo.set("ORGPERM", orgPermBuf); + bo.set("POSTPERM", postPermBuf); + bo.set("LEVELPERM",levelPremArrBuf); + premlist.add(bo); + } + if (premlist.size() > 0) { + bos.set("RESULT", "导入成功!"); + SDK.getBOAPI().update("BO_ACT_PUBLISH_SCOPE_IMPORT", bos); + SDK.getBOAPI().createDataBO("BO_ACT_PUBLISH_PERM_SCOPE2", premlist, uc); + SDK.getLogAPI().consoleInfo("[发布范围权限信息保存至范围权限表]更新成功"); + } + + }else { + bos.set("RESULT", "导入失败!"); + SDK.getBOAPI().update("BO_ACT_PUBLISH_SCOPE_IMPORT", bos); + } + + + } + + return result; + } +} diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/SelectPremJob.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/SelectPremJob.java new file mode 100644 index 00000000..abfd5ca1 --- /dev/null +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/SelectPremJob.java @@ -0,0 +1,90 @@ +package com.actionsoft.apps.coe.pal.publisher.extend; + +import java.util.List; + +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; +import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory; +import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; +import com.actionsoft.bpms.bo.engine.BO; +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.sdk.local.SDK; +/** + * 模型附件去重 + * @author Administrator + * + */ +public class SelectPremJob implements IJob { + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + + List palRepositoryModels = CoeProcessLevelDaoFacotory.createCoeProcessLevel() + .getAllCoeProcessLevelByWsId("7d3ca852-a0bd-42e6-80b1-3dcea6f55083"); + for (PALRepositoryModel palRepositoryModel : palRepositoryModels) { + String methodId = palRepositoryModel.getMethodId(); + if (!palRepositoryModel.getName().contains("测试") && palRepositoryModel.isUse() + && ("process.epc".equals(methodId) || "control.policy".equals(methodId) + || "data.form".equals(methodId) || "process.flowchart".equals(methodId))) { + String versionId = palRepositoryModel.getVersionId(); + String sql = "SELECT * FROM BO_ACT_PUBLISH_PERM_SCOPE WHERE PALVERSIONID ='" + versionId + "'"; + RowMap map = DBSql.getMap(sql); + if (map == null) { + BO bo = new BO(); + bo.set("PALVERSIONID", versionId); + bo.set("PALNAME", palRepositoryModel.getName()); + int level = palRepositoryModel.getLevel(); + PALRepositoryModel prmodel = PALRepositoryCache.getCache().get(palRepositoryModel.getParentId()); + if (prmodel != null) { + String name = prmodel.getName(); + if (level == 2 || level == 5 || level == 6) { + if (name.contains("测试") || name.contains("练习")) { + continue; + } + } else if (level == 3) { + if (name.contains("测试") || name.contains("Test") || name.contains("培训")) { + continue; + } + } else if (level == 4) { + if (name.contains("测试") || name.contains("Test")) { + continue; + } + } + } + + if (prmodel != null) { + bo.set("FRNAME", prmodel.getName()); + } + bo.set("PALVERSIONID", versionId); + if ("process.epc".equals(methodId)) { + bo.set("FILETYPE", "流程模型"); + + } else if ("control.policy".equals(methodId)) { + bo.set("FILETYPE", "制度模型"); + + } else if ("data.form".equals(methodId)) { + bo.set("FILETYPE", "表单模型"); + + } else if ("process.flowchart".equals(methodId)) { + bo.set("FILETYPE", "泳道图模型"); + + } + if (palRepositoryModel.isPublish()) { + bo.set("IDPLUBSH", "已发布"); + } else { + bo.set("IDPLUBSH", "未发布"); + } + + SDK.getBOAPI().createDataBO("BO_EU_PUBLISH_SCOPE_IMPORT", bo, UserContext.fromUID("admin")); + } + + } + } + + } + +} 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 feb00a81..58352e9a 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 @@ -65,106 +65,6 @@ 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.")) {