packagehls.core.wfl.service.impl;importcom.hand.hap.activiti.dto.ReProcdef;importcom.hand.hap.activiti.service.IActivitiService;importcom.hand.hap.activiti.service.IReProcdefService;importcom.hand.hap.core.IRequest;importhls.core.prj.dto.PrjProject;importhls.core.prj.dto.PrjProjectMeeting;importhls.core.prj.mapper.PrjProjectMeetingMapper;importhls.core.prj.service.PrjProjectService;importhls.core.wfl.service.IActivitiCommonService;importnet.sf.json.JSONObject;importorg.activiti.rest.service.api.engine.variable.RestVariable;importorg.activiti.rest.service.api.runtime.process.ProcessInstanceCreateRequest;importorg.springframework.beans.factory.annotation.Autowired;importorg.springframework.stereotype.Service;importorg.springframework.transaction.annotation.Transactional;importjava.util.ArrayList;importjava.util.List;importjava.util.Map;/** * Created by Administrator on 2017/4/17. */@Service@TransactionalpublicclassPrjActivitStartServiceImplimplementsIActivitiCommonService{privatestaticfinalStringworkFlowType="PRJ_PROJECT";@AutowiredprivateIActivitiServiceactivitiService;@AutowiredprivateIReProcdefServicereProcdefService;@AutowiredprivatePrjProjectServiceprojectService;@AutowiredprivatePrjProjectMeetingMappermeetingMapper;@OverridepublicStringgetWorkFlowType(){returnworkFlowType;}@Overridepublicvoidprocess(IRequestiRequest,Listlist,Mapparams){ProcessInstanceCreateRequestprocessInstanceCreateRequest=getProcessInstanceCreateRequest((PrjProject)list.get(0),iRequest);activitiService.startProcess(iRequest,processInstanceCreateRequest);}privateProcessInstanceCreateRequestgetProcessInstanceCreateRequest(PrjProjectprjProject,IRequestiRequest){ProcessInstanceCreateRequestcreateRequest=newProcessInstanceCreateRequest();PrjProjectproject=projectService.selectByPrimaryKey(iRequest,prjProject);ReProcdefreProcdefs;reProcdefs=reProcdefService.queryReProcdef("PRJ_PROJECT_APPROVE","PRJ_PROJECT");Stringid=reProcdefs.getId_();Stringname=reProcdefs.getName_();createRequest.setProcessDefinitionId(id);createRequest.setBusinessKey(prjProject.getProjectId().toString());List<RestVariable>variables=newArrayList<RestVariable>();List<RestVariable>transientVariables=newArrayList<RestVariable>();RestVariablerestVariable1=newRestVariable();RestVariablerestVariable2=newRestVariable();RestVariablerestVariable3=newRestVariable();RestVariablerestVariable4=newRestVariable();RestVariablerestVariable5=newRestVariable();RestVariablerestVariable6=newRestVariable();restVariable1.setName("processDefinitionId");restVariable1.setValue(id);variables.add(restVariable1);restVariable2.setName("prjProject");JSONObjectjsonObject=newJSONObject().fromObject(prjProject);restVariable2.setValue(jsonObject.toString());variables.add(restVariable2);restVariable3.setName("iRequest");restVariable3.setValue(iRequest);variables.add(restVariable3);restVariable4.setName("projectNum");restVariable4.setValue(project.getProjectNumber());variables.add(restVariable4);restVariable5.setName("projectName");restVariable5.setValue(project.getProjectName());variables.add(restVariable5);restVariable6.setName("startUserName");restVariable6.setValue(iRequest.getEmployeeCode());variables.add(restVariable6);RestVariablerestVariable7=newRestVariable();RestVariablerestVariable8=newRestVariable();RestVariablerestVariable9=newRestVariable();restVariable7.setName("documentCategory");restVariable7.setValue(project.getDocumentCategory());variables.add(restVariable7);restVariable8.setName("documentType");restVariable8.setValue(project.getDocumentType());variables.add(restVariable8);restVariable9.setName("documentId");restVariable9.setValue(project.getProjectId());variables.add(restVariable9);RestVariablerestVariable10=newRestVariable();restVariable10.setName("doubleFlag");PrjProjectMeetingmeeting=newPrjProjectMeeting();meeting.setProjectId(prjProject.getProjectId());List<PrjProjectMeeting>list=meetingMapper.select(meeting);if(list.size()>0){restVariable10.setValue("Y");}else{restVariable10.setValue("N");}variables.add(restVariable10);RestVariablerestVariable11=newRestVariable();restVariable11.setName("pName");restVariable11.setValue(name);variables.add(restVariable11);createRequest.setVariables(variables);createRequest.setTransientVariables(transientVariables);returncreateRequest;}}
packagehls.core.wfl.service.impl;importcom.hand.hap.activiti.dto.ReProcdef;importcom.hand.hap.activiti.service.IActivitiService;importcom.hand.hap.activiti.service.IReProcdefService;importcom.hand.hap.core.IRequest;importhls.core.prj.dto.PrjProject;importhls.core.prj.dto.PrjProjectMeeting;importhls.core.prj.mapper.PrjProjectMeetingMapper;importhls.core.prj.service.PrjProjectService;importhls.core.wfl.service.IActivitiCommonService;importnet.sf.json.JSONObject;importorg.activiti.rest.service.api.engine.variable.RestVariable;importorg.activiti.rest.service.api.runtime.process.ProcessInstanceCreateRequest;importorg.springframework.beans.factory.annotation.Autowired;importorg.springframework.stereotype.Service;importorg.springframework.transaction.annotation.Transactional;importjava.util.ArrayList;importjava.util.List;importjava.util.Map;/** * Created by Administrator on 2017/4/17. */@Service@TransactionalpublicclassPrjActivitStartServiceImplimplementsIActivitiCommonService{privatestaticfinalStringworkFlowType="PRJ_PROJECT";@AutowiredprivateIActivitiServiceactivitiService;@AutowiredprivateIReProcdefServicereProcdefService;@AutowiredprivatePrjProjectServiceprojectService;@AutowiredprivatePrjProjectMeetingMappermeetingMapper;@OverridepublicStringgetWorkFlowType(){returnworkFlowType;}@Overridepublicvoidprocess(IRequestiRequest,Listlist,Mapparams){ProcessInstanceCreateRequestprocessInstanceCreateRequest=getProcessInstanceCreateRequest((PrjProject)list.get(0),iRequest);activitiService.startProcess(iRequest,processInstanceCreateRequest);}privateProcessInstanceCreateRequestgetProcessInstanceCreateRequest(PrjProjectprjProject,IRequestiRequest){ProcessInstanceCreateRequestcreateRequest=newProcessInstanceCreateRequest();PrjProjectproject=projectService.selectByPrimaryKey(iRequest,prjProject);ReProcdefreProcdefs;reProcdefs=reProcdefService.queryReProcdef("PRJ_PROJECT_APPROVE","PRJ_PROJECT");Stringid=reProcdefs.getId_();Stringname=reProcdefs.getName_();createRequest.setProcessDefinitionId(id);createRequest.setBusinessKey(prjProject.getProjectId().toString());List<RestVariable>variables=newArrayList<RestVariable>();List<RestVariable>transientVariables=newArrayList<RestVariable>();RestVariablerestVariable1=newRestVariable();RestVariablerestVariable2=newRestVariable();RestVariablerestVariable3=newRestVariable();RestVariablerestVariable4=newRestVariable();RestVariablerestVariable5=newRestVariable();RestVariablerestVariable6=newRestVariable();restVariable1.setName("processDefinitionId");restVariable1.setValue(id);variables.add(restVariable1);restVariable2.setName("prjProject");JSONObjectjsonObject=newJSONObject().fromObject(prjProject);restVariable2.setValue(jsonObject.toString());variables.add(restVariable2);restVariable3.setName("iRequest");restVariable3.setValue(iRequest);variables.add(restVariable3);restVariable4.setName("projectNum");restVariable4.setValue(project.getProjectNumber());variables.add(restVariable4);restVariable5.setName("projectName");restVariable5.setValue(project.getProjectName());variables.add(restVariable5);restVariable6.setName("startUserName");restVariable6.setValue(iRequest.getEmployeeCode());variables.add(restVariable6);RestVariablerestVariable7=newRestVariable();RestVariablerestVariable8=newRestVariable();RestVariablerestVariable9=newRestVariable();restVariable7.setName("documentCategory");restVariable7.setValue(project.getDocumentCategory());variables.add(restVariable7);restVariable8.setName("documentType");restVariable8.setValue(project.getDocumentType());variables.add(restVariable8);restVariable9.setName("documentId");restVariable9.setValue(project.getProjectId());variables.add(restVariable9);RestVariablerestVariable10=newRestVariable();restVariable10.setName("doubleFlag");PrjProjectMeetingmeeting=newPrjProjectMeeting();meeting.setProjectId(prjProject.getProjectId());List<PrjProjectMeeting>list=meetingMapper.select(meeting);if(list.size()>0){restVariable10.setValue("Y");}else{restVariable10.setValue("N");}variables.add(restVariable10);RestVariablerestVariable11=newRestVariable();restVariable11.setName("pName");restVariable11.setValue(name);variables.add(restVariable11);createRequest.setVariables(variables);createRequest.setTransientVariables(transientVariables);returncreateRequest;}}