@@ -1,5 +1,6 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.dto.InspectionDto; | |||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | |||
@@ -80,12 +81,12 @@ public class InspectionController { | |||
/** | |||
* 根据机场id查询任务 | |||
* @param airportId | |||
* @param dto | |||
* @return | |||
*/ | |||
@GetMapping("/listByAirportId/{airportId}") | |||
public JsonResult getListByAirportId(@PathVariable("airportId") Integer airportId){ | |||
return iInspectionService.getListByAirportId(airportId); | |||
public JsonResult getListByAirportId(InspectionDto dto){ | |||
return iInspectionService.getListByAirportId(dto); | |||
} | |||
/** |
@@ -52,7 +52,7 @@ public class RoadInformationController { | |||
* 根据登录人角色获取该部门下公路信息列表 | |||
* @return | |||
*/ | |||
@GetMapping("/list/by/dept/UserType") | |||
@GetMapping("/list/by/dept/userType") | |||
public JsonResult getListByUserType(){ | |||
return roadInformationService.getListByUserType(); | |||
} |
@@ -0,0 +1,21 @@ | |||
package com.tuoheng.admin.dto; | |||
import lombok.Data; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
@Data | |||
public class InspectionDto { | |||
/** | |||
* 机场id | |||
*/ | |||
private Integer airportId; | |||
/** | |||
* 用户id | |||
*/ | |||
private String UserId; | |||
} |
@@ -0,0 +1,47 @@ | |||
package com.tuoheng.admin.enums.code.inspection; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
public enum QueryInspectionListServiceEnum { | |||
QUERY_IS_FAILED(1230600, "获取数据失败"), | |||
USER_ID_IS_NULL(1230601, "用户id为空"), | |||
USER_IS_NOT_EXIST(1230602, "用户不存在"), | |||
DEPT_ID_IS_NULL(1230601, "用户id为空"), | |||
DEPT_IS_NOT_EXIST(1230603, "部门不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
QueryInspectionListServiceEnum | |||
(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -1,5 +1,6 @@ | |||
package com.tuoheng.admin.service.inspection; | |||
import com.tuoheng.admin.dto.InspectionDto; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||
@@ -71,7 +72,7 @@ public interface IInspectionService { | |||
*/ | |||
JsonResult deleteById(String id); | |||
JsonResult getListByAirportId(Integer airportId); | |||
JsonResult getListByAirportId(InspectionDto dto); | |||
JsonResult getVideoById(String id); | |||
@@ -1,6 +1,7 @@ | |||
package com.tuoheng.admin.service.inspection; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.dto.InspectionDto; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
@@ -141,10 +142,15 @@ public class InspectionServiceImpl implements IInspectionService { | |||
} | |||
@Override | |||
public JsonResult getListByAirportId(Integer airportId) { | |||
return queryInspectionListService.getListByAirportId(airportId); | |||
public JsonResult getListByAirportId(InspectionDto dto) { | |||
return queryInspectionListService.getListByAirportId(dto); | |||
} | |||
// @Override | |||
// public JsonResult getListByAirportId(InspectionDto dto) { | |||
// return queryInspectionListService.getListByAirportId(airportId); | |||
// } | |||
@Override | |||
public JsonResult getVideoById(String id) { | |||
return queryVideoService.getVideoById(id); |
@@ -1,10 +1,17 @@ | |||
package com.tuoheng.admin.service.inspection.query; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.dto.InspectionDto; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.enums.code.inspection.QueryInspectionListServiceEnum; | |||
import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@@ -25,19 +32,27 @@ public class QueryInspectionListService { | |||
@Autowired | |||
private InspectionFileMapper inspectionFileMapper; | |||
public JsonResult getListByAirportId(Integer airportId) { | |||
//校验 | |||
if(null == airportId){ | |||
return JsonResult.success("巡检机场id不存在"); | |||
@Autowired | |||
private UserMapper userMapper; | |||
public JsonResult getListByAirportId(InspectionDto dto) { | |||
if(null == dto.getAirportId() && StringUtils.isEmpty(dto.getUserId())){ | |||
return JsonResult.error(QueryInspectionListServiceEnum.QUERY_IS_FAILED.getCode(),QueryInspectionListServiceEnum.QUERY_IS_FAILED.getMsg()); | |||
} | |||
List<Inspection> inspections = inspectionMapper.selectList(Wrappers.<Inspection>lambdaQuery() | |||
.eq(Inspection::getMark, 1) | |||
.eq(Inspection::getTenantId, "0") | |||
.eq(Inspection::getAirportId, airportId) | |||
.in(Inspection::getStatus, 15, 10)); | |||
if(null == inspections){ | |||
return JsonResult.error(); | |||
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() | |||
.eq(User::getMark, 1).eq(User::getId, dto.getUserId())); | |||
if(ObjectUtil.isNull(user)){ | |||
return JsonResult.error(QueryInspectionListServiceEnum.USER_IS_NOT_EXIST.getCode(),QueryInspectionListServiceEnum.USER_IS_NOT_EXIST.getMsg()); | |||
} | |||
String deptId = user.getDeptId(); | |||
if(StringUtils.isEmpty(deptId)){ | |||
return JsonResult.error(QueryInspectionListServiceEnum.DEPT_ID_IS_NULL.getCode(),QueryInspectionListServiceEnum.DEPT_ID_IS_NULL.getMsg()); | |||
} | |||
List<Inspection> inspections = inspectionMapper.selectList(new LambdaQueryWrapper<Inspection>() | |||
.eq(Inspection::getMark, 1) | |||
.eq(Inspection::getDeptId, deptId) | |||
.eq(Inspection::getAirportId, dto.getAirportId()) | |||
.in(Inspection::getStatus, 10, 15)); | |||
return JsonResult.success(inspections); | |||
} |