release
vers master
il y a 11 mois
@@ -99,9 +99,9 @@ public class QueryInspectionPageListService { | |||
public JsonResult getPageList(QueryInspectionPageListRequest request) { | |||
// log.info("进入查询巡检任务分页列表业务"); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
User user = CurrentUserUtil.getUserInfo(); | |||
String userId = user.getId(); | |||
String tenantId = user.getTenantId(); | |||
request.setTenantId(tenantId); | |||
JsonResult result = this.check(tenantId, request); | |||
@@ -109,12 +109,6 @@ public class QueryInspectionPageListService { | |||
log.info("进入查询巡检任务分页列表业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||
.eq(User::getTenantId, tenantId) | |||
.eq(User::getId, userId) | |||
.eq(User::getMark, 1)); | |||
Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>() | |||
.eq(Dept::getTenantId, tenantId) | |||
.eq(Dept::getId, user.getDeptId()) |
@@ -62,32 +62,7 @@ public class EditHandle implements GenerateInspectionFieldHander { | |||
} | |||
return; | |||
} | |||
if (user.getId().equals(inspectionVo.getCreateUser())) { | |||
// 自己创建的任务 | |||
inspectionVo.setEdit(true); | |||
} else { | |||
// 非本人创建,判断该用户是不是该部门管理员 | |||
// 本部门主管编辑本部门任务 | |||
// 查询部门管理员,若是部门管理员可修改,非部门管理员不能修改 | |||
User userTmp = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||
.eq(User::getDeptId, user.getDeptId()) | |||
.eq(User::getDataPermission, DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode()) | |||
.eq(User::getMark, MarkEnum.VALID.getCode())); | |||
if (ObjectUtil.isNull(userTmp)) { | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
return; | |||
} | |||
} | |||
if (!user.getId().equals(userTmp.getId())) { | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
return; | |||
} | |||
} | |||
inspectionVo.setEdit(true); | |||
} | |||
inspectionVo.setEdit(true); | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
return; |
@@ -44,23 +44,7 @@ public class ExecuteHandle implements GenerateInspectionFieldHander { | |||
} | |||
return; | |||
} | |||
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) { | |||
// 超级管理员不能执行任务操作 | |||
inspectionVo.setExecute(false); | |||
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) { | |||
// 管理员可对本部门的任务执行此操作 | |||
if (user.getDeptId().equals(inspectionVo.getDeptId())) { | |||
if (1 == inspectionVo.getExecutionStatus()) { | |||
inspectionVo.setExecute(true); | |||
} | |||
} | |||
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) { | |||
// 普通用户可对自己创建的任务执行此操作 | |||
if (user.getId().equals(inspectionVo.getCreateUser())) { | |||
inspectionVo.setExecute(true); | |||
} | |||
} | |||
inspectionVo.setExecute(true); | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
} |
@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.constant.SystemConstant; | |||
import com.tuoheng.admin.entity.FlightData; | |||
import com.tuoheng.admin.entity.FlightDataHl; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.Report; | |||
import com.tuoheng.admin.enums.MarkEnum; | |||
@@ -40,9 +39,6 @@ public class UpdateWaittStatusService { | |||
@Autowired | |||
private FlightDataMapper flightDataMapper; | |||
@Autowired | |||
private FlightDataHlMapper flightDataHlMapper; | |||
@Autowired | |||
private ReportMapper reportMapper; | |||
@@ -81,11 +77,11 @@ public class UpdateWaittStatusService { | |||
log.info("坐标数据,flightDataCount:{}", flightDataCount); | |||
if (flightDataCount > 0) { | |||
int index = (int) Math.ceil((double) flightDataCount / 2); | |||
FlightDataHl flightData = flightDataHlMapper.selectOne(new LambdaQueryWrapper<FlightDataHl>() | |||
.eq(FlightDataHl::getInspectionId, inspection.getId()) | |||
.eq(FlightDataHl::getTenantId, inspection.getTenantId()) | |||
.eq(FlightDataHl::getMark, MarkEnum.VALID.getCode()) | |||
.orderByDesc(FlightDataHl::getTime) | |||
FlightData flightData = flightDataMapper.selectOne(new LambdaQueryWrapper<FlightData>() | |||
.eq(FlightData::getInspectionId, inspection.getId()) | |||
.eq(FlightData::getTenantId, inspection.getTenantId()) | |||
.eq(FlightData::getMark, MarkEnum.VALID.getCode()) | |||
.orderByDesc(FlightData::getTimestamp) | |||
.last("limit " + index + ",1")); | |||
if (ObjectUtil.isNotNull(flightData)) { | |||
inspectionUpdate.setFlyHeight(flightData.getAlt()); |
@@ -62,7 +62,6 @@ public class QueryReportPageListService { | |||
// log.info("进入查询报告分页列表业务"); | |||
User user = CurrentUserUtil.getUserInfo(); | |||
String tenantId = user.getTenantId(); | |||
request.setTenantId(tenantId); | |||
JsonResult result = this.check(tenantId, request); | |||
if (0 != result.getCode()) { | |||
@@ -70,42 +69,32 @@ public class QueryReportPageListService { | |||
return result; | |||
} | |||
// 设置分页参数 | |||
IPage<Report> page = new Page<>(request.getPage(), request.getLimit()); | |||
// 用户只能查看自己生成的报告 或者是当前租户下自动生成的报告 | |||
//request.setCreateUser(userId); | |||
// 查询结果 | |||
IPage<Report> pageData = reportMapper.selectPageList(page, request); | |||
if (null == pageData || pageData.getTotal() == 0) { | |||
log.info("获取任务分页列表为空"); | |||
return JsonResult.success(pageData); | |||
} | |||
List<Report> reportList = pageData.getRecords(); | |||
List<Report> reportsData = new ArrayList<>(); | |||
List<String> deptIdList = new ArrayList<>(); | |||
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) { | |||
reportsData = this.getAllList(reportList); | |||
// 查询该租户下所有部门的工单 | |||
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) { | |||
reportsData = this.getListByDepts(reportList, user); | |||
deptIdList = deptMapper.selectAllChildListById(user.getDeptId()); | |||
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) { | |||
reportsData = this.getListByDept(reportList, user); | |||
} | |||
if(CollectionUtil.isEmpty(reportsData) || reportsData.size() == 0){ | |||
return JsonResult.success("当前用户对应数据权限下查询报告数据为空"); | |||
deptIdList.add(user.getDeptId()); | |||
} | |||
IPage<Report> reportIPage = pageData.setRecords(reportsData); | |||
request.setTenantId(tenantId); | |||
request.setDeptIdList(deptIdList); | |||
// 设置分页参数 | |||
IPage<Report> page = new Page<>(request.getPage(), request.getLimit()); | |||
// 查询结果 | |||
IPage<Report> pageData = reportMapper.selectPageList(page, request); | |||
// 构造返回结果对象 | |||
List<ReportPageListVo> reportPageListVoList = this.buildReportPageListVoList(reportsData); | |||
List<ReportPageListVo> reportPageListVoList = this.buildReportPageListVoList(pageData.getRecords()); | |||
// 重写返回结果对象 | |||
IPage<ReportPageListVo> reportVoPageData = new Page<>(); | |||
reportVoPageData.setPages(reportIPage.getPages()); | |||
reportVoPageData.setCurrent(reportIPage.getCurrent()); | |||
reportVoPageData.setSize(reportIPage.getSize()); | |||
reportVoPageData.setTotal(reportIPage.getTotal()); | |||
reportVoPageData.setPages(pageData.getPages()); | |||
reportVoPageData.setCurrent(pageData.getCurrent()); | |||
reportVoPageData.setSize(pageData.getSize()); | |||
reportVoPageData.setTotal(pageData.getTotal()); | |||
reportVoPageData.setRecords(reportPageListVoList); | |||
return JsonResult.success(reportVoPageData); |
@@ -76,7 +76,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
<if test="request.inspectionCode!= null and request.inspectionCode != ''"> and inspection_code like concat('%', #{request.inspectionCode}, '%') </if> | |||
<if test="request.airportId != null and request.airportId != 0"> and airport_id = #{request.airportId} </if> | |||
<if test="request.type != null and request.type != 0"> and type = #{request.type} </if> | |||
<if test="request.createUser != null and request.createUser != ''"> and create_user = #{request.createUser} </if> | |||
<if test="request.deptIdList != null and request.deptIdList.size() > 0"> | |||
and dept_id in | |||
<foreach item="deptId" collection="request.deptIdList" open="(" separator="," close=")"> | |||
#{deptId} | |||
</foreach> | |||
</if> | |||
</where> | |||
order by create_time desc | |||
</select> |