提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
前言
现在是在实习,公司使用的是BPM开发,师傅给了我视频以及文档进行学习,不过我的进度太慢了,但是慢工出细活,还是可以的。
一、BPM是什么?
业务流程管理(Business Process Management)是以规范化地构造端到端的卓越业务流程为中心,一持续地提高组织绩效为目的的系统化管理方法。
二、BPMS是什么?
BPM系统并不是一个新概念,前身可追溯到上世纪二三十年的企业流程化管理思想。
所谓BPM(Business Process Management),即业务流程管理,是根据业务环境的变化,推进人与人之间,人与系统之间以及系统与系统之间的整合及调整的经营方法与解决方案的IT工具。
BPM=理念+方法+工具
二、自定义@公式
1.用法
在创建存储模型时,可以给字段设置默认值,默认值设置的时候可以使用平台提供的@公式来设置默认值,也可以使用自定义的@公式。
2.开发
在开发工具上编写逻辑代码,公式要实现的功能在开发工具中定义好。
下面这个@公式所要实现的是计算有效期:
import com.actionsoft.bpms.commons.at.AbstExpression;
import com.actionsoft.bpms.commons.at.ExpressionContext;
import com.actionsoft.exception.AWSExpressionException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class HtValidAt extends AbstExpression {
public HtValidAt(ExpressionContext atContext, String expressionValue) {
super(atContext, expressionValue);
}
@Override
public String execute(String s) throws AWSExpressionException {
int monthLength = 0;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String s1 = getParameter(s, 1);//开始日期,当日
String s2 = getParameter(s, 2);
Calendar today = Calendar.getInstance();
Calendar end = Calendar.getInstance();
try {
today.setTime(format.parse(s1));
end.setTime(format.parse(s2));
} catch (ParseException e) {
e.printStackTrace();
}
int result = end.get(Calendar.MONTH)-today.get(Calendar.MONTH);
int month = (end.get(Calendar.YEAR)-today.get(Calendar.YEAR))*12;
monthLength=Math.abs(result+month);
return String.valueOf(monthLength);
}
}
getParameter:这个就是定义@公式需要传入的参数有几个,有没有。
其他的代码就是自己的代码逻辑。
2.进行注册
在注册的时候也是需要编写一个类,然后在平台上注册
import com.actionsoft.apps.listener.PluginListener;
import com.actionsoft.apps.resource.AppContext;
import com.actionsoft.apps.resource.plugin.profile.AWSPluginProfile;
import com.actionsoft.apps.resource.plugin.profile.AtFormulaPluginProfile;
import java.util.ArrayList;
import java.util.List;
public class HtPlugin implements PluginListener {
@Override
public List<AWSPluginProfile> register(AppContext appContext) {
List<AWSPluginProfile> file = new ArrayList<AWSPluginProfile>();
file.add(new AtFormulaPluginProfile("字符串","@HtEndAt(*str1,*str2)",HtEndAt.class.getName(),"合同结束日期","结束日期计算"));
file.add(new AtFormulaPluginProfile("字符串","@HtValidAt(*str1,*str2)",HtValidAt.class.getName(),"合同有效期","同有效期计算"));
file.add(new AtFormulaPluginProfile("字符串","@HtSerialNumberAt()",HtSerialNumberAt.class.getName(),"合同流水号","生成合同流水号"));
return file;
}
}
add()就是将我们编写的@公式类注册到该应用的PluginListener类
3.使用
在平台上找到我们想要使用公式的应用
扩展插件的地方填的是注册类的包名+类名,这样才能够找到,保存后就可以使用了。
总结
自定义@公式就是固定的流程,具体的就是咱们自己想要这个@公式做什么,我们就写什么逻辑。