Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebProcessCommandServiceImpl.java
@@ -1,13 +1,19 @@
package com.vci.web.service.impl;
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;
@@ -18,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;
@@ -94,6 +99,13 @@
        return false;
    }
    /**
     * 启动流程
     * @param config 启动流程相关配置
     * @param processNodeUsers 各个节点的负责人信息
     * @param variablesInfo 相关变量
     * @throws VciBaseException
     */
    @Override
    public void startProcess(ProcessStartConfigDTO config,
                             Map<String, List<ProcessUserVO>> processNodeUsers,
@@ -108,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();
@@ -194,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);
        }
@@ -205,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());
        }
@@ -262,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);
            }
@@ -490,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);
    }
@@ -530,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);
                }
            }
        }
    }
@@ -566,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);
        }
@@ -617,7 +628,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);
        }
@@ -657,7 +668,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);
        }