From 5a30e38f842907389500ad959e7f8fc07cee9709 Mon Sep 17 00:00:00 2001 From: xiejun <xiejun@vci-tech.com> Date: 星期四, 22 八月 2024 16:29:25 +0800 Subject: [PATCH] 表单表格功能添加 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebProcessCommandServiceImpl.java | 221 +++++++++++++++++++++++++++++-------------------------- 1 files changed, 117 insertions(+), 104 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebProcessCommandServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebProcessCommandServiceImpl.java index 5efa41b..6e662f9 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebProcessCommandServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebProcessCommandServiceImpl.java @@ -1,11 +1,19 @@ package com.vci.web.service.impl; -import com.vci.client.bof.ClientLinkObject; +import com.vci.corba.common.PLException; import com.vci.corba.common.data.UserEntityInfo; +import com.vci.corba.omd.data.BusinessObject; +import com.vci.corba.omd.data.LinkObject; import com.vci.corba.workflow.data.FlowInstanceInfo; import com.vci.corba.workflow.data.MapTransfersInfo; import com.vci.corba.workflow.data.TasksAssignedInfo; -import com.vci.file.dto.VciFileObjectDTO; +import com.vci.dto.ProcessTemplateVO; +import com.vci.dto.VciFileObjectDTO; +import com.vci.omd.utils.ObjectTool; +import com.vci.pagemodel.ProcessNodeVO; +import com.vci.pagemodel.ProcessOutcomeVO; +import com.vci.pagemodel.ProcessTaskVO; +import com.vci.pagemodel.ProcessUserVO; import com.vci.starter.web.constant.QueryOptionConstant; import com.vci.starter.web.enumpck.DataSecretEnum; import com.vci.starter.web.exception.VciBaseException; @@ -16,11 +24,10 @@ import com.vci.web.annotation.FlowNotifyAfter; import com.vci.web.annotation.FlowNotifyBefore; import com.vci.web.annotation.FlowNotifyWeb; -import com.vci.web.bo.FlowNoticeInfo; -import com.vci.web.constant.WFVariablesKeyConstant; +import com.vci.bo.FlowNoticeInfo; +import com.vci.constant.WFVariablesKeyConstant; import com.vci.web.dao.WebProcessDaoI; -import com.vci.web.dto.ProcessStartConfigDTO; -import com.vci.web.pageModel.*; +import com.vci.dto.ProcessStartConfigDTO; import com.vci.web.properties.WebProperties; import com.vci.web.service.*; import com.vci.web.util.BusAnnotationUtil; @@ -92,6 +99,13 @@ return false; } + /** + * 鍚姩娴佺▼ + * @param config 鍚姩娴佺▼鐩稿叧閰嶇疆 + * @param processNodeUsers 鍚勪釜鑺傜偣鐨勮礋璐d汉淇℃伅 + * @param variablesInfo 鐩稿叧鍙橀噺 + * @throws VciBaseException + */ @Override public void startProcess(ProcessStartConfigDTO config, Map<String, List<ProcessUserVO>> processNodeUsers, @@ -106,7 +120,6 @@ if (config.getTitle().length() > 127) { config.setTitle(config.getTitle().substring(0, 127)); } - //SessionInfo si = WebUtil.getSessionInfo(request); //weidy淇敼鑾峰彇褰撳墠鐢ㄦ埛鐨勬柟娉� SessionInfo si = WebUtil.getCurrentUserSessionInfo(); @@ -146,7 +159,7 @@ Map<String, String> conditionMap = WebUtil.getOidQuery(config.getOids()); conditionMap.put(WebBoServiceI.QUERY_FILTER_SECRET, "false"); conditionMap.put(WebBoServiceI.QUERY_FILTER_DATARIGHT, "false"); - List<com.vci.client.bof.ClientBusinessObject> allCbo = boService.queryCBO(config.getBtmType().toLowerCase().trim(), conditionMap); + List<BusinessObject> allCbo = boService.queryCBO(config.getBtmType().toLowerCase().trim(), conditionMap); if (allCbo == null || allCbo.size() == 0) { throw new VciBaseException(msgCodePrefix + "dataNotNull", new String[]{}); } @@ -154,11 +167,11 @@ //鏌ヨ鏁版嵁鏄惁宸茬粡鍙戣捣浜嗘祦绋� //鏌ヨinput杩炴帴閲屾槸涓嶆槸鏈夋祦绋嬪疄渚嬶紝骞朵笖娴佺▼瀹炰緥涓嶇瓑浜庣粓姝� conditionMap.put("oid", " in (select f_oid from platformlt_" + processDao.getTaskDataLink() + " where oid " + conditionMap.get("oid").replace("\\IN", " in ") + ")"); - List<com.vci.client.bof.ClientBusinessObject> workInstanceCbos = boService.queryCBO(processDao.getWorkIntanceBtmType(), conditionMap); + List<BusinessObject> workInstanceCbos = boService.queryCBO(processDao.getWorkIntanceBtmType(), conditionMap); if (workInstanceCbos != null && workInstanceCbos.size() > 0) { - for (com.vci.client.bof.ClientBusinessObject workInstance : workInstanceCbos) { - if (!workInstance.getLcStatus().equalsIgnoreCase("Obsoleted")) { - throw new VciBaseException(msgCodePrefix + "dataSubmitedToProcess", new String[]{workInstance.getName(), workInstance.getCreator()}); + for (BusinessObject workInstance : workInstanceCbos) { + if (!workInstance.lcStatus.equalsIgnoreCase("Obsoleted")) { + throw new VciBaseException(msgCodePrefix + "dataSubmitedToProcess", new String[]{workInstance.name, workInstance.creator}); } } } @@ -167,14 +180,14 @@ String[][] objectPropertyValues = new String[allCbo.size()][4]; String[] objIds = new String[allCbo.size()];//涓氬姟鏁版嵁鐨勭粍浠� for (int i = 0; i < allCbo.size(); i++) { - com.vci.client.bof.ClientBusinessObject cbo = allCbo.get(i); + BusinessObject cbo = allCbo.get(i); String[] values = new String[4]; - values[0] = cbo.getOid(); - values[1] = cbo.getRevisionid(); - values[2] = cbo.getNameoid(); - values[3] = cbo.getBtmName(); + values[0] = cbo.oid; + values[1] = cbo.revisionid; + values[2] = cbo.nameoid; + values[3] = cbo.btName; objectPropertyValues[i] = values; - objIds[i] = cbo.getOid(); + objIds[i] = cbo.oid; } FlowInstanceInfo flowInstanceInfo = new FlowInstanceInfo(); @@ -192,7 +205,7 @@ long currentTime =0L; try{ -// currentTime = platformClientUtil.getLogonFactoryService().getFrameworkService().getSystemTime(); + currentTime = platformClientUtil.getFrameworkService().getSystemTime(); }catch (Throwable e){ throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[0],e); } @@ -203,50 +216,50 @@ noticeInfo.setProcessTemplateVO(template); BusAnnotationUtil.callForAnnotation(FlowNotifyWeb.class, FlowNotifyBefore.class,noticeInfo); String processInstanceId = ""; -// try { -// if (config.isAutoSubmitFirst()) { -// processInstanceId = processDao.getWorkService().startProcessAndExecuteFirstNode(template.getOid(), -// flowInstanceInfo, -// objIds, -// getUserEntityInfo(), -// firstNodeUserNames, -// "", -// allTaskName, -// allTaskNameUsers, -// allVariables, -// objectPropertyKeys, -// objectPropertyValues); -// }else{ -// processInstanceId = processDao.getWorkService().startPocessByPLM_v1( -// /** -// * String processDefinitionKey, 娴佺▼妯℃澘涓婚敭 -// * FlowInstanceInfo flowInstanceInfo, 娴佺▼瀹炰緥 -// * String[] objId, 鏁版嵁瀵硅薄id -// * UserEntityInfo userEntityInfo, 鐢ㄦ埛Info -// * String[] userName, 鐢ㄦ埛鍚� -// * String outcome, 鎸囧悜 -// * String[] tasknames, 涓氬姟鍚嶇О -// * String[][] taskUserNames, 鎵�灞炵敤鎴峰悕 -// * MapTransfersInfo[] mapTransfersInfos, 绉讳氦Info -// * String[] objectProperty, 涓氬姟灞炴�� -// * String[][] objectPropertyValues 涓氬姟灞炴�у�� -// */ -// template.getOid(), -// flowInstanceInfo, -// objIds, -// getUserEntityInfo(), -// firstNodeUserNames, -// "", -// allTaskName, -// allTaskNameUsers, -// allVariables, -// objectPropertyKeys, -// objectPropertyValues -// ); -// } -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } + try { + if (config.isAutoSubmitFirst()) { + processInstanceId = processDao.getWorkService().startProcessAndExecuteFirstNode(template.getOid(), + flowInstanceInfo, + objIds, + getUserEntityInfo(), + firstNodeUserNames, + "", + allTaskName, + allTaskNameUsers, + allVariables, + objectPropertyKeys, + objectPropertyValues); + }else{ + processInstanceId = processDao.getWorkService().startPocessByPLMv1( + /** + * String processDefinitionKey, 娴佺▼妯℃澘涓婚敭 + * FlowInstanceInfo flowInstanceInfo, 娴佺▼瀹炰緥 + * String[] objId, 鏁版嵁瀵硅薄id + * UserEntityInfo userEntityInfo, 鐢ㄦ埛Info + * String[] userName, 鐢ㄦ埛鍚� + * String outcome, 鎸囧悜 + * String[] tasknames, 涓氬姟鍚嶇О + * String[][] taskUserNames, 鎵�灞炵敤鎴峰悕 + * MapTransfersInfo[] mapTransfersInfos, 绉讳氦Info + * String[] objectProperty, 涓氬姟灞炴�� + * String[][] objectPropertyValues 涓氬姟灞炴�у�� + */ + template.getOid(), + flowInstanceInfo, + objIds, + getUserEntityInfo(), + firstNodeUserNames, + "", + allTaskName, + allTaskNameUsers, + allVariables, + objectPropertyKeys, + objectPropertyValues + ); + } + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } if (StringUtils.isNotBlank(config.getStartStatus())) { lifeCycleService.transCboStatus(allCbo, config.getStartStatus()); } @@ -260,7 +273,7 @@ private void callBefore(List<Map> preWorkitemList,String outcome,String note,long currentTime){ if(currentTime == 0L) { try { -// currentTime = platformClientUtil.getLogonFactoryService().getFrameworkService().getSystemTime(); + currentTime = platformClientUtil.getFrameworkService().getSystemTime(); } catch (Throwable e) { throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[0], e); } @@ -471,15 +484,15 @@ Map<String, String> conditionMap = new HashMap<String, String>(); conditionMap.put("f_btwname", processDao.getWorkitemBtmType()); conditionMap.put("f_oid", QueryOptionConstant.IN + "(" + WebUtil.toInSql(taskIds) + ")"); - List<ClientLinkObject> allLinkData = loService.queryCLO(processDao.getTaskDataLink(), conditionMap); + List<LinkObject> allLinkData = loService.queryCLO(processDao.getTaskDataLink(), conditionMap); String[][] objectPropertyValues = new String[allLinkData.size()][4]; for (int i = 0; i < allLinkData.size(); i++) { - ClientLinkObject clo = allLinkData.get(i); + LinkObject clo = allLinkData.get(i); String[] values = new String[4]; - values[0] = clo.getToOid(); - values[1] = clo.getToRevisionOid(); - values[2] = clo.getToNameOid(); - values[3] = clo.getToBTMName(); + values[0] = clo.toOid; + values[1] = clo.toRevOid; + values[2] = clo.toNameOid; + values[3] = clo.toBTName; objectPropertyValues[i] = values; } if ("鏈懡鍚嶈矾鐢�".equalsIgnoreCase(outCome)) { @@ -488,20 +501,20 @@ List<Map> workitemList = processDao.getTaskCBOByOid(taskIds); long currentTime = 0L; try { -// currentTime = platformClientUtil.getLogonFactoryService().getFrameworkService().getSystemTime(); + currentTime = platformClientUtil.getFrameworkService().getSystemTime(); } catch (Throwable e) { throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[0], e); } callBefore(workitemList,outCome,note,currentTime); -// try { -// if (jbpmTaskIds.length == 1) { -// processDao.getWorkService().completeTaskByPlatform_v1(jbpmTaskIds[0], outCome, nextTaskName, note, getUserEntityInfo(), nextTaskUsers, objectPropertyKeys, objectPropertyValues); -// } else { -// processDao.getWorkService().completeTasksByPlatform_v1(jbpmTaskIds, outCome, nextTaskName, note, getUserEntityInfo(), nextTaskUsers, objectPropertyKeys, objectPropertyValues); -// } -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } + try { + if (jbpmTaskIds.length == 1) { + processDao.getWorkService().completeTaskByPlatformv1(jbpmTaskIds[0], outCome, nextTaskName, note, getUserEntityInfo(), nextTaskUsers, objectPropertyKeys, objectPropertyValues); + } else { + processDao.getWorkService().completeTasksByPlatformv1(jbpmTaskIds, outCome, nextTaskName, note, getUserEntityInfo(), nextTaskUsers, objectPropertyKeys, objectPropertyValues); + } + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } callAfter((String)workitemList.get(0).get("executionid"),null,workitemList,currentTime); } @@ -528,11 +541,11 @@ String[] taskOidArray = taskOids.split(","); for (String taskOid : taskOidArray) { if (StringUtils.isNotBlank(taskOid)) { -// try { -// processDao.getWorkService().transmitTask(taskOid, "user:" + userIds, getUserEntityInfo()); -// } catch (VCIError vciError) { -// throw WebUtil.getVciBaseException(vciError); -// } + try { + processDao.getWorkService().transmitTask(taskOid, "user:" + userIds, getUserEntityInfo()); + } catch (PLException vciError) { + throw WebUtil.getVciBaseException(vciError); + } } } } @@ -564,7 +577,7 @@ WebUtil.alertNotNull(executionId, "娴佺▼鎵ц瀹炰緥鐨勪富閿�"); long currentTime = 0L; try { -// currentTime = platformClientUtil.getLogonFactoryService().getFrameworkService().getSystemTime(); + currentTime = platformClientUtil.getFrameworkService().getSystemTime(); } catch (Throwable e) { throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[0], e); } @@ -592,30 +605,30 @@ //鏌ヨ娴佺▼瀹炰緥 Map<String, String> conditionMap = new HashMap<String, String>(); conditionMap.put("executionid", executionId.trim() + "*");//浼氭湁瀛愭祦绋� - List<com.vci.client.bof.ClientBusinessObject> workInstanceCbos = boService.queryCBO(processDao.getWorkIntanceBtmType(), conditionMap); + List<BusinessObject> workInstanceCbos = boService.queryCBO(processDao.getWorkIntanceBtmType(), conditionMap); if (workInstanceCbos == null || workInstanceCbos.size() == 0) { throw new VciBaseException(msgCodePrefix + "executionNotExist"); } //鍒ゆ柇鏄惁閮芥槸鎵ц鐘舵�侊紝鍓嶇鐨勫垽鏂兘琚烦杩� - List<com.vci.client.bof.ClientBusinessObject> needUpdateCbos = new ArrayList<>(); + List<BusinessObject> needUpdateCbos = new ArrayList<>(); List<String> workInstanceOids = new ArrayList<String>(); - for (com.vci.client.bof.ClientBusinessObject cbo : workInstanceCbos) { - if (!cbo.getLcStatus().equalsIgnoreCase("Executing")) { + for (BusinessObject cbo : workInstanceCbos) { + if (!cbo.lcStatus.equalsIgnoreCase("Executing")) { throw new VciBaseException(msgCodePrefix + "processNotExecutionStatus"); } needUpdateCbos.add(cbo); - workInstanceOids.add(cbo.getAttributeValue("executionid")); + workInstanceOids.add(ObjectTool.getBOAttributeValue(cbo,"executionid")); } //鎵剧浉鍏崇殑娴佺▼浠诲姟瀵硅薄锛屽苟涓旀槸姝e湪鎵ц涓殑 conditionMap.put("executionid", QueryOptionConstant.IN + "(" + WebUtil.toInSql(workInstanceOids.toArray(new String[0])) + ")"); conditionMap.put("lcstatus", "Executing"); - List<com.vci.client.bof.ClientBusinessObject> workItemCbos = boService.queryCBO(processDao.getWorkitemBtmType(), conditionMap); + List<BusinessObject> workItemCbos = boService.queryCBO(processDao.getWorkitemBtmType(), conditionMap); if (workItemCbos != null && workItemCbos.size() > 0) { needUpdateCbos.addAll(workItemCbos); } long currentTime = 0L; try { -// currentTime = platformClientUtil.getLogonFactoryService().getFrameworkService().getSystemTime(); + currentTime = platformClientUtil.getFrameworkService().getSystemTime(); } catch (Throwable e) { throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[0], e); } @@ -632,30 +645,30 @@ //鏌ヨ娴佺▼瀹炰緥 Map<String, String> conditionMap = new HashMap<String, String>(); conditionMap.put("executionid", executionId.trim() + "*");//浼氭湁瀛愭祦绋� - List<com.vci.client.bof.ClientBusinessObject> workInstanceCbos = boService.queryCBO(processDao.getWorkIntanceBtmType(), conditionMap); + List<BusinessObject> workInstanceCbos = boService.queryCBO(processDao.getWorkIntanceBtmType(), conditionMap); if (workInstanceCbos == null || workInstanceCbos.size() == 0) { throw new VciBaseException(msgCodePrefix + "executionNotExist"); } //鍒ゆ柇鏄惁閮芥槸鎵ц鐘舵�侊紝鍓嶇鐨勫垽鏂兘琚烦杩� - List<com.vci.client.bof.ClientBusinessObject> needUpdateCbos = new ArrayList<>(); + List<BusinessObject> needUpdateCbos = new ArrayList<>(); List<String> workInstanceOids = new ArrayList<String>(); - for (com.vci.client.bof.ClientBusinessObject cbo : workInstanceCbos) { - if (!cbo.getLcStatus().equalsIgnoreCase("Suspended")) { + for (BusinessObject cbo : workInstanceCbos) { + if (!cbo.lcStatus.equalsIgnoreCase("Suspended")) { throw new VciBaseException(msgCodePrefix + "processNotSuspendedStatus"); } needUpdateCbos.add(cbo); - workInstanceOids.add(cbo.getOid()); + workInstanceOids.add(cbo.oid); } //鎵剧浉鍏崇殑娴佺▼浠诲姟瀵硅薄锛屽苟涓旀槸姝e湪鎵ц涓殑 conditionMap.put("executionid", QueryOptionConstant.IN + "(" + WebUtil.toInSql(workInstanceOids.toArray(new String[0])) + ")"); conditionMap.put("lcstatus", "Suspended"); - List<com.vci.client.bof.ClientBusinessObject> workItemCbos = boService.queryCBO(processDao.getWorkitemBtmType(), conditionMap); + List<BusinessObject> workItemCbos = boService.queryCBO(processDao.getWorkitemBtmType(), conditionMap); if (workItemCbos != null && workItemCbos.size() > 0) { needUpdateCbos.addAll(workItemCbos); } long currentTime = 0L; try { -// currentTime = platformClientUtil.getLogonFactoryService().getFrameworkService().getSystemTime(); + currentTime = platformClientUtil.getFrameworkService().getSystemTime(); } catch (Throwable e) { throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[0], e); } @@ -706,7 +719,7 @@ } } List<String> causeList = Arrays.asList(new String[]{primaryKeyName}); - List<com.vci.client.bof.ClientBusinessObject> cbos = boService.queryCBO(btmType, conditionMap, null, causeList); + List<BusinessObject> cbos = boService.queryCBO(btmType, conditionMap, null, causeList); if (cbos == null || cbos.size() == 0) { throw new VciBaseException("鍙戣捣娴佺▼鐨勪笟鍔℃暟鎹叏閮ㄤ笉绗﹀悎瑕佹眰"); } @@ -715,9 +728,9 @@ for (String oid : oidArray) { oidSet.add(oid); } - for (com.vci.client.bof.ClientBusinessObject cbo : cbos) { - if (oidSet.contains(cbo.getAttributeValue(primaryKeyName))) { - oidSet.remove(cbo.getAttributeValue(primaryKeyName)); + for (BusinessObject cbo : cbos) { + if (oidSet.contains(ObjectTool.getBOAttributeValue(cbo,primaryKeyName))) { + oidSet.remove(ObjectTool.getBOAttributeValue(cbo,primaryKeyName)); } } if (oidSet.size() > 0) { -- Gitblit v1.9.3