Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -26,44 +26,45 @@ import java.util.List;
|
||||
*/
|
||||
public class FlowUnitPartySecretaryHandler implements AssignmentHandler {
|
||||
|
||||
@Override
|
||||
public List<String> assign(TaskModel model, Execution execution) {
|
||||
String unitId = SecurityUtil.getUnitId();
|
||||
@Override
|
||||
public List<String> assign(TaskModel model, Execution execution) {
|
||||
String unitId = SecurityUtil.getUnitId();
|
||||
|
||||
SysRoleService sysRoleService = ServiceContext.find(SysRoleService.class);
|
||||
Sys_role role = sysRoleService.getByCode(RoleConstant.UNIT_PARTY_SECRETARY);
|
||||
SysRoleService sysRoleService = ServiceContext.find(SysRoleService.class);
|
||||
Sys_role role = sysRoleService.getByCode(RoleConstant.UNIT_PARTY_SECRETARY);
|
||||
|
||||
View_user user = ServiceContext.find(Dao.class).fetch(View_user.class, Cnd.where(View_user::getId, "=", SecurityUtil.getUserId()));
|
||||
List<Sys_user_role> roles;
|
||||
if(user.getUnionName().contains("行政")){
|
||||
List<Sys_unit> unitList = ServiceContext.find(Dao.class).query(Sys_unit.class, Cnd.where(Sys_unit::getUnionId, "=", user.getUnionId()));
|
||||
List<String> unitIds = unitList.stream().map(Sys_unit::getId).toList();
|
||||
roles = ServiceContext.find(Dao.class).query(
|
||||
Sys_user_role.class,
|
||||
Cnd.where(Sys_user_role::getRoleId, "=", role.getId())
|
||||
.and(Sys_user_role::getUnitId, "in", unitIds)
|
||||
);
|
||||
}else{
|
||||
roles = ServiceContext.find(Dao.class).query(
|
||||
Sys_user_role.class,
|
||||
Cnd.where(Sys_user_role::getRoleId, "=", role.getId())
|
||||
.and(Sys_user_role::getUnitId, "=", unitId)
|
||||
);
|
||||
}
|
||||
View_user user = ServiceContext.find(Dao.class).fetch(View_user.class, Cnd.where(View_user::getId, "=", SecurityUtil.getUserId()));
|
||||
List<Sys_user_role> roles;
|
||||
|
||||
if (Lang.isEmpty(roles)) {
|
||||
throw new RuntimeException("当前登录用户所在单位未设置单位党委书记,请联系校工会进行设置。");
|
||||
}
|
||||
return roles.stream().map(Sys_user_role::getUserId).toList();
|
||||
}
|
||||
roles = ServiceContext.find(Dao.class).query(
|
||||
Sys_user_role.class,
|
||||
Cnd.where(Sys_user_role::getRoleId, "=", role.getId())
|
||||
.and(Sys_user_role::getUnitId, "=", unitId)
|
||||
);
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "获取当前登录用户所在单位党委书记,若是行政就找出行政分下的党委书记。因为行政只有一个党委书记";
|
||||
}
|
||||
if (Lang.isEmpty(roles)) {
|
||||
List<Sys_unit> unitList = ServiceContext.find(Dao.class).query(Sys_unit.class, Cnd.where(Sys_unit::getUnionId, "=", user.getUnionId()));
|
||||
List<String> unitIds = unitList.stream().map(Sys_unit::getId).toList();
|
||||
roles = ServiceContext.find(Dao.class).query(
|
||||
Sys_user_role.class,
|
||||
Cnd.where(Sys_user_role::getRoleId, "=", role.getId())
|
||||
.and(Sys_user_role::getUnitId, "in", unitIds)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return AssignmentHandler.super.getOrder();
|
||||
}
|
||||
if (Lang.isEmpty(roles)) {
|
||||
throw new RuntimeException("当前登录用户所在单位未设置单位党委书记,请联系校工会进行设置。");
|
||||
}
|
||||
return roles.stream().map(Sys_user_role::getUserId).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "获取当前登录用户所在单位党委书记";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return AssignmentHandler.super.getOrder();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user