能力申请 使用配置文件进行配置

This commit is contained in:
wangliwen 2022-04-24 09:45:43 +08:00
parent 368e33b0d5
commit f57681856c
5 changed files with 30 additions and 9 deletions

View File

@ -19,6 +19,7 @@ import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Map; import java.util.Map;
@ -30,7 +31,10 @@ import java.util.Map;
public class CorrectionListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate { public class CorrectionListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate {
private static Logger logger = LoggerFactory.getLogger(CorrectionListener.class); private static Logger logger = LoggerFactory.getLogger(CorrectionListener.class);
private static String roleName = "部门审批人"; @Value("${big_date.assignee_role_name}")
private static String roleName;
@Value("${big_date.name}")
private static String bigDateDeptName;
@Autowired @Autowired
private SysRoleService sysRoleService; private SysRoleService sysRoleService;
@ -66,8 +70,8 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
deptId = resourceEntityDto.getDeptId(); deptId = resourceEntityDto.getDeptId();
SysDeptDTO deptDTO = SysDeptDTO deptDTO =
sysDeptService.get(resourceEntityDto.getDeptId()); sysDeptService.get(resourceEntityDto.getDeptId());
if (deptDTO != null && deptDTO.getName().equals("青岛市大数据发展管理局")) { if (deptDTO != null && deptDTO.getName().equals(bigDateDeptName)) {
logger.error("第二级别审批仍然为 青岛市大数据发展管理局"); logger.error("第二级别审批仍然为 " + bigDateDeptName);
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "默认通过"); taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables()); taskService.complete(delegateTask.getId(), delegateTask.getVariables());
} }

View File

@ -14,6 +14,7 @@ import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
@ -23,8 +24,10 @@ import org.springframework.stereotype.Component;
public class DataCenterListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate { public class DataCenterListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate {
private static Logger logger = LoggerFactory.getLogger(DataCenterListener.class); private static Logger logger = LoggerFactory.getLogger(DataCenterListener.class);
private static String deptName = "青岛市大数据发展管理局"; @Value("${big_date.name}")
private static String roleName = "部门审批人"; private static String bigDateDeptName;
@Value("${big_date.assignee_role_name}")
private static String roleName;
@Autowired @Autowired
private SysRoleService sysRoleService; private SysRoleService sysRoleService;
@ -49,16 +52,17 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
@Override @Override
public void notify(DelegateTask delegateTask) { public void notify(DelegateTask delegateTask) {
SysDeptDTO deptDTO = sysDeptService.getByName(deptName); SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
logger.info("deptDTOId:" + deptDTO.getId()); logger.info("deptDTOId:" + deptDTO.getId());
SysRoleDTO roleDTO = sysRoleService.getByName(roleName); SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
logger.info("roleDTOId:" + roleDTO.getId()); logger.info("roleDTOId:" + roleDTO.getId());
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId()); SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId());
delegateTask.setAssignee("1513432847327199233");
if (userDTO != null) { if (userDTO != null) {
logger.info("审批人id:" + userDTO.getId()); logger.info("审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString()); taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
} else { } else {
delegateTask.setAssignee("1513432847327199233");
logger.info("未查到该部门对应 " + roleName); logger.info("未查到该部门对应 " + roleName);
} }
} }

View File

@ -56,6 +56,11 @@ resource:
root_url: 15.2.21.238 root_url: 15.2.21.238
path: /home/yth/files/ path: /home/yth/files/
devModelFilePath: /home/yth/files/resource devModelFilePath: /home/yth/files/resource
# 大数据部门相关配置
big_date:
name: 青岛市大数据发展管理局
assignee_role_name: 部门审批人
##多数据源的配置需要引用renren-dynamic-datasource ##多数据源的配置需要引用renren-dynamic-datasource
#dynamic: #dynamic:

View File

@ -38,4 +38,8 @@ spring:
resource: resource:
root_url: 15.2.21.238 root_url: 15.2.21.238
path: /data/services/nengli/files/ path: /data/services/nengli/files/
devModelFilePath: /data/services/nengli/files/resource devModelFilePath: /data/services/nengli/files/resource
# 大数据部门相关配置
big_date:
name: 青岛市大数据发展管理局
assignee_role_name: 部门审批人

View File

@ -39,4 +39,8 @@ spring:
resource: resource:
root_url: 15.2.21.238 root_url: 15.2.21.238
path: /home/yth/files/ path: /home/yth/files/
devModelFilePath: /home/yth/files/resource devModelFilePath: /home/yth/files/resource
# 大数据部门相关配置
big_date:
name: 青岛市大数据发展管理局
assignee_role_name: 部门审批人