自写抄送通知

一 . bpmn2.0

  1. 添加手工任务节点


    13055171-370fc11d778da4db.png
  2. 名称
    填写通知的标题
  3. 描述
    填写需要通知的角色
  • 如有多个需要逗号分割role1,role2
  1. 监听器
  • 监听事件start
  • 监听类com.jeeplus.modules.act.listener.TestNotifyListener

这个类已经编写好了,这个类会给添加Notify的数据库记录

二 . 监听类

/**
 * @see 手工任务专用 测试知会供能
 */

@Component
public class NotifyListener implements JavaDelegate
{


    private static final String String = null;

    @Override
    public void execute(DelegateExecution execution) throws Exception
    {
        SystemService systemService = SpringContextHolder.getBean(SystemService.class);
        NotifyService notifyService = SpringContextHolder.getBean(NotifyService.class);
        // 获取流程id
        String procInsId = execution.getProcessInstanceId();
        // 通知名称
        String notifyName = execution.getCurrentActivityName();// 节点名称
        // 通知类型(流程key,通过对比key,才可以确认查询的数据类型)
        String processDefinitionId = execution.getProcessDefinitionId();
        /**
         * jeeplus/a/act/task/form?
         * taskDefKey=&
         * procInsId=426dc735210d4a2390d80e47027db173&
         * procDefId=finance_loan:1:4619ac0def5b46ad998af6b81795f887
         * 
         * taskDefKey不用写值表示,最终状态
         * 
         * */
        // 角色1,角色2(填写的内容是角色的“enmame”)
        String roles = (java.lang.String) ActUtils.getProperties(execution).get("documentation");// 手工任务中的描述填写角色(dep,emp)
        String[] ennames = roles.split(",");
        // 根据roles获取要通知的人
        HashSet<User> users = new HashSet<>();
        for (String enname : ennames)
        {
            Role role = systemService.getRoleByEnname(enname);
            User user = new User(role);
            List<User> findUser = systemService.findUser(user);
            for (User us : findUser)
            {
                users.add(us);// 因为set可以去重(但是这里的User类需要重写hashcode的方法)
            }
        }
        for (User user : users)
        {
            Notify notify = new Notify(notifyName, processDefinitionId, user, procInsId, "未读");
            // 保存通知单
            notifyService.save(notify);
            System.out.println();
        }
    }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值