package com.ruoyi.project.activiti.service.impl;

import com.ruoyi.project.activiti.domain.ActIdGroup;
import com.ruoyi.project.activiti.mapper.ActIdGroupMapper;
import com.ruoyi.project.activiti.service.ActIdGroupService;
import org.activiti.engine.IdentityService;
import org.activiti.engine.identity.Group;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 流程用户组Service业务层处理
 *
 * @author Xianlu Tech
 * @date 2019-10-02
 */
@Service
public class ActIdGroupServiceImpl implements ActIdGroupService
{
    private static final Logger LOGGER = LoggerFactory.getLogger(ActIdGroupServiceImpl.class);

    @Autowired
    private ActIdGroupMapper actIdGroupMapper;

    @Autowired
    private IdentityService identityService;


    /**
     * 新增流程用户组
     *
     * @param actIdGroup 流程用户组
     * @return 结果
     */
    @Transactional
    @Override
    public void add(ActIdGroup actIdGroup){
        String id = actIdGroup.getId();
        String name = actIdGroup.getName();
        Group group = identityService.newGroup(name);   //初始化用户组group1
        group.setId(id);
        identityService.saveGroup(group);
    }

}
