From 5b031de3c8e4cd51ed83cddfbf2ff985d70bea40 Mon Sep 17 00:00:00 2001 From: dangsn <dangsn@chicecm.com> Date: 星期五, 21 六月 2024 16:19:20 +0800 Subject: [PATCH] 1、调整流程启动模板和流程节点获取功能 2、调整文件上传和下载功能 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileUploadServiceImpl.java | 15 + Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciFileUploadController.java | 10 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/dao/impl/WebProcessDaoImpl.java | 540 ++++++++++++++++++++++++++---------------------- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileObjectServiceImpl.java | 39 +++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebProcessDefineController.java | 17 + Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebProcessDefineServiceImpl.java | 31 ++ 6 files changed, 397 insertions(+), 255 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciFileUploadController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciFileUploadController.java index bec3877..712ad4a 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciFileUploadController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciFileUploadController.java @@ -136,6 +136,16 @@ } /** + * 鍒犻櫎鏂囦欢 + * @param oids 鏂囦欢鐨勪富閿� + * @return 鎵ц缁撴灉 + */ + @PostMapping("/deleteFilesPost") + public BaseResult deleteFilesPost(String oids){ + return deleteFiles(oids); + } + + /** * 璇诲彇涓婁紶鏂囦欢鐨勫唴瀹� * @param file 鏂囦欢鐨勫璞� * @return 鍐呭 diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebProcessDefineController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebProcessDefineController.java index ef3ad70..769146a 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebProcessDefineController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebProcessDefineController.java @@ -5,6 +5,7 @@ import com.vci.starter.web.annotation.controller.VciUnCheckRight; import com.vci.starter.web.annotation.log.VciBusinessLog; import com.vci.starter.web.annotation.permission.VciReferPermission; +import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.pagemodel.*; import com.vci.starter.web.util.ControllerUtil; import com.vci.web.pageModel.*; @@ -212,7 +213,13 @@ } return result; } - + + /** + * 鑾峰彇鏌愪釜鍒嗙被涓嬬殑userid鍙互浣跨敤鐨勬祦绋嬫ā鏉� + * @param type 娴佺▼鍒嗙被 + * @param filterTemplate 鎸囧畾妯℃澘 + * @return 鍙敤鐨勬祦绋嬫ā鐗� + */ @ResponseBody @RequestMapping("/getTemplateByType") @VciBusinessLog(operateName="鑾峰彇娴佺▼妯℃澘",notStore=true) @@ -234,7 +241,13 @@ return BaseResult.fail("娌℃湁鍙敤鐨勭増鏈�"); } } - + + /** + * 鑾峰彇娴佺▼涓畾涔夌殑鎵�鏈変换鍔¤妭鐐� + * @param processOid 娴佺▼妯$増鐨勪富閿� + * @param maxSecret 鏁版嵁涓殑鏈�澶у瘑绾у�� + * @return 璇ユ祦绋嬫ā鐗堜腑鎵�鏈夌殑浠诲姟鑺傜偣,鍏朵腑鍖呭惈鎵�鏈夊彲浠ラ�夋嫨鐨勭敤鎴� + */ @ResponseBody @RequestMapping("/getAllProcessNode") @VciBusinessLog(operateName="鑾峰彇娴佺▼鐨勮妭鐐�",notStore=true) diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/dao/impl/WebProcessDaoImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/dao/impl/WebProcessDaoImpl.java index 747dc9e..13cf5eb 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/dao/impl/WebProcessDaoImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/dao/impl/WebProcessDaoImpl.java @@ -5,7 +5,6 @@ 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.WorkflowService; import com.vci.corba.workflow.WorkflowServicePrx; import com.vci.corba.workflow.data.*; import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; @@ -19,25 +18,29 @@ import com.vci.starter.web.util.BeanUtil; import com.vci.starter.web.util.VciBaseUtil; import com.vci.starter.web.util.VciDateUtil; +import com.vci.web.constant.WFVariablesKeyConstant; import com.vci.web.dao.WebProcessDaoI; import com.vci.web.model.ProcessInstance; import com.vci.web.model.ProcessTask; import com.vci.web.model.WFProcessClassifyDO; import com.vci.web.model.WFProcessTemplateDO; import com.vci.web.pageModel.*; -import com.vci.web.service.WebBoServiceI; import com.vci.web.service.OsLifeCycleServiceI; +import com.vci.web.service.WebBoServiceI; import com.vci.web.service.WebLoServiceI; import com.vci.web.util.PlatformClientUtil; import com.vci.web.util.WebUtil; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import org.springframework.util.CollectionUtils; import java.util.*; +import java.util.stream.Collectors; + import static com.vci.frameworkcore.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST; /** @@ -105,16 +108,16 @@ * @throws VciBaseException */ private void getCategory() throws VciBaseException { -// try { -// ProcessCategoryInfo[] pcia = getWorkService().getProcessCategories("root"); -// if(pcia!=null&&pcia.length>0){ -// for(ProcessCategoryInfo pci : pcia){ -// categoryMap.put(pci.name.toLowerCase(), pci.id); -// } -// } -// } catch (VCIError e) { -// WebUtil.getVciBaseException(e); -// }//骞冲彴娌℃湁鏍规嵁鍒嗙被鍚嶇О鑾峰彇娴佺▼鍒嗙被鐨勬帴鍙� + try { + ProcessCategoryInfo[] pcia = getWorkService().getProcessCategories("root"); + if(pcia!=null&&pcia.length>0){ + for(ProcessCategoryInfo pci : pcia){ + categoryMap.put(pci.name.toLowerCase(), pci.id); + } + } + } catch (PLException e) { + WebUtil.getVciBaseException(e); + } } /** @@ -131,6 +134,7 @@ WebUtil.alertNotNull(type,"妯℃澘鍒嗙被"); ProcessDefinitionInfo[] allFlowInType = null; if(StringUtils.isBlank(filterTemplate)) { + //鏃犳寚瀹氭ā鏉挎儏鍐典笅锛岃幏鍙栨ā鏉垮垎绫讳笅鐨勬墍鏈夋ā鏉� type = type.toLowerCase(); if (categoryMap.isEmpty() || !categoryMap.containsKey(type)) { getCategory(); @@ -141,49 +145,58 @@ } else { throw new VciBaseException(msgCodePrefix + "typeNotExist", new String[]{type}); } -// try { -// allFlowInType = getWorkService().getProcessDefinitions(typeOid); -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } - }else{ + try { + allFlowInType = getWorkService().getProcessDefinitions(typeOid); + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } + }else{ List<ProcessDefinitionInfo> infoList = new ArrayList<>(); - VciBaseUtil.str2List(filterTemplate).stream().forEach(name->{ -// try { -// String nameUnRev = name; -// String revision = ""; -// if(name.contains("-")){ -// nameUnRev = name.substring(0,name.lastIndexOf("-")); -// revision = name.substring(name.lastIndexOf("-")+1); -// } -// ProcessDefinitionInfo[] definition = getWorkService().getProcessDefinitionByProcessDefinitionName(nameUnRev, ""); -// if(definition!=null){ -// if(StringUtils.isBlank(revision)) { -// Collections.addAll(infoList, definition); -// }else{ -// //杩囨护鐗堟湰 -// String finalRevision = revision; -// infoList.addAll(Arrays.stream(definition).filter(s -> finalRevision.equalsIgnoreCase(String.valueOf(s.version))).collect(Collectors.toList())); -// } -// } -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } - }); + List<String> templateList = VciBaseUtil.str2List(filterTemplate); + if(!CollectionUtils.isEmpty(templateList)){ + templateList.forEach(name->{ + try { + String nameUnRev = name; + String revision = ""; + if(name.contains("-")){ + nameUnRev = name.substring(0,name.lastIndexOf("-")); + revision = name.substring(name.lastIndexOf("-")+1); + } + ProcessDefinitionInfo[] definition = getWorkService().getProcessDefinitionByProcessDefinitionName(nameUnRev, ""); + if(definition!=null){ + if(StringUtils.isBlank(revision)) { + Collections.addAll(infoList, definition); + }else{ + //杩囨护鐗堟湰 + String finalRevision = revision; + infoList.addAll(Arrays.stream(definition).filter(s -> finalRevision.equalsIgnoreCase(String.valueOf(s.version))).collect(Collectors.toList())); + } + } + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } + }); + } allFlowInType = infoList.toArray(new ProcessDefinitionInfo[0]); } return swapProcessTemplate(allFlowInType, type, showAll); } - + + /** + * 鏍规嵁閮ㄧ讲涓婚敭锛岃幏鍙栨祦绋嬫ā鏉垮璞� + * @param deployId 閮ㄧ讲涓婚敭 + * @return + * @throws VciBaseException + */ @Override public ProcessTemplateVO getTemplateByDeployId(String deployId) throws VciBaseException { WebUtil.alertNotNull(deployId,"娴佺▼閮ㄧ讲涓婚敭"); ProcessDefinitionInfo pdi = null; -// try { -// pdi = getWorkService().getProcessDefinitionByDeployId(deployId.trim()); -// } catch (VCIError e) { -// throw new VciBaseException(msgCodePrefix + "deployIdNotExist", new String[]{deployId}); -// } + try { + pdi = getWorkService().getProcessDefinitionByDeployId(deployId.trim()); + } catch (PLException e) { + throw new VciBaseException(msgCodePrefix + "deployIdNotExist", new String[]{deployId}); + } List<ProcessTemplateVO> proTemplates = swapProcessTemplate(new ProcessDefinitionInfo[]{pdi},"",false); if(proTemplates == null || proTemplates.size() == 0){ throw new VciBaseException(msgCodePrefix + "deployIdNotExist", new String[]{deployId}); @@ -205,7 +218,7 @@ pt.setName(pd.name); pt.setStatus(pd.status); pt.setTaskType(type); -// pt.setVersion(pd.version); + pt.setVersion((int) pd.version); allTemplate.add(pt); } } @@ -233,19 +246,27 @@ } return allNode; } + + /** + * 鑾峰彇娴佺▼涓殑绗竴涓妭鐐圭殑鍚嶇О + * @param deployId 閮ㄧ讲涓婚敭 + * @return + * @throws VciBaseException + */ @Override public String getFirstNodeName(String deployId) throws VciBaseException { WebUtil.alertNotNull(deployId,"閮ㄧ讲涓婚敭"); -// try { -// ProcessTaskInfo firstProcessTask = getWorkService().getFirstProcessTask(deployId); -// if(firstProcessTask!=null){ -// return firstProcessTask.taskName; -// } -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } + try { + ProcessTaskInfo firstProcessTask = getWorkService().getFirstProcessTask(deployId); + if(firstProcessTask!=null){ + return firstProcessTask.taskName; + } + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } return null; } + /** * 鑾峰彇娴佺▼鐨勬墍鏈夎妭鐐瑰悕绉� * @param processOid @@ -271,11 +292,11 @@ @Override public String[] getAllProcessNodeNameByDeploy(String deploymentId) throws VciBaseException{ String[] allTaskNames = null; -// try { -// allTaskNames = getWorkService().getAllTaskNames(deploymentId); -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } + try { + allTaskNames = getWorkService().getAllTaskNames(deploymentId); + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } return allTaskNames; } @@ -285,54 +306,65 @@ */ @Override public String getJbpmDeploymentId(String processOid) throws VciBaseException{ -// WebUtil.alertNotNull(processOid,"娴佺▼妯℃澘涓婚敭"); -// return getWorkService().getDeploymentID(processOid); - return null; + WebUtil.alertNotNull(processOid,"娴佺▼妯℃澘涓婚敭"); + return getWorkService().getDeploymentID(processOid); } - + + /** + * 鑾峰彇娴佺▼妯℃澘瀵瑰簲鐨勫紩鎿庨噷鐨勯儴缃蹭富閿� + * @param executionId + * @return + * @throws VciBaseException + */ @Override public String getJbpmDeploymentIdByExecutionId(String executionId) throws VciBaseException{ WebUtil.alertNotNull(executionId,"娴佺▼鎵ц涓婚敭"); -// try { -// return getWorkService().getDeploymentIdByExecutionId(executionId); -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } - return null; + try { + return getWorkService().getDeploymentIdByExecutionId(executionId); + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } } - + + /** + * 鑾峰彇妯℃澘涓妭鐐硅缃殑璐熻矗浜� + * @param deploymentId 寮曟搸涓殑閮ㄧ讲涓婚敭 + * @param taskName 浠诲姟鑺傜偣鍚嶇О + * @return + * @throws VciBaseException + */ @Override public ProcessNodeVO getNodePresideUsersByDeploy(String deploymentId, String taskName) throws VciBaseException{ WebUtil.alertNotNull(taskName,"娴佺▼浠诲姟鍚嶇О",deploymentId,"娴佺▼寮曟搸涓殑閮ㄧ讲涓婚敭"); ProcessNodeVO pn = new ProcessNodeVO(); -// pn.setName(taskName); -// try { -// String[] nodePresideUsers = getWorkService().getCurCandidates(deploymentId, taskName, "", ""); -// if(nodePresideUsers!=null&& nodePresideUsers.length>0){ -// for(String preUsers : nodePresideUsers){ -// //骞冲彴瀛樺偍鐨勬柟寮忔槸鐢ㄦ埛;瑙掕壊;閮ㄩ棬;鑷畾涔�.... -// if(StringUtils.isNotEmpty(preUsers)){ -// String[] preUsersSplit = preUsers.split("\\;"); -// if(preUsersSplit!=null && preUsersSplit.length>0){ -// if(StringUtils.isNotEmpty(preUsersSplit[0])){ -// pn.setUsers(preUsersSplit[0]); -// } -// if(preUsersSplit.length>1 && StringUtils.isNotEmpty(preUsersSplit[1])){ -// pn.setRoles(preUsersSplit[1]); -// } -// if(preUsersSplit.length>2 && StringUtils.isNotEmpty(preUsersSplit[2])){ -// pn.setDepts(preUsersSplit[2]); -// } -// if(preUsersSplit.length>3 && StringUtils.isNotEmpty(preUsersSplit[3])){ -// pn.setCustomClass(preUsersSplit[3]); -// } -// } -// } -// } -// } -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } + pn.setName(taskName); + try { + String[] nodePresideUsers = getWorkService().getCurCandidates(deploymentId, taskName, "", ""); + if(nodePresideUsers!=null&& nodePresideUsers.length>0){ + for(String preUsers : nodePresideUsers){ + //骞冲彴瀛樺偍鐨勬柟寮忔槸鐢ㄦ埛;瑙掕壊;閮ㄩ棬;鑷畾涔�.... + if(StringUtils.isNotEmpty(preUsers)){ + String[] preUsersSplit = preUsers.split("\\;"); + if(preUsersSplit!=null && preUsersSplit.length>0){ + if(StringUtils.isNotEmpty(preUsersSplit[0])){ + pn.setUsers(preUsersSplit[0]); + } + if(preUsersSplit.length>1 && StringUtils.isNotEmpty(preUsersSplit[1])){ + pn.setRoles(preUsersSplit[1]); + } + if(preUsersSplit.length>2 && StringUtils.isNotEmpty(preUsersSplit[2])){ + pn.setDepts(preUsersSplit[2]); + } + if(preUsersSplit.length>3 && StringUtils.isNotEmpty(preUsersSplit[3])){ + pn.setCustomClass(preUsersSplit[3]); + } + } + } + } + } + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } return pn; } @@ -353,29 +385,36 @@ } return getNodePresideUsersByDeploy(deploymentId,taskName); } - + + /** + * 鑾峰彇浠诲姟鐨勫鐞嗕汉 + * @param executionid 鎵ц涓婚敭 + * @param taskName 浠诲姟鍚嶇О + * @return + * @throws VciBaseException + */ @Override public List<ProcessUserVO> getNodePresideUsersByTask(String executionid, String taskName) throws VciBaseException{ WebUtil.alertNotNull(executionid,"娴佺▼鎵ц浠诲姟",taskName,"浠诲姟鍚嶇О"); -// if("缁撴潫".equalsIgnoreCase(taskName)){ -// return null; -// } + if("缁撴潫".equalsIgnoreCase(taskName)){ + return null; + } //涓嶈兘浣跨敤workitem鍘绘煡璇紝鍥犱负鍙兘浠诲姟杩樻病鍒� -// String users = getWorkService().getNextTaskAssigner(executionid, taskName); + String users = getWorkService().getNextTaskAssigner(executionid, taskName); List<ProcessUserVO> allProUser = new ArrayList<ProcessUserVO>(); -// if(StringUtils.isNotEmpty(users)){ -// String userIds = users.replace("user:", "");//鐜板湪鍙敮鎸佽缃敤鎴� -// List<SmUserVO> allUser = userQueryService.listUserByUserIds(WebUtil.str2List(userIds)); -// if(allUser!=null && allUser.size()>0){ -// for(SmUserVO user : allUser){ -// ProcessUserVO pu = new ProcessUserVO(); -// BeanUtils.copyProperties(user, pu); -// pu.setType("user"); -// allProUser.add(pu); -// } -// } -// } + if(StringUtils.isNotEmpty(users)){ + String userIds = users.replace("user:", "");//鐜板湪鍙敮鎸佽缃敤鎴� + List<SmUserVO> allUser = userQueryService.listUserByUserIds(WebUtil.str2List(userIds)); + if(allUser!=null && allUser.size()>0){ + for(SmUserVO user : allUser){ + ProcessUserVO pu = new ProcessUserVO(); + BeanUtils.copyProperties(user, pu); + pu.setType("user"); + allProUser.add(pu); + } + } + } return allProUser; } @@ -554,25 +593,30 @@ BeanUtil.convert(process,processInstanceVO); return processInstanceVO; } - + + /** + * 鑾峰彇娴佺▼涓殑鍙橀噺锛屽钩鍙板彧鏀寔瀛楃涓�..... + * @param executionId + * @param key + * @return + * @throws VciBaseException + */ @Override public String getVariablesInProcess(String executionId,String key) throws VciBaseException{ WebUtil.alertNotNull(executionId,"娴佺▼鎵ц涓婚敭",key,"鍙傛暟Key"); UserEntityInfo ueo = new UserEntityInfo(); SessionInfo si = WebUtil.getCurrentUserSessionInfo(); -// ueo..ip = si.getIp(); ueo.modules = "娴佺▼"; ueo.userName = si.getUserId(); -// while(StringUtils.countMatches(executionId,".")>1){ -// //璇存槑鏄瓙浠诲姟锛岀敤鐖朵换鍔¤幏鍙栦竴涓嬪彉閲� -// executionId = executionId.substring(0,executionId.lastIndexOf(".")); -// } -// try { -// return getWorkService().getProcessVariable(executionId, key, ueo); -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } - return null; + while(StringUtils.countMatches(executionId,".")>1){ + //璇存槑鏄瓙浠诲姟锛岀敤鐖朵换鍔¤幏鍙栦竴涓嬪彉閲� + executionId = executionId.substring(0,executionId.lastIndexOf(".")); + } + try { + return getWorkService().getProcessVariable(executionId, key, ueo); + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } } /** @@ -675,41 +719,41 @@ public List<ProcessHistoryVO> getHistory(String executionId) throws VciBaseException{ WebUtil.alertNotNull(executionId,"娴佺▼鎵ц涓婚敭"); List<ProcessHistoryVO> hisList = new ArrayList<ProcessHistoryVO>(); -// FlowApproveHistoryInfo[] historyActivitys = null; -// try { -// historyActivitys = getWorkService().getHistoryActivityByProInsIdbyPLM(executionId); -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } -// //闇�瑕佸幓闄ゆ湭澶勭悊鐨勯噸澶嶉」 -// for (int i = 0; i < historyActivitys.length; i++) { -// FlowApproveHistoryInfo historyActivity = historyActivitys[i]; -// ProcessHistoryVO his = new ProcessHistoryVO(); -// his.setTaskName(historyActivity.taskName); -// his.setOpinin(historyActivity.opinion);//杩欎釜鏄鐞嗘柟寮忥紝灏辨槸鍚屾剰杩樻槸涓嶅悓鎰� -// his.setCreateTime(historyActivity.createTime); -// his.setEndTime(historyActivity.endTime); -// his.setNode(historyActivity.note); -// his.setAssignee(historyActivity.assignee); -// his.setExecutionId(historyActivity.executionId); -// String userIdString = historyActivity.assignee; -// if(StringUtils.contains(userIdString,":")) { -// userIdString = userIdString.substring(userIdString.indexOf(":") + 1); -// } -// String userShowInfoString = ""; -// SmUserVO user = userQueryService.getUserByUserId(userIdString); -// if(user != null){ -// userShowInfoString = user.getName() + "(" + user.getId() + ")"; -// }else{ -// userShowInfoString = historyActivity.assignee; -// } -// his.setAssigneeName(userShowInfoString); -// if(StringUtils.isNotBlank(historyActivity.endTime)) { -// hisList.add(his); -// } -// //濡傛灉endTime涓虹┖琛ㄧず鏄緟鍔炵殑锛屼絾鏄湇鍔$鐨勬帴鍙d腑鏈変釜闂鏄紝浼氭妸浼氱鎴栬�呭瓙娴佺▼涓凡缁忓鐞嗙殑鍜屾湭澶勭悊鐨勬贩鍚堝湪涓�璧� -// //鐩存帴浠庡緟鍔炰换鍔¢噷鍘绘煡璇� -// } + FlowApproveHistoryInfo[] historyActivitys = null; + try { + historyActivitys = getWorkService().getHistoryActivityByProInsIdbyPLM(executionId); + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } + //闇�瑕佸幓闄ゆ湭澶勭悊鐨勯噸澶嶉」 + for (int i = 0; i < historyActivitys.length; i++) { + FlowApproveHistoryInfo historyActivity = historyActivitys[i]; + ProcessHistoryVO his = new ProcessHistoryVO(); + his.setTaskName(historyActivity.taskName); + his.setOpinin(historyActivity.opinion);//杩欎釜鏄鐞嗘柟寮忥紝灏辨槸鍚屾剰杩樻槸涓嶅悓鎰� + his.setCreateTime(VciDateUtil.date2Str(VciDateUtil.long2Date(historyActivity.createTime), VciDateUtil.DateTimeFormat)); + his.setEndTime(VciDateUtil.date2Str(VciDateUtil.long2Date(historyActivity.endTime), VciDateUtil.DateTimeFormat)); + his.setNode(historyActivity.note); + his.setAssignee(historyActivity.assignee); + his.setExecutionId(historyActivity.executionId); + String userIdString = historyActivity.assignee; + if(StringUtils.contains(userIdString,":")) { + userIdString = userIdString.substring(userIdString.indexOf(":") + 1); + } + String userShowInfoString = ""; + SmUserVO user = userQueryService.getUserByUserId(userIdString); + if(user != null){ + userShowInfoString = user.getName() + "(" + user.getId() + ")"; + }else{ + userShowInfoString = historyActivity.assignee; + } + his.setAssigneeName(userShowInfoString); + if(StringUtils.isNotBlank(his.getEndTime())) { + hisList.add(his); + } + //濡傛灉endTime涓虹┖琛ㄧず鏄緟鍔炵殑锛屼絾鏄湇鍔$鐨勬帴鍙d腑鏈変釜闂鏄紝浼氭妸浼氱鎴栬�呭瓙娴佺▼涓凡缁忓鐞嗙殑鍜屾湭澶勭悊鐨勬贩鍚堝湪涓�璧� + //鐩存帴浠庡緟鍔炰换鍔¢噷鍘绘煡璇� + } Map<String,String> conditionMap = new HashMap<String, String>(); conditionMap.put("businesstype", "5");//鏈」鐩病鏈夊疄闄呯殑鎰忎箟 @@ -763,52 +807,65 @@ public byte[] getProcessPicture(String executionId, String taskName) throws VciBaseException{ WebUtil.alertNotNull(executionId,"娴佺▼鎵ц涓婚敭",taskName,"娴佺▼浠诲姟鍚嶇О"); -// try { -// byte[] processChart = getWorkService().getExecutionImageByExecutionId(executionId, taskName); -// return processChart; -// } catch (Throwable e) { -// String msg = "鏈夊彲鑳借繖涓换鍔″叧鑱旂殑娴佺▼宸茬粡缁撴潫鎴栬�呰缁堟锛屼笉鑳藉啀鏌ョ湅鍏舵祦绋嬪浘浜�"; -// logger.error(msg,e); -// throw new VciBaseException(msg); -// } - return null; + try { + byte[] processChart = getWorkService().getExecutionImageByExecutionId(executionId, taskName); + return processChart; + } catch (Throwable e) { + String msg = "鏈夊彲鑳借繖涓换鍔″叧鑱旂殑娴佺▼宸茬粡缁撴潫鎴栬�呰缁堟锛屼笉鑳藉啀鏌ョ湅鍏舵祦绋嬪浘浜�"; + logger.error(msg,e); + throw new VciBaseException(msg); + } } @Override public byte[] getProcessTemplatePicture(String executionId) throws VciBaseException{ -// WebUtil.alertNotNull(executionId,"娴佺▼瀹炰緥涓婚敭"); -// try { -// byte[] processChart = getWorkService().getFlowImageByDeployID(executionId); -// return processChart; -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } - return null; - } - - @Override - public String[] getAllOutComes(String taskOid) throws VciBaseException{ -// try { -// return getWorkService().getAllOutComes(taskOid); -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } - return null; - } - - @Override - public String getNextTaskName(String executionid, String taskName, String outCome) throws VciBaseException{ -// WebUtil.alertNotNull(executionid,"娴佺▼鎵ц涓婚敭",taskName,"浠诲姟鍚嶇О"); -// String deployId = getJbpmDeploymentIdByExecutionId(executionid); -// try { -// return getWorkService().getNextTaskNameByJbpmId(deployId, taskName, outCome); -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } - return null; + WebUtil.alertNotNull(executionId,"娴佺▼瀹炰緥涓婚敭"); + try { + byte[] processChart = getWorkService().getFlowImageByDeployID(executionId); + return processChart; + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } } + /** + * 鑾峰彇浠诲姟鐨勮矾鐢� + * @param taskOid jbpm涓殑浠诲姟涓婚敭 + * @return + * @throws VciBaseException + */ + @Override + public String[] getAllOutComes(String taskOid) throws VciBaseException{ + try { + return getWorkService().getAllOutComes(taskOid); + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } + } + + /** + * 鑾峰彇涓嬩竴姝ョ殑浠诲姟 + * @param executionid 娴佺▼鎵ц涓婚敭 + * @param taskName 褰撳墠浠诲姟鐨勫悕绉� + * @param outCome 璺敱鍚嶇О + * @return 鍥犱负鏈夊垎鏀殑鎯呭喌锛屾墍浠ヤ笅涓�姝ヤ换鍔′細鏈夊涓� + */ + @Override + public String getNextTaskName(String executionid, String taskName, String outCome) throws VciBaseException{ + WebUtil.alertNotNull(executionid,"娴佺▼鎵ц涓婚敭",taskName,"浠诲姟鍚嶇О"); + String deployId = getJbpmDeploymentIdByExecutionId(executionid); + try { + return getWorkService().getNextTaskNameByJbpmId(deployId, taskName, outCome); + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } + } + + /** + * 鑾峰彇骞冲彴鐨勬祦绋嬫湇鍔� + * @return + */ @Override public WorkflowServicePrx getWorkService() throws VciBaseException{ if(workService == null){ @@ -848,18 +905,18 @@ taskAss.userName = ""; } taskAss.TasksName = userId; -// taskAss.startTime = VciDateUtil.date2Str(startDate, VciDateUtil.DateFormat); + taskAss.startTime = VciDateUtil.getTime(startDate); if(endDate == null){ endDate = VciDateUtil.getDateAddDay(startDate, 30);//榛樿鏈�澶氫唬鐞嗕竴涓湀 } -// taskAss.endTime = VciDateUtil.date2Str(endDate, VciDateUtil.DateFormat); -// taskAss.isTrue = isNowEnable?1:0; + taskAss.endTime = VciDateUtil.getTime(endDate); + taskAss.isTrue = isNowEnable?true:false; taskAss.fromUser =WebUtil.getCurrentUserSessionInfo().getUserId(); -// try { -// getWorkService().saveOrUpdateTasksAssigned(taskAss, WebUtil.getUserEntityInfo("娴佺▼")); -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } + try { + getWorkService().saveOrUpdateTasksAssigned(taskAss, WebUtil.getUserEntityInfo("娴佺▼")); + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } } @@ -868,32 +925,22 @@ public void endProxy() throws VciBaseException { //骞冲彴涓嶆敮鎸佸仠鐢ㄥ惎鐢ㄤ唬鐞嗕俊鎭�..鍙互鏌ヨ鍑烘潵鍐嶉噸鏂版坊鍔犮�� -// try { -// UserEntityInfo uei = WebUtil.getUserEntityInfo( "娴佺▼"); -// getWorkService().deleteTasksAssignedByUserName(new String[]{uei.userName}, uei); -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } + try { + UserEntityInfo uei = WebUtil.getUserEntityInfo( "娴佺▼"); + getWorkService().deleteTasksAssignedByUserName(new String[]{uei.userName}, uei); + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } } @Override public TasksAssignedInfo getProxy() throws VciBaseException{ TasksAssignedInfo assign = null; -// try { -// TasksAssignedInfo taskAss = getWorkService().getTasksAssignedByUserName("", WebUtil.getUserEntityInfo( "娴佺▼")); -// if(taskAss!=null && StringUtils.isNotEmpty(taskAss.id)){ -// assign = new TasksAssigned(); -// assign.setId(taskAss.id); -// assign.setTasksName(taskAss.TasksName); -// assign.setStartTime(taskAss.startTime); -// assign.setEndTime(taskAss.endTime); -// assign.setFromUser(taskAss.fromUser); -// assign.setIsTrue(taskAss.isTrue); -// assign.setUserName(taskAss.userName); -// } -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } + try { + assign = getWorkService().getTasksAssignedByUserName("", WebUtil.getUserEntityInfo( "娴佺▼")); + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } return assign; } @@ -905,24 +952,24 @@ */ @Override public void endProcess(String executionId) throws VciBaseException { -// try { + try { DataGrid dataGrid = getDataByProcess(executionId,null); //鍏堣幏鍙栦竴涓� UserEntityInfo userEntityInfo = WebUtil.getUserEntityInfo("娴佺▼"); String resetStatus = null; -// try{ -// resetStatus = getWorkService().getProcessVariable(executionId, WFVariablesKeyConstant.RESET_STATUS, userEntityInfo); -// }catch (Throwable e){ -// logger.error("鑾峰彇娴佺▼鐨勫彉閲忓嚭閿�",e); -// } -// getWorkService().endProcessInstanceByplatform(executionId,userEntityInfo); + try{ + resetStatus = getWorkService().getProcessVariable(executionId, WFVariablesKeyConstant.RESET_STATUS, userEntityInfo); + }catch (Throwable e){ + logger.error("鑾峰彇娴佺▼鐨勫彉閲忓嚭閿�",e); + } + getWorkService().endProcessInstanceByplatform(executionId,userEntityInfo); //骞冲彴娌℃湁鑷姩灏嗕笟鍔℃暟鎹仮澶嶅埌涔嬪墠鐨勭姸鎬� if(StringUtils.isNotBlank(resetStatus)){ resetLcStatusForBusinessData(dataGrid.getData(),resetStatus); } -// } catch (VCIError vciError) { -// throw WebUtil.getVciBaseException(vciError); -// } + } catch (PLException vciError) { + throw WebUtil.getVciBaseException(vciError); + } } private void resetLcStatusForBusinessData(List<Map> bussinesDataList,String resetStatus) throws VciBaseException{ @@ -1006,12 +1053,11 @@ @Override public byte[] getProcessXmlContent(String jbpmDeploymentId) throws VciBaseException { WebUtil.alertNotNull("娴佺▼鎵ц涓婚敭淇℃伅",jbpmDeploymentId); -// try { -// return getWorkService().getProcessResource(jbpmDeploymentId,".xml"); -// } catch (VCIError e) { -// throw WebUtil.getVciBaseException(e); -// } - return null; + try { + return getWorkService().getProcessResource(jbpmDeploymentId,".xml"); + } catch (PLException e) { + throw WebUtil.getVciBaseException(e); + } } /** diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileObjectServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileObjectServiceImpl.java index f283e24..59e6613 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileObjectServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileObjectServiceImpl.java @@ -1,5 +1,7 @@ package com.vci.web.service.impl; +import com.vci.corba.common.PLException; +import com.vci.corba.volume.VolumeServicePrx; import com.vci.file.dto.VciFileObjectDTO; import com.vci.file.lcstatuspck.FileLCStatus; import com.vci.file.pagemodel.VciFileObjectVO; @@ -15,7 +17,11 @@ import com.vci.starter.web.wrapper.VciQueryWrapperForDO; import com.vci.web.dao.VciFileObjectDaoI; import com.vci.web.model.VciFileObjectDO; +import com.vci.web.model.VciFileVolumeDO; import com.vci.web.service.VciFileObjectServiceI; +import com.vci.web.service.VciFileVolumeServiceI; +import com.vci.web.util.PlatformClientUtil; +import com.vci.web.util.WebUtil; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,8 +66,20 @@ /** * 鐗堟湰鍜屾暟鎹璞″伐鍏风被 */ - @Autowired + @Resource private RevisionModelUtil revisionModelUtil; + + /** + * 鏂囦欢鐨勫嵎鏈嶅姟 + */ + @Resource + private VciFileVolumeServiceI vciFileVolumeServiceI; + + /** + * 骞冲彴鐨勫鎴风 + */ + @Resource + private PlatformClientUtil platformClientUtil; /** * 鏌ヨ鎵�鏈夌殑鏂囦欢瀵硅薄 @@ -496,10 +514,27 @@ public BaseResult deleteFiles(Collection<String> fileOids) throws VciBaseException { Collection<VciFileObjectVO> fileObjectVOS = listVciFileObjectByOids(fileOids); if(!CollectionUtils.isEmpty(fileObjectVOS)){ - //鎴戜滑鏆傛椂涓嶅垹闄ゆ枃浠讹紝闃叉鍒犻櫎閿欎簡 VciBaseUtil.switchCollectionForOracleIn(fileObjectVOS).stream().forEach(fileObjectVOList->{ vciFileObjectMapper.batchDeleteByOids(fileObjectVOList.stream().map(VciFileObjectVO::getOid).collect(Collectors.toList())); }); + + //鍒犻櫎浠撳簱涓殑鏂囦欢 + //鑾峰彇鏂囦欢浠撲綅缃� + VciFileVolumeDO vciFileVolumeDO = vciFileVolumeServiceI.getUploadVolume(); + String volumeName = vciFileVolumeDO.getName(); + VolumeServicePrx volumnCorbaService = platformClientUtil.getVolumeService(volumeName); + if(volumnCorbaService == null){ + throw new VciBaseException("娌℃湁鑾峰彇鍒板嵎鏈嶅姟"); + } + Set<String> filePathSet = fileObjectVOS.stream().map(VciFileObjectVO::getFilePath).collect(Collectors.toSet()); + String[] filePathArr = new String[filePathSet.size()]; + filePathSet.toArray(filePathArr); + try { + volumnCorbaService.deleteAllFiles(filePathArr); + } catch (PLException e) { + logger.error("鍗锋湇鍔″垹闄や粨搴撲腑鐨勬枃浠跺け璐ワ細", e); + logger.error("鍗锋湇鍔″垹闄ゅけ璐ョ殑鏂囦欢锛�"+ WebUtil.getJSONStringWithDateFormat(filePathSet)); + } } return BaseResult.success(); } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileUploadServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileUploadServiceImpl.java index 84b6487..78d98be 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileUploadServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileUploadServiceImpl.java @@ -1,5 +1,6 @@ package com.vci.web.service.impl; +import com.vci.corba.common.PLException; import com.vci.corba.volume.VolumeServicePrx; import com.vci.file.constant.VciFileDefaultValueConstant; import com.vci.file.constant.VciFileLangCodeConstant; @@ -265,7 +266,7 @@ long currentTime = volumnCorbaService.getCurrrentTimeMillions(); in = multipartFile.getInputStream(); long fileSize = multipartFile.getSize(); - int blockSize = (int)webProperties.getBlockLength()*1024; + int blockSize = webProperties.getBlockLength()*1024; byte[] buffer = new byte[blockSize]; long temp =0L; for(temp = 0L; temp < fileSize - (long)blockSize; temp += (long)blockSize) { @@ -306,6 +307,18 @@ sourceFileObject.setFileSize(vciFileObjectDO.getFileSize()); vciFileObjectMapper.updateByPrimaryKey(sourceFileObject); //娌″姙娉曞垹闄や箣鍓嶇殑鏂囦欢锛� + + String volumeName = vciFileVolumeDO.getName(); + VolumeServicePrx volumnCorbaService = platformClientUtil.getVolumeService(volumeName); + if(volumnCorbaService == null){ + throw new VciBaseException("娌℃湁鑾峰彇鍒板嵎鏈嶅姟"); + } + try { + volumnCorbaService.deleteFile(sourceFileObject.getFilePath()); + } catch (PLException e) { + e.printStackTrace(); + System.out.println("鍒犻櫎浠撳簱涓殑鏂囦欢澶辫触锛�"+e.getMessage()); + } }else { vciFileObjectMapper.insert(vciFileObjectDO); } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebProcessDefineServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebProcessDefineServiceImpl.java index f0721d5..18a6d75 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebProcessDefineServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebProcessDefineServiceImpl.java @@ -238,7 +238,6 @@ List<ProcessUserVO> pul = copyUsersToProcessNode(users,maxSecret); if(isHasCurrentUser){//褰撳墠鐢ㄦ埛鏀惧湪鍓嶉潰 ProcessUserVO pu = new ProcessUserVO(); - //SessionInfo si = WebUtil.getSessionInfo(request); SessionInfo si = WebUtil.getCurrentUserSessionInfo(); pu.setOid(si.getUserOid()); pu.setId(si.getUserId()); @@ -305,12 +304,24 @@ ProcessNodeVO pn = processDao.getNodePresideUsers(processTemplateOid, nodeName); return getProcessUsersByNode(pn,-1); } - + + /** + * 鑾峰彇閮ㄧ讲id + * @param executionId 鎵ц涓婚敭 + * @return + * @throws VciBaseException + */ @Override public String getDeployIdByExecutionId(String executionId) throws VciBaseException { return processDao.getJbpmDeploymentIdByExecutionId(executionId); } - + + /** + * 鑾峰彇浠诲姟涓缃殑褰撳墠澶勭悊浜� + * @param taskOid 浠诲姟涓婚敭 + * @return + * @throws VciBaseException + */ @Override public List<ProcessUserVO> getProcessUserByTask(String taskOid) throws VciBaseException{ List<ProcessTaskVO> task = processDao.getTaskByOid(taskOid); @@ -321,6 +332,13 @@ } } + /** + * 鑾峰彇鎴戠殑寰呭姙浜嬮」--骞冲彴涓嶆敮鎸佹煡璇㈡暟鎹�绘潯鏁帮紝涓嶆竻妤氬湪杩欑鎯呭喌涓嬶紝start鍜宲agesize鏄敤鏉ュ仛浠�涔堢敤鐨� + * @param conditionMap 鏉′欢鏌ヨ + * @param ph 鍒嗛〉鍜屾帓搴� + * @return + * @throws VciBaseException + */ @Override public DataGrid getMyUndoProcessTask( Map<String, String> conditionMap, PageHelper ph) throws VciBaseException { @@ -330,6 +348,13 @@ return processDao.getUndoTask(conditionMap,ph,WebUtil.getCurrentUserId()); } + /** + * 鑾峰彇鎴戝鐞嗕簡鐨勪换鍔� + * @param conditionMap 鏌ヨ鏉′欢 + * @param ph 鍒嗛〉淇℃伅 + * @return + * @throws VciBaseException + */ @Override public DataGrid getMyDoneProcessTask(Map<String, String> conditionMap, PageHelper ph) throws VciBaseException { -- Gitblit v1.9.3