|
|
|
|
|
|
|
|
package com.tuoheng.miniprogram.service.impl; |
|
|
package com.tuoheng.miniprogram.service.impl; |
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public JsonResult index(InspectionQuery query) { |
|
|
public JsonResult index(InspectionQuery query) { |
|
|
|
|
|
log.info("获取任务分页列表,query={}", query); |
|
|
if (null == query.getLimit() && null == query.getPage()) { |
|
|
if (null == query.getLimit() && null == query.getPage()) { |
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
} |
|
|
} |
|
|
//登录用户信息 |
|
|
//登录用户信息 |
|
|
User userInfo = CurrentUserUtil.getUserInfo(); |
|
|
|
|
|
String username = userInfo.getUsername(); |
|
|
|
|
|
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() |
|
|
|
|
|
.eq(StringUtils.isNotEmpty(username), User::getUsername, username) |
|
|
|
|
|
.eq(User::getStatus, 1).eq(User::getMark, 1)); |
|
|
|
|
|
if (ObjectUtil.isNull(user)) { |
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
|
User user = CurrentUserUtil.getUserInfo(); |
|
|
|
|
|
Integer type = user.getDataPermission(); |
|
|
|
|
|
if (null == type) { |
|
|
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
} |
|
|
} |
|
|
String tenantId = user.getTenantId(); |
|
|
String tenantId = user.getTenantId(); |
|
|
if (StringUtils.isEmpty(tenantId)) { |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
query.setTenantId(tenantId); |
|
|
query.setTenantId(tenantId); |
|
|
|
|
|
query.setDeptId(user.getDeptId()); |
|
|
query.setType(1); |
|
|
query.setType(1); |
|
|
//查询部门及下级部门列表 |
|
|
|
|
|
List<Dept> list = deptMapper.selectList(Wrappers.<Dept>lambdaQuery() |
|
|
|
|
|
.eq(Dept::getMark, 1)); |
|
|
|
|
|
|
|
|
|
|
|
//初始部门id |
|
|
//初始部门id |
|
|
String deptIdInt = query.getDeptId(); |
|
|
String deptIdInt = query.getDeptId(); |
|
|
|
|
|
|
|
|
//获取当前部门对应的巡检任务 |
|
|
//获取当前部门对应的巡检任务 |
|
|
//获取分页数据 |
|
|
//获取分页数据 |
|
|
IPage<Inspection> page = new Page<>(query.getPage(), query.getLimit()); |
|
|
IPage<Inspection> page = new Page<>(query.getPage(), query.getLimit()); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
query.setStartTimeDate(startTime); |
|
|
query.setStartTimeDate(startTime); |
|
|
query.setEndTimeDate(endTime); |
|
|
query.setEndTimeDate(endTime); |
|
|
Integer type = user.getDataPermission(); |
|
|
|
|
|
if (null == type) { |
|
|
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<InspectionInfoVo> inspectionInfoVoList = new ArrayList<>(); |
|
|
List<InspectionInfoVo> inspectionInfoVoList = new ArrayList<>(); |
|
|
//用户角色判断 1超级管理员 2部门管理员 3普通用户 |
|
|
//用户角色判断 1超级管理员 2部门管理员 3普通用户 |
|
|
if (DataPermissionEnum.ALL.getCode() == type) { |
|
|
if (DataPermissionEnum.ALL.getCode() == type) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pageDataVo.setRecords(inspectionInfoVoList); |
|
|
pageDataVo.setRecords(inspectionInfoVoList); |
|
|
|
|
|
|
|
|
|
|
|
log.info("获取任务分页列表,pageDataVo={}", pageDataVo); |
|
|
|
|
|
|
|
|
return JsonResult.success(pageDataVo); |
|
|
return JsonResult.success(pageDataVo); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 递归获取部门的子集 |
|
|
* 递归获取部门的子集 |
|
|
* |
|
|
* |