bladex中flowable中配置监听器

摘要:
//flow服务下packageorg.springblade.flow.engine.listener.execution;importlombok.SneakyThrows;importlombok.extern.slf4j.Slf4j;importorg.flowable.engine.delegate.DelegateExecution;importorg.flowable.engine.

bladex中flowable中配置监听器第1张

//flow服务下

package org.springblade.flow.engine.listener.execution;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.utils.Func;
import org.springblade.desk.feign.IPurchaseOrderClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;

/**
 * create by Dell on 2020/7/16
 */
@Slf4j
@Component("purchaseOrderExecutionListener")
public class PurchaseOrderExecutionListener implements ExecutionListener {

	@Autowired
	private IPurchaseOrderClient purchaseOrderClient ;
	@SneakyThrows
	@Override
	public void notify(DelegateExecution execution) {
		String processInstanceId=execution.getProcessInstanceId();
		log.info("采购订单审批流程结束调用监听开始processInstanceId=============="+processInstanceId);
		Map<String,Object> msg=purchaseOrderClient.purchaseOrderCreate(processInstanceId);
		log.info("采购订单审批流程结束调用监听结束msg=============="+msg);
		if(Func.isNotEmpty(msg)){
			if(!(boolean)msg.get("msg")){
				throw new ServiceException("查询要写入sap的数据为空");
			}
		}else{
			throw new ServiceException("数据修改采购申请单或者写入sap出现错误");
		}
	}
}

//desk-api fegin目录下类

/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.desk.feign;

import org.springblade.core.launch.constant.AppConstant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * 工作流远程调用接口.
 *
 * @author Chill
 */
@FeignClient(
	value = AppConstant.APPLICATION_DESK_NAME
)
public interface IPurchaseOrderClient {

	String API_PREFIX = "/client";
	String TEST = API_PREFIX + "/purchaseorderCreate";

	@GetMapping(TEST)
	Map<String,Object> purchaseOrderCreate (@RequestParam("processInstanceId") String processInstanceId);


}

// desk服务下 fegin目录下类

/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.desk.feign;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.desk.service.IPurchaseOrderService;
import org.springblade.desk.service.IPurchaseRequestLineService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
 * 流程远程调用实现类
 *
 * @author pei
 */
@Transactional(rollbackFor = Exception.class)
@RestController
@AllArgsConstructor
@Slf4j
public class PurchaseOrderClient implements IPurchaseOrderClient {
	private IPurchaseOrderService purchaseOrderService;
	private IPurchaseRequestLineService purchaseRequestLineService;
	@GetMapping(TEST)
	@Override
	public Map<String,Object> purchaseOrderCreate(String processInstanceId) {
		log.info("processInstanceId==============="+processInstanceId);

		return purchaseOrderService.getOderInfo(processInstanceId);

	}

}

免责声明:文章转载自《bladex中flowable中配置监听器》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇Thinkphp6笔记八:公共函数配置Spring Data JPA 的 Specifications动态查询下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

随便看看

帆软—FineBI5.1忘记管理员登录密码及用户名

1、 查找数据库。脚本文件查找数据库。脚本文件。...

Java 并发系列之十:java 并发框架(2个)

108maximumPoolSize109线程池中允许的最大线程数。线程池的阻塞队列满了之后,如果还有任务提交,如果当前的线程数小于maximumPoolSize,则会新建线程来执行任务。线程的创建和销毁是需要代价的。121threadFactory122用于设置创建线程的工厂。所谓拒绝策略,是指将任务添加到线程池中时,线程池拒绝该任务所采取的相应策略。...

OSSEC初探

OSSEC的初始概念:OSSEC是一个开源的基于主机的入侵检测系统,可以执行日志分析、完整性检查、windows注册表监视、隐藏检测和实时报警。简单地说,OSSEC在C/S模式下工作。代理监视和收集信息并将其报告给服务器。服务器分析并预处理信息,并通过电子邮件将系统更改发送给管理员。...

docker安装宝塔

主机的/home/www文件夹映射到docker容器的/www(注意:如果文件目录不存在,特权意味着在运行容器时,容器被授予特权,容器有权写入文件。然后问题来了……安装完成后,如果重新启动容器,容器宝塔会丢失吗?不,让我们试试:...

flutter Radio单选框

单选框,允许用户从一组中选择一个选项。...

C# winform开发嵌套Chrome内核浏览器(WebKit.net)开发(一)

//Www.cnblogs.com/Maxq/p/6566558.htmlWebKit.net是WebKit的一个net包。使用它,。net程序可以非常方便地集成和使用webkit作为加载网页的容器。EventArgse){WebKit.WebKitBrowser=newWebKitBrowser();this.Controls.Add(浏览器);...