package cn.ksource.core.workflow; import java.util.HashMap; import java.util.List; import java.util.Map; import cn.ksource.beans.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import cn.ksource.core.dao.BaseDao; import cn.ksource.core.dao.SqlParameter; import cn.ksource.web.Constants; @Service public class WorkflowBusinessServiceImpl implements WorkflowBusinessService { @Autowired private BaseDao baseDao; @Autowired private WorkflowCoreService workflowCoreService; public void toNode(WORKFLOW_BASE base,String node_template_id,NodeDealEntity entity){ workflowCoreService.toNode(base, node_template_id, entity); } @Override public List getBackTemplateNodeList( String nodeInstanceId) { StringBuilder sql = new StringBuilder(); sql.append("select tn.* "); sql.append("from workflow_template_node tn "); sql.append("where tn.ID in (select ROLEBACKNODEID from workflow_roleback_node where "); sql.append("NODETEMPLEID in (select NODE_TEMPLATE_ID from workflow_node where ID=:id))"); return baseDao.queryForList(sql.toString(), new SqlParameter().addValue("id", nodeInstanceId)); } @Override public WORKFLOW_BASE toBack(String workflowInstanceId, String nodeInstanceId, String userId, Integer result, String note, String backNodeTemplateId) { GG_USER user = new GG_USER(userId).getInstanceById(); String userName = user != null ? user.getZsxm() : ""; WorkflowDealEntity entity = new WorkflowDealEntity(); entity.setBackNodeId(backNodeTemplateId); entity.setNodeInstanceId(nodeInstanceId); entity.setNote(note); entity.setResult(result); entity.setUserId(userId); entity.setUserName(userName); entity.setWfInstanceId(workflowInstanceId); workflowCoreService.toBack(entity, new HashMap()); return new WORKFLOW_BASE(workflowInstanceId).getInstanceById(); } @Override public WORKFLOW_BASE toNext(String workflowInstanceId, String nodeInstanceId, String userId, Integer result, String note) { GG_USER user = new GG_USER(userId).getInstanceById(); String userName = user != null ? user.getZsxm() : ""; WorkflowDealEntity entity = new WorkflowDealEntity(); entity.setNodeInstanceId(nodeInstanceId); entity.setNote(note); entity.setResult(result); entity.setUserId(userId); entity.setUserName(userName); entity.setWfInstanceId(workflowInstanceId); //上一环节指定人员时,主要负责人可以推动流程到下一节点,其他负责人只能更新本节点状态 WORKFLOW_NODE node = new WORKFLOW_NODE(nodeInstanceId).getInstanceById(); if (node.getDeal_type() - Constants.WORKFLOW_TEMPLATE_NODE_DEALER_TYPE_ASSIGN == 0 && !isAdminWorkflowNode(workflowInstanceId, nodeInstanceId, userId)) { workflowCoreService.toNextByPartner(entity, new HashMap()); } else { workflowCoreService.toNext(entity, new HashMap()); } return new WORKFLOW_BASE(workflowInstanceId).getInstanceById(); } @Override public WORKFLOW_BASE toNext(String workflowInstanceId, String nodeInstanceId, String userId, Integer result, String note, List dutyers) { GG_USER user = new GG_USER(userId).getInstanceById(); String userName = user != null ? user.getZsxm() : ""; WorkflowDealEntity entity = new WorkflowDealEntity(); entity.setNodeInstanceId(nodeInstanceId); entity.setNote(note); entity.setResult(result); entity.setUserId(userId); entity.setUserName(userName); entity.setWfInstanceId(workflowInstanceId); //上一环节指定人员时,主要负责人可以推动流程到下一节点,其他负责人只能更新本节点状态 WORKFLOW_NODE node = new WORKFLOW_NODE(nodeInstanceId).getInstanceById(); if (node.getDeal_type() - Constants.WORKFLOW_TEMPLATE_NODE_DEALER_TYPE_ASSIGN == 0 && !isAdminWorkflowNode(workflowInstanceId, nodeInstanceId, userId)) { workflowCoreService.toNextByPartner(entity, new HashMap()); } else { workflowCoreService.toNext(entity, dutyers, new HashMap()); } return new WORKFLOW_BASE(workflowInstanceId).getInstanceById(); } @Override public WORKFLOW_BASE closeWorkflow(String workflowInstanceId, String nodeInstanceId, String userId, Integer result, String note) { GG_USER user = new GG_USER(userId).getInstanceById(); String userName = user != null ? user.getZsxm() : ""; WorkflowDealEntity entity = new WorkflowDealEntity(); entity.setNodeInstanceId(nodeInstanceId); entity.setNote(note); entity.setResult(result); entity.setUserId(userId); entity.setUserName(userName); entity.setWfInstanceId(workflowInstanceId); workflowCoreService.handCloseWorkflow(entity, new HashMap()); return new WORKFLOW_BASE(workflowInstanceId).getInstanceById(); } @Override public WORKFLOW_BASE finishWorkflow(String workflowInstanceId, String nodeInstanceId, String userId, Integer result, String note) { GG_USER user = new GG_USER(userId).getInstanceById(); String userName = user != null ? user.getZsxm() : ""; WorkflowDealEntity entity = new WorkflowDealEntity(); entity.setNodeInstanceId(nodeInstanceId); entity.setNote(note); entity.setResult(result); entity.setUserId(userId); entity.setUserName(userName); entity.setWfInstanceId(workflowInstanceId); workflowCoreService.handFinishWorkflow(entity, new HashMap()); return new WORKFLOW_BASE(workflowInstanceId).getInstanceById(); } @Override public boolean isAdminWorkflowNode(String flowId, String nodeId, String userId) { StringBuilder sql = new StringBuilder(); sql.append("select count(u.ID) "); sql.append("from workflow_template_node_user u "); sql.append("where u.NODE_ID=(select NODE_TEMPLATE_ID from workflow_node where ID=:id) "); sql.append("and u.USER_ID=:user_id "); sql.append("and u.IS_ADMIN=1 "); sql.append("and u.FLOW_INSTANCE_ID=:flow_instance_id "); SqlParameter param = new SqlParameter(); param.addValue("id", nodeId); param.addValue("user_id", userId); param.addValue("flow_instance_id", flowId); return baseDao.queryForInteger(sql.toString(), param) > 0 ? true : false; } @Override public WORKFLOW_BASE updateWorkflowState(String workflowInstanceId, Integer wfstate) { return new WORKFLOW_BASE(workflowInstanceId).getInstanceById() .setWfstate(wfstate) .update(); } /** * 获取报修设备信息 * @param businessId * @return */ private List queryCiRepairDetail(String businessId) { String sql = "select CI_ID,CI_NAME from sc_workflow_ci_repair_ci where BUSINESS_ID=:business_id "; SqlParameter param = new SqlParameter(); param.addValue("business_id", businessId); return baseDao.queryForList(sql, param); } /** * 获取变更设备信息 * @param businessId * @return */ private List queryCiChangeDetail(String businessId) { String sql = "select CI_ID,CI_NAME from sc_workflow_ci_change_ci where BUSINESS_ID=:business_id "; SqlParameter param = new SqlParameter(); param.addValue("business_id", businessId); return baseDao.queryForList(sql, param); } /** * 获取新增、变更、报废设备信息 * @param businessId * @return */ private List queryCiReferDetail(String businessId, int referType) { String sql = "select CI_ID,CI_NAME from sc_workflow_ci_refer where BUSINESS_ID=:business_id and REFER_TYPE=:refer_type "; SqlParameter param = new SqlParameter(); param.addValue("business_id", businessId); param.addValue("refer_type", referType); return baseDao.queryForList(sql, param); } @Override public WORKFLOW_BASE startCIRemindWorkflow(String businessId) { //获取提醒申请信息 SC_WORKFLOW_CI_REMIND remind = new SC_WORKFLOW_CI_REMIND().setId(businessId).queryForBean(); if (remind == null) { return null; } //启动智能提醒流程 WorkflowStartEntity startEntity = new WorkflowStartEntity(); startEntity.setBusinessId(businessId); startEntity.setBusinessType(Constants.WORKFLOW_BASE_BUSINESS_TYPE_CI_REMIND); startEntity.setCustomerId(remind.getCustomer_id()); startEntity.setFlowName(remind.getName()); startEntity.setOrderCode(remind.getOrder_code()); startEntity.setCustomerName(remind.getCustomer_name()); startEntity.setUserName("系统定时任务"); //服务内容说明 startEntity.setWfNote(remind.getService_content()); startEntity.setSubCustomerId(remind.getSub_customer_id()); startEntity.setSubCustomerName(remind.getSub_customer_name()); //客户加盟商信息 SC_PARTNER_CUSTOMER_INFO customer = new SC_PARTNER_CUSTOMER_INFO().setId(remind.getCustomer_id()).queryForBean(); if (customer != null) { } //获取智能提醒设备 //List ciList = this.queryCiRemindCi(businessId); //startEntity.setCiList(ciList); WORKFLOW_BASE work_base = workflowCoreService.startWorkflow(startEntity, new HashMap()); //反写智能提醒表中流程编号 if (work_base != null) { remind.setFlow_id(work_base.getId()) .update(); } return work_base; } /** * 获取智能提醒设备信息 * @param businessId * @return */ private List queryCiRemindCi(String businessId) { String sql = "select CI_ID,CI_NAME from sc_workflow_ci_remind_ci where BUSINESS_ID=:business_id "; SqlParameter param = new SqlParameter(); param.addValue("business_id", businessId); return baseDao.queryForList(sql, param); } @Override public WORKFLOW_BASE startCIHealthWorkflow(String businessId) { //获取体检申请信息 SC_WORKFLOW_CI_HEALTH health = new SC_WORKFLOW_CI_HEALTH(businessId).getInstanceById(); if (health == null) { return null; } //启动健康检查流程 WorkflowStartEntity startEntity = new WorkflowStartEntity(); startEntity.setBusinessId(businessId); startEntity.setBusinessType(Constants.WORKFLOW_BASE_BUSINESS_TYPE_CI_HEALTH); startEntity.setCustomerId(health.getCustomer_id()); startEntity.setCustomerName(health.getCustomer_name()); startEntity.setFlowName(health.getName()); startEntity.setSubCustomerId(health.getSub_customer_id()); startEntity.setSubCustomerName(health.getSub_customer_name()); startEntity.setOrderCode(health.getOrder_code()); //申请人指定为客户 startEntity.setUserId(""); startEntity.setUserName("系统定时任务"); //获取健康体检设备 //List ciList = this.queryCiHealthCi(businessId); //startEntity.setCiList(ciList); WORKFLOW_BASE work_base = workflowCoreService.startWorkflow(startEntity, new HashMap()); //反写健康检查申请表中流程编号 if (work_base != null) { health.setFlow_id(work_base.getId()) .update(); } return work_base; } @Override public WORKFLOW_BASE toLast(String workflowInstanceId, String nodeInstanceId, String userId, Integer result, String note) { GG_USER user = new GG_USER(userId).getInstanceById(); String userName = user != null ? user.getZsxm() : ""; WorkflowDealEntity entity = new WorkflowDealEntity(); entity.setNodeInstanceId(nodeInstanceId); entity.setNote(note); entity.setResult(result); entity.setUserId(userId); entity.setUserName(userName); entity.setWfInstanceId(workflowInstanceId); workflowCoreService.toLast(entity, new HashMap()); return new WORKFLOW_BASE(workflowInstanceId).getInstanceById(); } /** * 获取健康检查设备信息 * @param businessId * @return */ private List queryCiHealthCi(String businessId) { String sql = "select CI_ID,CI_NAME from sc_workflow_ci_health_ci where BUSINESS_ID=:business_id "; SqlParameter param = new SqlParameter(); param.addValue("business_id", businessId); return baseDao.queryForList(sql, param); } @Override public WORKFLOW_NODE getLastWorkflowNode(String flowId, String nodeId) { String sql = "select * from workflow_node where FLOWID=:flowid and ID<>:id and FLOWSTATE=3 order by CREATETIME desc limit 0,1 "; SqlParameter param = new SqlParameter(); param.addValue("flowid", flowId); param.addValue("id", nodeId); return baseDao.queryForBean(sql, param, new WORKFLOW_NODE()); } @Override public WORKFLOW_BASE toNode(int nodeNum, String workflowInstanceId, String nodeInstanceId, String userId, Integer result, String note, List dutyers) { GG_USER user = new GG_USER(userId).getInstanceById(); String userName = user != null ? user.getZsxm() : ""; WorkflowDealEntity entity = new WorkflowDealEntity(); entity.setNodeInstanceId(nodeInstanceId); entity.setNote(note); entity.setResult(result); entity.setUserId(userId); entity.setUserName(userName); entity.setWfInstanceId(workflowInstanceId); workflowCoreService.toNode(nodeNum, entity, dutyers, new HashMap()); return new WORKFLOW_BASE(workflowInstanceId).getInstanceById(); } @Override public WORKFLOW_BASE startIncidentWorkflow(String businessId,String bz) { //获取事件申请信息 SC_WORKFLOW_INCIDENT incident = new SC_WORKFLOW_INCIDENT(businessId).getInstanceById(); if (incident == null) { return null; } //启动事件流程 WorkflowStartEntity startEntity = new WorkflowStartEntity(); startEntity.setBusinessId(businessId); startEntity.setBusinessType(Constants.WORKFLOW_BASE_BUSINESS_TYPE_INCIDENT); startEntity.setCustomerId(incident.getCustomer_id()); startEntity.setCustomerName(incident.getCustomer_name()); startEntity.setFlowName(incident.getFlow_name()); startEntity.setOrderCode(incident.getOrder_code()); startEntity.setUserId(incident.getCreate_user_id()); startEntity.setUserName(incident.getCreate_user_name()); startEntity.setWfNote(incident.getDescrip()); startEntity.setSubCustomerId(incident.getSub_customer_id()); startEntity.setSubCustomerName(incident.getSub_customer_name()); startEntity.setNote(incident.getDescrip()); //获取关联设备 /*List ciList = this.queryIncidentCi(businessId); startEntity.setCiList(ciList);*/ Map map = new HashMap(); map.put("bz", bz); WORKFLOW_BASE work_base = workflowCoreService.startWorkflow(startEntity, map); if (work_base != null) { incident.setFlow_id(work_base.getId()) .update(); } return work_base; } /** * 入库流程 */ @Override public WORKFLOW_BASE startStockWorkflow(String businessId,String bz) { //获取事件申请信息 SPARE_PART_STORAGE incident = new SPARE_PART_STORAGE(businessId).getInstanceById(); if (incident == null) { return null; } //启动事件流程 WorkflowStartEntity startEntity = new WorkflowStartEntity(); startEntity.setBusinessId(businessId); startEntity.setBusinessType(Constants.WORKFLOW_BASE_BUSINESS_TYPE_STOCK); startEntity.setFlowName(incident.getOrder_name()); startEntity.setOrderCode(incident.getOrder_code()); startEntity.setUserId(incident.getCreate_id()); startEntity.setUserName(incident.getCreate_name()); startEntity.setWfNote(incident.getStorage_reason()); Map map = new HashMap(); map.put("bz", bz); WORKFLOW_BASE work_base = workflowCoreService.startWorkflow(startEntity, map); if (work_base != null) { incident.setFlow_id(work_base.getId()) .update(); } return work_base; } /** * 备件申领流程 */ @Override public WORKFLOW_BASE startSpareWorkflow(String businessId,String bz) { //获取事件申请信息 SPARE_PART_APPLY incident = new SPARE_PART_APPLY(businessId).getInstanceById(); if (incident == null) { return null; } //启动事件流程 WorkflowStartEntity startEntity = new WorkflowStartEntity(); startEntity.setBusinessId(businessId); startEntity.setBusinessType(Constants.WORKFLOW_BASE_BUSINESS_TYPE_SPARE); startEntity.setFlowName(incident.getOrder_name()); startEntity.setOrderCode(incident.getOrder_code()); startEntity.setUserId(incident.getCreate_id()); startEntity.setUserName(incident.getCreate_name()); startEntity.setWfNote(incident.getApply_reason()); Map map = new HashMap(); map.put("bz", bz); WORKFLOW_BASE work_base = workflowCoreService.startWorkflow(startEntity, map); if (work_base != null) { incident.setFlow_id(work_base.getId()) .update(); } return work_base; } /** * 出库申请流程 */ @Override public WORKFLOW_BASE startDeliveryWorkflow(String businessId,String bz) { //获取事件申请信息 SPARE_PART_DELIVERY incident = new SPARE_PART_DELIVERY(businessId).getInstanceById(); if (incident == null) { return null; } //启动事件流程 WorkflowStartEntity startEntity = new WorkflowStartEntity(); startEntity.setBusinessId(businessId); startEntity.setBusinessType(Constants.WORKFLOW_BASE_BUSINESS_TYPE_CKLC); startEntity.setFlowName(incident.getOrder_name()); startEntity.setOrderCode(incident.getOrder_code()); startEntity.setUserId(incident.getCreate_id()); startEntity.setUserName(incident.getCreate_name()); startEntity.setWfNote(incident.getDelivery_reason()); Map map = new HashMap(); map.put("bz", bz); WORKFLOW_BASE work_base = workflowCoreService.startWorkflow(startEntity, map); if (work_base != null) { incident.setFlow_id(work_base.getId()) .update(); } return work_base; } /** * 报损报溢流程 */ @Override public WORKFLOW_BASE startOverageLossWorkflow(String businessId,String bz) { //获取事件申请信息 OVERAGE_LOSS incident = new OVERAGE_LOSS(businessId).getInstanceById(); if (incident == null) { return null; } //启动事件流程 WorkflowStartEntity startEntity = new WorkflowStartEntity(); startEntity.setBusinessId(businessId); startEntity.setBusinessType(Constants.WORKFLOW_BASE_BUSINESS_TYPE_BSBY); startEntity.setFlowName(incident.getOrder_name()); startEntity.setOrderCode(incident.getOrder_code()); startEntity.setUserId(incident.getCreate_id()); startEntity.setUserName(incident.getCreate_name()); startEntity.setWfNote(incident.getNote()); Map map = new HashMap(); map.put("bz", bz); WORKFLOW_BASE work_base = workflowCoreService.startWorkflow(startEntity, map); if (work_base != null) { incident.setFlow_id(work_base.getId()) .update(); } return work_base; } @Override public WORKFLOW_BASE startInventoryWorkflow(String businessId,String bz) { //获取事件申请信息 STOCK_INVENTORY stockInventory = new STOCK_INVENTORY(businessId).getInstanceById(); if (stockInventory == null) { return null; } //启动库存盘点 WorkflowStartEntity startEntity = new WorkflowStartEntity(); startEntity.setBusinessId(businessId); startEntity.setBusinessType(Constants.WORKFLOW_BASE_BUSINESS_TYPE_KCPD); startEntity.setFlowName(stockInventory.getOrder_name()); startEntity.setOrderCode(stockInventory.getOrder_code()); startEntity.setUserId(stockInventory.getCreate_id()); startEntity.setUserName(stockInventory.getCreate_name()); startEntity.setWfNote(stockInventory.getNote()); Map map = new HashMap(); map.put("bz", bz); WORKFLOW_BASE work_base = workflowCoreService.startWorkflow(startEntity, map); if (work_base != null) { stockInventory.setFlow_id(work_base.getId()).update(); } return work_base; } public WORKFLOW_BASE startIncident_LocalWorkflow(String businessId, String bz){ //获取事件申请信息 SC_WORKFLOW_INCIDENT_LOCAL incident = new SC_WORKFLOW_INCIDENT_LOCAL(businessId).getInstanceById(); if (incident == null) { return null; } //启动事件流程 WorkflowStartEntity startEntity = new WorkflowStartEntity(); startEntity.setBusinessId(businessId); startEntity.setBusinessType(Constants.WORKFLOW_BASE_BUSINESS_TYPE_INCIDENT_LOCAL); startEntity.setCustomerId(incident.getCustomer_id()); startEntity.setCustomerName(incident.getCustomer_name()); startEntity.setFlowName(incident.getFlow_name()); startEntity.setOrderCode(incident.getOrder_code()); startEntity.setUserId(incident.getCreate_user_id()); startEntity.setUserName(incident.getCreate_user_name()); startEntity.setWfNote(incident.getDescrip()); startEntity.setSubCustomerId(incident.getSub_customer_id()); startEntity.setSubCustomerName(incident.getSub_customer_name());; //获取关联设备 /*String sql = "select CI_ID,CI_NAME from SC_WORKFLOW_INCIDENT_LOCAL_CI where BUSINESS_ID=:business_id "; SqlParameter param = new SqlParameter(); param.addValue("business_id", businessId); List ciList = baseDao.queryForList(sql, param); startEntity.setCiList(ciList); */ Map map = new HashMap(); map.put("bz", bz); WORKFLOW_BASE work_base = workflowCoreService.startWorkflow(startEntity, map); //反写健康检查申请表中流程编号 if (work_base != null) { incident.setFlow_id(work_base.getId()) .update(); } return work_base; } public WORKFLOW_BASE startQuestionWorkflow(String businessId,String bz){ //获取问题信息 SC_WORKFLOW_QUESTION incident = new SC_WORKFLOW_QUESTION(businessId).getInstanceById(); if (incident == null) { return null; } //启动问题流程 WorkflowStartEntity startEntity = new WorkflowStartEntity(); startEntity.setBusinessId(businessId); startEntity.setBusinessType(Constants.WORKFLOW_BASE_BUSINESS_TYPE_QUESTION); startEntity.setCustomerId(incident.getCustomer_id()); startEntity.setCustomerName(incident.getCustomer_name()); startEntity.setFlowName(incident.getFlow_name()); startEntity.setOrderCode(incident.getOrder_code()); startEntity.setUserId(incident.getCreate_user_id()); startEntity.setUserName(incident.getCreate_user_name()); startEntity.setWfNote(incident.getDescrip()); startEntity.setSubCustomerId(incident.getSub_customer_id()); startEntity.setSubCustomerName(incident.getSub_customer_name()); startEntity.setNote(bz); Map map = new HashMap(); map.put("bz", bz); //获取关联设备 /*String sql = "select CI_ID,CI_NAME from SC_WORKFLOW_INCIDENT_LOCAL_CI where BUSINESS_ID=:business_id "; SqlParameter param = new SqlParameter(); param.addValue("business_id", businessId); List ciList = baseDao.queryForList(sql, param); startEntity.setCiList(ciList); */ WORKFLOW_BASE work_base = workflowCoreService.startWorkflow(startEntity, map); //反写健康检查申请表中流程编号 if (work_base != null) { incident.setFlow_id(work_base.getId()) .update(); } return work_base; } private List queryIncidentCi(String businessId) { String sql = "select CI_ID,CI_NAME from sc_workflow_incident_ci where BUSINESS_ID=:business_id "; SqlParameter param = new SqlParameter(); param.addValue("business_id", businessId); return baseDao.queryForList(sql, param); } @Override public WORKFLOW_BASE resetNodeDealer(String workflowInstanceId, String nodeInstanceId, String userId, String userName) { //更新节点处理人,角色置空 new WORKFLOW_NODE().setId(nodeInstanceId) .setCurrent_dealer_id(userId) .setCurrent_dealer_name(userName) .setCurrent_deal_roleida("") .setCurrent_deal_rolename("") .update(); //更新流程处理人 new WORKFLOW_BASE().setId(workflowInstanceId) .setCurrent_dealer_id(userId) .setCurrent_dealer_name(userName) .setCurrent_deal_roleida("") .setCurrent_deal_rolename("") .update(); return new WORKFLOW_BASE(workflowInstanceId).getInstanceById(); } @Override public WORKFLOW_BASE deleteWorkflow(String workflowInstanceId, String nodeInstanceId, String userId, Integer result, String note) { GG_USER user = new GG_USER(userId).getInstanceById(); String userName = user != null ? user.getZsxm() : ""; WorkflowDealEntity entity = new WorkflowDealEntity(); entity.setNodeInstanceId(nodeInstanceId); entity.setNote(note); entity.setResult(result); entity.setUserId(userId); entity.setUserName(userName); entity.setWfInstanceId(workflowInstanceId); workflowCoreService.handDeleteWorkflow(entity, new HashMap()); return new WORKFLOW_BASE(workflowInstanceId).getInstanceById(); } public WORKFLOW_BASE startChangeWorkflow(String businessId){ //获取问题信息 SC_WORKFLOW_CHANGE incident = new SC_WORKFLOW_CHANGE(businessId).getInstanceById(); if (incident == null) { return null; } //启动问题流程 WorkflowStartEntity startEntity = new WorkflowStartEntity(); startEntity.setBusinessId(businessId); startEntity.setBusinessType(Constants.WORKFLOW_BASE_BUSINESS_TYPE_CI_CHANGE); startEntity.setCustomerId(incident.getCustomer_id()); startEntity.setCustomerName(incident.getCustomer_name()); startEntity.setFlowName(incident.getFlow_name()); startEntity.setOrderCode(incident.getOrder_code()); startEntity.setUserId(incident.getCreate_user_id()); startEntity.setUserName(incident.getCreate_user_name()); startEntity.setWfNote(incident.getDescrip()); startEntity.setProjectId(incident.getProject_id()); startEntity.setProjectName(incident.getProject_name()); startEntity.setSubCustomerId(incident.getSub_customer_id()); startEntity.setSubCustomerName(incident.getSub_customer_name()); //客户加盟商信息 SC_PARTNER_CUSTOMER_INFO customer = new SC_PARTNER_CUSTOMER_INFO().setId(incident.getCustomer_id()).queryForBean(); //获取关联设备 /*String sql = "select CI_ID,CI_NAME from SC_WORKFLOW_INCIDENT_LOCAL_CI where BUSINESS_ID=:business_id "; SqlParameter param = new SqlParameter(); param.addValue("business_id", businessId); List ciList = baseDao.queryForList(sql, param); startEntity.setCiList(ciList); */ WORKFLOW_BASE work_base = workflowCoreService.startWorkflow(startEntity, new HashMap()); //反写健康检查申请表中流程编号 if (work_base != null) { incident.setFlow_id(work_base.getId()) .update(); } return work_base; } @Override public WORKFLOW_BASE startReleaseWorkflow(String businessId,String note) { //获取新增申请信息 SC_WORKFLOW_RELEASE release = new SC_WORKFLOW_RELEASE().setId(businessId).getInstanceById(); if (release == null) { return null; } //启动新增流程 WorkflowStartEntity startEntity = new WorkflowStartEntity(); startEntity.setBusinessId(businessId); startEntity.setBusinessType(Constants.WORKFLOW_BASE_BUSINESS_TYPE_RELEASE); startEntity.setCustomerId(release.getCustomer_id()); startEntity.setCustomerName(release.getCustomer_name()); //startEntity.setFlowName("发布管理-"+release.getOrder_code()); startEntity.setFlowName(release.getName()); startEntity.setOrderCode(release.getOrder_code()); startEntity.setUserId(release.getRelease_user_id()); startEntity.setUserName(release.getRelease_user_name()); startEntity.setProjectId(release.getProject_id()); startEntity.setProjectName(release.getProject_name()); startEntity.setSubCustomerId(release.getSub_customer_id()); startEntity.setSubCustomerName(release.getSub_customer_name()); startEntity.setNote(note); //客户加盟商信息 SC_PARTNER_CUSTOMER_INFO customer = new SC_PARTNER_CUSTOMER_INFO().setId(release.getCustomer_id()).queryForBean(); /*if (customer != null) { startEntity.setPartnerId(customer.getPartner_id()); startEntity.setPartnerName(customer.getPartner_name()); }*/ WORKFLOW_BASE work_base = workflowCoreService.startWorkflow(startEntity, new HashMap()); //反写新增申请表中流程编号 if (work_base != null) { release.setFlow_id(work_base.getId()) .update(); } return work_base; } @Override public WORKFLOW_BASE startCIAddWorkflow(String businessId) { //获取新增申请信息 SC_WORKFLOW_CI_ADD add = new SC_WORKFLOW_CI_ADD().setId(businessId).getInstanceById(); if (add == null) { return null; } //启动新增流程 WorkflowStartEntity startEntity = new WorkflowStartEntity(); startEntity.setBusinessId(businessId); startEntity.setBusinessType(Constants.WORKFLOW_BASE_BUSINESS_TYPE_CI_ADD); startEntity.setCustomerId(add.getCustomer_id()); startEntity.setCustomerName(add.getCustomer_name()); startEntity.setFlowName(add.getFlow_name()); startEntity.setOrderCode(add.getOrder_code()); startEntity.setUserId(add.getApply_user_id()); startEntity.setUserName(add.getApply_user_name()); startEntity.setNote(add.getApply_reason()); /*//客户加盟商信息 SC_PARTNER_CUSTOMER_INFO customer = new SC_PARTNER_CUSTOMER_INFO().setId(add.getCustomer_id()).queryForBean(); if (customer != null) { startEntity.setPartnerId(customer.getPartner_id()); startEntity.setPartnerName(customer.getPartner_name()); }*/ WORKFLOW_BASE work_base = workflowCoreService.startWorkflow(startEntity, new HashMap()); //反写新增申请表中流程编号 if (work_base != null) { add.setFlow_id(work_base.getId()) .update(); } return work_base; } }