diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java index c3dea77..23ecf2d 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java @@ -23,6 +23,7 @@ import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; import java.util.List; @@ -134,6 +135,14 @@ public class PoliceUserController { return AjaxResult.success(iPoliceUserService.listByCurrentDept(name)); } + @NotPower + @GetMapping("/listByCurrentDeptAndDeptPid") + @ApiOperation(value="当前部门人员列表") + public AjaxResult> listByCurrentDeptAndDeptPid(String name,String departId) { + return AjaxResult.success(iPoliceUserService.listByCurrentDeptAndDeptPid(departId,name)); + } + + @NotPower @GetMapping("/listByEmpNo") @ApiOperation(value="当前人员信息") @@ -141,4 +150,13 @@ public class PoliceUserController { return AjaxResult.success(iPoliceUserService.getOneByEmpNo(EmpNo)); } + @NotPower + @GetMapping("/listByCurrentEmpNo") + @ApiOperation(value="当前人员信息") + public AjaxResult> listByCurrentEmpNo(String departId ,String EmpNo) { + + return AjaxResult.success(iPoliceUserService.listByCurrentEmpNo(departId,EmpNo)); + + } + } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/IPoliceUserService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/IPoliceUserService.java index 11561f4..f48cd81 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/IPoliceUserService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/IPoliceUserService.java @@ -164,4 +164,6 @@ public interface IPoliceUserService { List listByCurrentDept(String name); + List listByCurrentDeptAndDeptPid(String departId ,String name); + List listByCurrentEmpNo(String departId ,String EmpNo); } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DutyServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DutyServiceImpl.java index 2fffbe0..d04f120 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DutyServiceImpl.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DutyServiceImpl.java @@ -212,7 +212,7 @@ public class DutyServiceImpl implements IDutyService { .last("limit 1")); Assert.notNull(policeUser, "警员不存在"); model.setPoliceName(policeUser.getName()); - model.setMobile(policeUser.getMobile()); + model.setMobile(createValidate.getMobile()); model.setEmpNo(createValidate.getEmpNo()); DictData dictData = dictDataMapper.selectOne(new QueryWrapper() .select("id,type_id,name,value,remark,sort,status,create_time,update_time") diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java index c3e23cc..bb89c2a 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.biutag.core.AjaxResult; import com.biutag.core.PageResult; import com.biutag.entity.system.*; import com.biutag.enums.RoleEnum; @@ -24,10 +25,7 @@ import com.biutag.lan.validate.system.PoliceUserSearchValidate; import com.biutag.lan.validate.system.PoliceUserUpInfoValidate; import com.biutag.lan.validate.system.PoliceUserUpdateValidate; import com.biutag.lan.vo.system.*; -import com.biutag.mapper.system.MenuMapper; -import com.biutag.mapper.system.PoliceDepartMapper; -import com.biutag.mapper.system.PolicePositionMapper; -import com.biutag.mapper.system.PoliceRoleMapper; +import com.biutag.mapper.system.*; import com.biutag.util.StringUtils; import com.biutag.util.TimeUtils; import com.biutag.util.ToolUtils; @@ -64,9 +62,11 @@ public class PoliceUserServiceImpl implements IPoliceUserService { @Resource IDeptService deptService; + @Resource IPostService iPostService; - + @Resource + DeptMapper deptMapper; /** * 管理员列表 * @@ -538,4 +538,81 @@ public class PoliceUserServiceImpl implements IPoliceUserService { return policeUserMapper.selectList(queryWrapper); } + @Override + public List listByCurrentDeptAndDeptPid(String departId ,String name) { + if(departId==null||departId.equals("")){ + departId = AdminThreadLocal.getDeptId().toString(); + } + Dept dept = deptMapper.selectById(departId); + if(dept.getLevel()==2){ + QueryWrapper DeptQueryWrapper = new QueryWrapper<>(); + DeptQueryWrapper.eq("id",departId).or().eq("pid",departId); + List depts = deptMapper.selectList(DeptQueryWrapper); + List listPoliceVo = new ArrayList(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().like(StringUtils.isNotEmpty(name), PoliceUser::getName, name); + List listPolice = policeUserMapper.selectList(queryWrapper); + for (PoliceUser policeUser : listPolice){ + for (Dept dept_item :depts){ + if (policeUser.getDeptIds().equals(dept_item.getId().toString())){ + PoliceUser vo = new PoliceUser(); + BeanUtils.copyProperties(policeUser, vo); + listPoliceVo.add(vo); + System.out.println(vo); + break; + } + } + + } + System.out.println(listPoliceVo); + return listPoliceVo; + }else if (dept.getLevel()==3){ + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(PoliceUser::getDeptIds, departId) + .like(StringUtils.isNotEmpty(name), PoliceUser::getName, name); + return policeUserMapper.selectList(queryWrapper); + }else{ + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .like(StringUtils.isNotEmpty(name), PoliceUser::getName, name); + return policeUserMapper.selectList(queryWrapper); + } + } + + @Override + public List listByCurrentEmpNo(String departId ,String EmpNo) { + if(departId==null||departId.equals("")){ + departId = AdminThreadLocal.getDeptId().toString(); + } + Dept dept = deptMapper.selectById(departId); + if(dept.getLevel()==2){ + QueryWrapper DeptQueryWrapper = new QueryWrapper<>(); + DeptQueryWrapper.eq("id",departId).or().eq("pid",departId); + List depts = deptMapper.selectList(DeptQueryWrapper); + List listPoliceVo = new ArrayList(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(StringUtils.isNotEmpty(EmpNo), PoliceUser::getEmpNo, EmpNo); + List listPolice = policeUserMapper.selectList(queryWrapper); + for (PoliceUser policeUser : listPolice){ + for (Dept dept_item :depts){ + if (policeUser.getDeptIds().equals(dept_item.getId().toString())){ + PoliceUser vo = new PoliceUser(); + BeanUtils.copyProperties(policeUser, vo); + listPoliceVo.add(vo); + System.out.println(vo); + break; + } + } + + } + System.out.println(listPoliceVo); + return listPoliceVo; + }else if (dept.getLevel()==3){ + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(PoliceUser::getDeptIds, departId) + .eq(StringUtils.isNotEmpty(EmpNo), PoliceUser::getEmpNo, EmpNo); + return policeUserMapper.selectList(queryWrapper); + }else{ + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(StringUtils.isNotEmpty(EmpNo), PoliceUser::getEmpNo, EmpNo); + return policeUserMapper.selectList(queryWrapper); + } + + } + } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/DutyCreateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/DutyCreateValidate.java index 8555f57..34e2140 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/DutyCreateValidate.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/DutyCreateValidate.java @@ -36,7 +36,7 @@ public class DutyCreateValidate implements Serializable { @ApiModelProperty(value = "民警姓名") private String policeName; - @NotNull(message = "手机号参数缺失") + @ApiModelProperty(value = "手机号") private String mobile;