移除报警联系人单独操作的相关文件
新增用户,用户关联权限,权限等相关实体类,以及查询用户及用户关联权限方法 联系人组查询返回用户相关信息
This commit is contained in:
parent
5669c49696
commit
5e815059b8
|
@ -1,44 +0,0 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.AlarmContactGroup;
|
||||
import org.jeecg.modules.entity.AlarmContactGroupMember;
|
||||
import org.jeecg.modules.service.IAlarmContactGroupMemberService;
|
||||
import org.jeecg.modules.service.IAlarmContactGroupService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("alarmContactGroupMember")
|
||||
public class AlarmContactGroupMemberController {
|
||||
|
||||
@Autowired
|
||||
private IAlarmContactGroupMemberService alarmContactGroupMemberService;
|
||||
|
||||
@GetMapping("findPage")
|
||||
public Result findPage(QueryRequest queryRequest, AlarmContactGroupMember alarmContactGroupMember){
|
||||
return alarmContactGroupMemberService.findPage(queryRequest, alarmContactGroupMember);
|
||||
}
|
||||
|
||||
@GetMapping("findInfo")
|
||||
public Result findPage(String id){
|
||||
return alarmContactGroupMemberService.findInfo(id);
|
||||
}
|
||||
|
||||
@PostMapping("create")
|
||||
public Result findPage(@RequestBody AlarmContactGroupMember alarmContactGroupMember){
|
||||
return alarmContactGroupMemberService.create(alarmContactGroupMember);
|
||||
}
|
||||
|
||||
@PutMapping("update")
|
||||
public Result update(@RequestBody AlarmContactGroupMember alarmContactGroupMember){
|
||||
return alarmContactGroupMemberService.update(alarmContactGroupMember);
|
||||
}
|
||||
|
||||
@DeleteMapping("deleteById")
|
||||
public Result deleteById(String id){
|
||||
return alarmContactGroupMemberService.deleteById(id);
|
||||
}
|
||||
|
||||
}
|
|
@ -8,6 +8,7 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@TableName(value = "alarm_contact_group")
|
||||
|
@ -34,4 +35,9 @@ public class AlarmContactGroup implements Serializable {
|
|||
@TableField(value = "update_by")
|
||||
private String updateBy;
|
||||
|
||||
@TableField(exist = false)
|
||||
List<String> userIds;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AlarmContactGroupVo implements Serializable {
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
private Date createTime;
|
||||
|
||||
List<SysUser> users;
|
||||
|
||||
Integer personNumber;
|
||||
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色表
|
||||
* </p>
|
||||
*
|
||||
* @Author scott
|
||||
* @since 2018-12-19
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class SysRole implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@Excel(name="角色名",width=15)
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
@Excel(name="角色编码",width=15)
|
||||
private String roleCode;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Excel(name="描述",width=60)
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/**租户ID*/
|
||||
private Integer tenantId;
|
||||
}
|
|
@ -0,0 +1,208 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表
|
||||
* </p>
|
||||
*
|
||||
* @Author scott
|
||||
* @since 2018-12-20
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class SysUser implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 登录账号
|
||||
*/
|
||||
@Excel(name = "登录账号", width = 15)
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
@Excel(name = "真实姓名", width = 15)
|
||||
private String realname;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* md5密码盐
|
||||
*/
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String salt;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@Excel(name = "头像", width = 15,type = 2)
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
@Excel(name = "生日", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date birthday;
|
||||
|
||||
/**
|
||||
* 性别(1:男 2:女)
|
||||
*/
|
||||
@Excel(name = "性别", width = 15,dicCode="sex")
|
||||
@Dict(dicCode = "sex")
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 电子邮件
|
||||
*/
|
||||
@Excel(name = "电子邮件", width = 15)
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 电话
|
||||
*/
|
||||
@Excel(name = "电话", width = 15)
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 登录选择部门编码
|
||||
*/
|
||||
private String orgCode;
|
||||
/**
|
||||
* 登录选择租户ID
|
||||
*/
|
||||
private Integer loginTenantId;
|
||||
|
||||
/**部门名称*/
|
||||
private transient String orgCodeTxt;
|
||||
|
||||
/**
|
||||
* 状态(1:正常 2:冻结 )
|
||||
*/
|
||||
@Excel(name = "状态", width = 15,dicCode="user_status")
|
||||
@Dict(dicCode = "user_status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 删除状态(0,正常,1已删除)
|
||||
*/
|
||||
@Excel(name = "删除状态", width = 15,dicCode="del_flag")
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 工号,唯一键
|
||||
*/
|
||||
@Excel(name = "工号", width = 15)
|
||||
private String workNo;
|
||||
|
||||
/**
|
||||
* 职务,关联职务表
|
||||
*/
|
||||
@Excel(name = "职务", width = 15)
|
||||
@Dict(dictTable ="sys_position",dicText = "name",dicCode = "code")
|
||||
private String post;
|
||||
|
||||
/**
|
||||
* 座机号
|
||||
*/
|
||||
@Excel(name = "座机号", width = 15)
|
||||
private String telephone;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 同步工作流引擎1同步0不同步
|
||||
*/
|
||||
private Integer activitiSync;
|
||||
|
||||
/**
|
||||
* 身份(0 普通成员 1 上级)
|
||||
*/
|
||||
@Excel(name="(1普通成员 2上级)",width = 15)
|
||||
private Integer userIdentity;
|
||||
|
||||
/**
|
||||
* 负责部门
|
||||
*/
|
||||
@Excel(name="负责部门",width = 15,dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
|
||||
@Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
|
||||
private String departIds;
|
||||
|
||||
/**
|
||||
* 多租户ids临时用,不持久化数据库(数据库字段不存在)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String relTenantIds;
|
||||
|
||||
/**设备id uniapp推送用*/
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 登录首页地址
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String homePath;
|
||||
|
||||
/**
|
||||
* 职位名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String postText;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<SysRole> roles;
|
||||
|
||||
/**
|
||||
* 流程状态
|
||||
*/
|
||||
private String bpmStatus;
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户角色表
|
||||
* </p>
|
||||
*
|
||||
* @Author scott
|
||||
* @since 2018-12-21
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class SysUserRole implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
private String roleId;
|
||||
|
||||
/**租户ID*/
|
||||
private Integer tenantId;
|
||||
|
||||
public SysUserRole() {
|
||||
}
|
||||
|
||||
public SysUserRole(String userId, String roleId) {
|
||||
this.userId = userId;
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.entity.AlarmContactGroupVo;
|
||||
|
||||
public interface AlarmContactGroupVoMapper extends BaseMapper<AlarmContactGroupVo> {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.entity.SysRole;
|
||||
|
||||
public interface SysRoleMapper extends BaseMapper<SysRole> {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.entity.SysUser;
|
||||
|
||||
public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.entity.SysUserRole;
|
||||
|
||||
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.AlarmContactGroupMember;
|
||||
|
||||
public interface IAlarmContactGroupMemberService extends IService<AlarmContactGroupMember> {
|
||||
|
||||
Result findPage(QueryRequest queryRequest, AlarmContactGroupMember alarmContactGroupMember);
|
||||
|
||||
Result findInfo(String id);
|
||||
|
||||
Result create(AlarmContactGroupMember alarmContactGroupMember);
|
||||
|
||||
Result update(AlarmContactGroupMember alarmContactGroupMember);
|
||||
|
||||
Result deleteById(String id);
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package org.jeecg.modules.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.entity.SysUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ISysUserService extends IService<SysUser> {
|
||||
|
||||
List<SysUser> findUserList();
|
||||
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.AlarmContactGroupMember;
|
||||
import org.jeecg.modules.mapper.AlarmContactGroupMemberMapper;
|
||||
import org.jeecg.modules.service.IAlarmContactGroupMemberService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("alarmContactGroupMemberService")
|
||||
public class AlarmContactGroupMemberServiceImpl extends ServiceImpl<AlarmContactGroupMemberMapper, AlarmContactGroupMember> implements IAlarmContactGroupMemberService {
|
||||
|
||||
@Override
|
||||
public Result findPage(QueryRequest queryRequest, AlarmContactGroupMember alarmContactGroupMember) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result findInfo(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result create(AlarmContactGroupMember alarmContactGroupMember) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result update(AlarmContactGroupMember alarmContactGroupMember) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result deleteById(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
@ -9,31 +10,73 @@ import org.jeecg.common.api.vo.Result;
|
|||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.modules.entity.AlarmContactGroup;
|
||||
import org.jeecg.modules.entity.AlarmContactGroupMember;
|
||||
import org.jeecg.modules.entity.AlarmContactGroupVo;
|
||||
import org.jeecg.modules.entity.SysUser;
|
||||
import org.jeecg.modules.mapper.AlarmContactGroupMapper;
|
||||
import org.jeecg.modules.mapper.AlarmContactGroupMemberMapper;
|
||||
import org.jeecg.modules.mapper.AlarmContactGroupVoMapper;
|
||||
import org.jeecg.modules.service.IAlarmContactGroupService;
|
||||
import org.jeecg.modules.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service("alarmContactGroupService")
|
||||
public class AlarmContactGroupServiceImpl extends ServiceImpl<AlarmContactGroupMapper, AlarmContactGroup> implements IAlarmContactGroupService {
|
||||
|
||||
@Autowired
|
||||
private AlarmContactGroupVoMapper alarmContactGroupVoMapper;
|
||||
@Autowired
|
||||
private AlarmContactGroupMemberMapper alarmContactGroupMemberMapper;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@Override
|
||||
public Result findPage(QueryRequest queryRequest, AlarmContactGroup alarmContactGroup) {
|
||||
Result result = new Result();
|
||||
Page<AlarmContactGroup> page = new Page<>();
|
||||
LambdaQueryWrapper<AlarmContactGroup> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Page<AlarmContactGroup> alarmContactGroupPage = this.baseMapper.selectPage(page, queryWrapper);
|
||||
//获取用户信息
|
||||
List<SysUser> userList = sysUserService.findUserList();
|
||||
Page<AlarmContactGroupVo> page = new Page<>();
|
||||
LambdaQueryWrapper<AlarmContactGroupVo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Page<AlarmContactGroupVo> alarmContactGroupVoPage = alarmContactGroupVoMapper.selectPage(page, queryWrapper);
|
||||
LambdaQueryWrapper<AlarmContactGroupMember> contactGroupMemberQueryWrapper = new LambdaQueryWrapper<>();
|
||||
List<AlarmContactGroupMember> alarmContactGroupMembers = alarmContactGroupMemberMapper.selectList(contactGroupMemberQueryWrapper);
|
||||
alarmContactGroupVoPage.getRecords().forEach(item->{
|
||||
List<SysUser> sysUsers = new LinkedList<>();
|
||||
//联系人组对应联系人信息不为空
|
||||
if (CollectionUtils.isNotEmpty(alarmContactGroupMembers)){
|
||||
//根据联系人组id过滤出对应的联系人信息集合
|
||||
List<AlarmContactGroupMember> contactGroupMembers = alarmContactGroupMembers.stream().filter(member-> member.getGroupId().equals(item.getId())).collect(Collectors.toList());
|
||||
//过滤出对应的用户id集合
|
||||
List<String> userIds = contactGroupMembers.stream().map(AlarmContactGroupMember::getUserId).collect(Collectors.toList());
|
||||
//根据用户id获得对应的用户信息
|
||||
if (CollectionUtils.isNotEmpty(userList)){
|
||||
for (SysUser user:userList) {
|
||||
if (userIds.contains(user.getId())){
|
||||
sysUsers.add(user);
|
||||
}
|
||||
}
|
||||
item.setUsers(sysUsers);
|
||||
}
|
||||
}
|
||||
});
|
||||
result.setSuccess(true);
|
||||
result.setResult(alarmContactGroupPage);
|
||||
result.setResult(alarmContactGroupVoPage);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result findInfo(String id) {
|
||||
Result result = new Result();
|
||||
List<SysUser> sysUsers = new LinkedList<>();
|
||||
//根据id查询对应的数据 判断数据是否在数据库中
|
||||
LambdaQueryWrapper<AlarmContactGroup> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AlarmContactGroup::getId, id);
|
||||
AlarmContactGroup alarmContactGroup = this.baseMapper.selectOne(queryWrapper);
|
||||
|
@ -41,6 +84,14 @@ public class AlarmContactGroupServiceImpl extends ServiceImpl<AlarmContactGroupM
|
|||
result.error500("查询数据失败,对应数据不存在");
|
||||
return result;
|
||||
}
|
||||
//通过联系人组id查询出对应的联系人信息
|
||||
LambdaQueryWrapper<AlarmContactGroupMember> contactGroupMemberQueryWrapper = new LambdaQueryWrapper<>();
|
||||
contactGroupMemberQueryWrapper.eq(AlarmContactGroupMember::getGroupId, alarmContactGroup.getId());
|
||||
List<AlarmContactGroupMember> contactGroupMembers = alarmContactGroupMemberMapper.selectList(contactGroupMemberQueryWrapper);
|
||||
if (CollectionUtils.isNotEmpty(contactGroupMembers)){
|
||||
List<String> userIds = contactGroupMembers.stream().map(AlarmContactGroupMember::getUserId).collect(Collectors.toList());
|
||||
alarmContactGroup.setUserIds(userIds);
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(alarmContactGroup);
|
||||
return result;
|
||||
|
@ -57,6 +108,17 @@ public class AlarmContactGroupServiceImpl extends ServiceImpl<AlarmContactGroupM
|
|||
alarmContactGroup.setId(id.toString());
|
||||
alarmContactGroup.setCreateTime(new Date());
|
||||
alarmContactGroup.setCreateBy(username);
|
||||
if (CollectionUtils.isNotEmpty(alarmContactGroup.getUserIds())){
|
||||
List<String> userIds = alarmContactGroup.getUserIds();
|
||||
for (String userId:userIds) {
|
||||
Long memberId = IdWorker.getId();
|
||||
AlarmContactGroupMember alarmContactGroupMember = new AlarmContactGroupMember();
|
||||
alarmContactGroupMember.setId(memberId.toString());
|
||||
alarmContactGroupMember.setGroupId(alarmContactGroup.getId());
|
||||
alarmContactGroupMember.setUserId(userId);
|
||||
alarmContactGroupMemberMapper.insert(alarmContactGroupMember);
|
||||
}
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.success("新增成功");
|
||||
return result;
|
||||
|
@ -72,6 +134,20 @@ public class AlarmContactGroupServiceImpl extends ServiceImpl<AlarmContactGroupM
|
|||
result.error500("对应数据不存在");
|
||||
return result;
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(alarmContactGroup.getUserIds())){
|
||||
LambdaQueryWrapper<AlarmContactGroupMember> contactGroupMemberQueryWrapper = new LambdaQueryWrapper<>();
|
||||
contactGroupMemberQueryWrapper.eq(AlarmContactGroupMember::getGroupId, alarmContactGroup.getId());
|
||||
alarmContactGroupMemberMapper.delete(contactGroupMemberQueryWrapper);
|
||||
List<String> userIds = alarmContactGroup.getUserIds();
|
||||
for (String userId:userIds) {
|
||||
Long memberId = IdWorker.getId();
|
||||
AlarmContactGroupMember alarmContactGroupMember = new AlarmContactGroupMember();
|
||||
alarmContactGroupMember.setId(memberId.toString());
|
||||
alarmContactGroupMember.setGroupId(alarmContactGroup.getId());
|
||||
alarmContactGroupMember.setUserId(userId);
|
||||
alarmContactGroupMemberMapper.insert(alarmContactGroupMember);
|
||||
}
|
||||
}
|
||||
this.baseMapper.updateById(alarmContactGroup);
|
||||
result.setSuccess(true);
|
||||
result.success("修改成功");
|
||||
|
@ -81,6 +157,11 @@ public class AlarmContactGroupServiceImpl extends ServiceImpl<AlarmContactGroupM
|
|||
@Override
|
||||
public Result deleteById(String id) {
|
||||
Result result = new Result();
|
||||
//根据联系人组id删除关联的联系人信息
|
||||
LambdaQueryWrapper<AlarmContactGroupMember> contactGroupMemberQueryWrapper = new LambdaQueryWrapper<>();
|
||||
contactGroupMemberQueryWrapper.eq(AlarmContactGroupMember::getGroupId, id);
|
||||
alarmContactGroupMemberMapper.delete(contactGroupMemberQueryWrapper);
|
||||
//删除联系人组信息
|
||||
this.baseMapper.deleteById(id);
|
||||
result.setSuccess(true);
|
||||
result.success("删除成功");
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.modules.entity.SysRole;
|
||||
import org.jeecg.modules.entity.SysUser;
|
||||
import org.jeecg.modules.entity.SysUserRole;
|
||||
import org.jeecg.modules.mapper.SysRoleMapper;
|
||||
import org.jeecg.modules.mapper.SysUserMapper;
|
||||
import org.jeecg.modules.mapper.SysUserRoleMapper;
|
||||
import org.jeecg.modules.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service("sysUserService")
|
||||
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {
|
||||
|
||||
@Autowired
|
||||
private SysUserRoleMapper sysUserRoleMapper;
|
||||
@Autowired
|
||||
private SysRoleMapper sysRoleMapper;
|
||||
|
||||
@Override
|
||||
public List<SysUser> findUserList() {
|
||||
LambdaQueryWrapper<SysUser> userQueryWrapper = new LambdaQueryWrapper<>();
|
||||
List<SysUser> sysUsers = this.baseMapper.selectList(userQueryWrapper);
|
||||
LambdaQueryWrapper<SysUserRole> userRoleQueryWrapper = new LambdaQueryWrapper<>();
|
||||
List<SysUserRole> sysUserRoles = sysUserRoleMapper.selectList(userRoleQueryWrapper);
|
||||
LambdaQueryWrapper<SysRole> roleQueryWrapper = new LambdaQueryWrapper<>();
|
||||
List<SysRole> sysRoles = sysRoleMapper.selectList(roleQueryWrapper);
|
||||
List<SysRole> roles = new LinkedList<>();
|
||||
//遍历所有用户信息
|
||||
if (CollectionUtils.isNotEmpty(sysUsers)){
|
||||
for (SysUser sysUser:sysUsers) {
|
||||
if (CollectionUtils.isNotEmpty(sysUserRoles)){
|
||||
//获取各用户匹配的权限集合
|
||||
List<SysUserRole> userRoles = sysUserRoles.stream().filter(item -> item.getUserId().equals(sysUser.getId())).collect(Collectors.toList());
|
||||
List<String> roleIds = userRoles.stream().map(SysUserRole::getRoleId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(sysRoles)){
|
||||
for (SysRole role:sysRoles) {
|
||||
if (roleIds.contains(role.getId())){
|
||||
roles.add(role);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sysUser.setRoles(roles);
|
||||
}
|
||||
}
|
||||
return sysUsers;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user