package com.tuoheng.admin.controller; | package com.tuoheng.admin.controller; | ||||
import com.tuoheng.admin.entity.request.airport.PointFlightRequest; | |||||
import com.tuoheng.admin.service.airport.AirportService; | import com.tuoheng.admin.service.airport.AirportService; | ||||
import com.tuoheng.common.utils.JsonResult; | import com.tuoheng.common.utils.JsonResult; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||
import org.springframework.web.bind.annotation.PostMapping; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||
import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||
return airportService.getList(); | return airportService.getList(); | ||||
} | } | ||||
/** | |||||
* 定点飞行 | |||||
*/ | |||||
@PostMapping("/pointFlight") | |||||
public JsonResult pointFlight(PointFlightRequest request) { | |||||
return airportService.pointFlight(request); | |||||
} | |||||
} | } |
package com.tuoheng.admin.entity.request.airport; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import java.io.Serializable; | |||||
/** | |||||
* 查询巡检任务请求实体 | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2023-02-15 | |||||
*/ | |||||
@Data | |||||
public class PointFlightRequest implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty(value = "机场id") | |||||
private String airportId; | |||||
@ApiModelProperty(value = "业务系统任务id") | |||||
private String requestId; | |||||
@ApiModelProperty(value = "业务系统标识") | |||||
private String code; | |||||
@ApiModelProperty(value = "租户代码") | |||||
private String tenantCode; | |||||
@ApiModelProperty(value = "指点高度") | |||||
private String alt; | |||||
@ApiModelProperty(value = "经度") | |||||
private String lon; | |||||
@ApiModelProperty(value = "纬度") | |||||
private String lat; | |||||
} |
package com.tuoheng.admin.service.airport; | package com.tuoheng.admin.service.airport; | ||||
import com.tuoheng.admin.entity.request.airport.PointFlightRequest; | |||||
import com.tuoheng.common.utils.JsonResult; | import com.tuoheng.common.utils.JsonResult; | ||||
public interface AirportService { | public interface AirportService { | ||||
/** | |||||
* 获取机场列表 | |||||
* | |||||
* @return | |||||
*/ | |||||
JsonResult getList(); | JsonResult getList(); | ||||
/** | |||||
* 定点飞行 | |||||
* @param request | |||||
* @return | |||||
*/ | |||||
JsonResult pointFlight(PointFlightRequest request); | |||||
} | } |
package com.tuoheng.admin.service.airport; | package com.tuoheng.admin.service.airport; | ||||
import com.tuoheng.admin.entity.request.airport.PointFlightRequest; | |||||
import com.tuoheng.common.utils.JsonResult; | import com.tuoheng.common.utils.JsonResult; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
@Service | @Service | ||||
public class AirportServiceImpl implements AirportService { | public class AirportServiceImpl implements AirportService { | ||||
/** | |||||
* 获取机场列表 | |||||
* | |||||
* @return | |||||
*/ | |||||
@Override | @Override | ||||
public JsonResult getList() { | public JsonResult getList() { | ||||
return JsonResult.success(); | return JsonResult.success(); | ||||
} | } | ||||
/** | |||||
* 定点飞行 | |||||
* @param request | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public JsonResult pointFlight(PointFlightRequest request) { | |||||
return JsonResult.success(); | |||||
} | |||||
} | } |
package com.tuoheng.admin.service.camera.query; | package com.tuoheng.admin.service.camera.query; | ||||
import cn.hutool.core.util.ObjectUtil; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.tuoheng.admin.entity.domain.Camera; | |||||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||||
import com.tuoheng.admin.mapper.CameraMapper; | import com.tuoheng.admin.mapper.CameraMapper; | ||||
import com.tuoheng.common.exception.ServiceException; | |||||
import com.tuoheng.common.utils.JsonResult; | import com.tuoheng.common.utils.JsonResult; | ||||
import com.tuoheng.common.utils.StringUtils; | |||||
import com.tuoheng.system.entity.User; | |||||
import com.tuoheng.system.utils.ShiroUtils; | |||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import java.util.Optional; | |||||
/** | /** | ||||
* 根据Id查询摄像头业务层处理 | * 根据Id查询摄像头业务层处理 | ||||
* | * | ||||
@Autowired | @Autowired | ||||
private CameraMapper cameraMapper; | private CameraMapper cameraMapper; | ||||
public JsonResult getOneById(String id) { | |||||
public JsonResult getOneById(Integer id) { | |||||
// log.info("进入根据Id查询摄像头业务"); | // log.info("进入根据Id查询摄像头业务"); | ||||
return JsonResult.success(); | |||||
User user = ShiroUtils.getUserInfo(); | |||||
Integer tenantId = user.getTenantId(); | |||||
JsonResult result = this.check(tenantId, id); | |||||
if (0 != result.getCode()) { | |||||
log.info("进入根据ID查询摄像头业务:校验失败:{}", result.getMsg()); | |||||
return result; | |||||
} | |||||
Camera camera = (Camera) result.getData(); | |||||
return JsonResult.success(camera); | |||||
} | } | ||||
/** | /** | ||||
* @param id | * @param id | ||||
* @return | * @return | ||||
*/ | */ | ||||
private JsonResult check(String tenantId, String id) { | |||||
private JsonResult check(Integer tenantId, Integer id) { | |||||
// 判断部门id是否为空 | // 判断部门id是否为空 | ||||
if (StringUtils.isEmpty(id)) { | |||||
return JsonResult.error(500, "id为空"); | |||||
if (Optional.ofNullable(id).orElse(0) == 0) { | |||||
log.info("摄像头ID为空, id:{}", id); | |||||
throw new ServiceException("摄像头ID为空"); | |||||
} | |||||
// 判断摄像头是否存在 | |||||
Camera camera = cameraMapper.selectOne(new LambdaQueryWrapper<Camera>() | |||||
.eq(Camera::getTenantId, tenantId) | |||||
.eq(Camera::getId, id) | |||||
.eq(Camera::getMark, MarkTypeEnum.VALID)); | |||||
if (ObjectUtil.isNull(camera)) { | |||||
log.info("摄像头不存在, id:{}", id); | |||||
throw new ServiceException("摄像头不存在"); | |||||
} | } | ||||
// | |||||
// // 判断部门是否存在 | |||||
// Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>() | |||||
// .eq(Dept::getTenantId, tenantId) | |||||
// .eq(Dept::getId, queryInspectionRequest.getDeptId()) | |||||
// .eq(Dept::getMark, 1)); | |||||
// if (null == dept) { | |||||
// return JsonResult.error(QueryInspectionPageListCodeEnum.DEPT_IS_NOT_EXIST.getCode(), QueryInspectionPageListCodeEnum.DEPT_IS_NOT_EXIST.getMsg()); | |||||
// } | |||||
return JsonResult.success(); | |||||
return JsonResult.success(camera); | |||||
} | } | ||||
} | } |
import com.tuoheng.admin.entity.domain.Goods; | import com.tuoheng.admin.entity.domain.Goods; | ||||
import com.tuoheng.admin.entity.domain.Warehouse; | import com.tuoheng.admin.entity.domain.Warehouse; | ||||
import com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest; | import com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest; | ||||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||||
import com.tuoheng.admin.mapper.GoodsMapper; | import com.tuoheng.admin.mapper.GoodsMapper; | ||||
import com.tuoheng.admin.mapper.WarehouseMapper; | import com.tuoheng.admin.mapper.WarehouseMapper; | ||||
import com.tuoheng.common.exception.ServiceException; | import com.tuoheng.common.exception.ServiceException; | ||||
} | } | ||||
Warehouse warehouse = warehouseMapper.selectOne(new LambdaQueryWrapper<Warehouse>() | Warehouse warehouse = warehouseMapper.selectOne(new LambdaQueryWrapper<Warehouse>() | ||||
.eq(Warehouse::getTenantId, request.getTenantId()) | .eq(Warehouse::getTenantId, request.getTenantId()) | ||||
.eq(Warehouse::getMark, MarkTypeEnum.VALID) | |||||
.eq(Warehouse::getId, request.getWarehouseId())); | .eq(Warehouse::getId, request.getWarehouseId())); | ||||
if (ObjectUtil.isNull(warehouse)) { | if (ObjectUtil.isNull(warehouse)) { | ||||
log.info("仓库不存在, warehouseId:{}", request.getWarehouseId()); | log.info("仓库不存在, warehouseId:{}", request.getWarehouseId()); |
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.tuoheng.admin.entity.domain.Warehouse; | import com.tuoheng.admin.entity.domain.Warehouse; | ||||
import com.tuoheng.admin.entity.request.warehouse.QueryWarehouseListRequest; | import com.tuoheng.admin.entity.request.warehouse.QueryWarehouseListRequest; | ||||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||||
import com.tuoheng.admin.mapper.WarehouseMapper; | import com.tuoheng.admin.mapper.WarehouseMapper; | ||||
import com.tuoheng.common.utils.JsonResult; | import com.tuoheng.common.utils.JsonResult; | ||||
import com.tuoheng.system.entity.User; | import com.tuoheng.system.entity.User; | ||||
} | } | ||||
List<Warehouse> warehouseList = warehouseMapper.selectList(new LambdaQueryWrapper<Warehouse>() | List<Warehouse> warehouseList = warehouseMapper.selectList(new LambdaQueryWrapper<Warehouse>() | ||||
.eq(Warehouse::getTenantId, request.getTenantId())); | |||||
.eq(Warehouse::getMark, MarkTypeEnum.VALID) | |||||
.eq(Warehouse::getTenantId, request.getTenantId())); | |||||
if (CollectionUtil.isEmpty(warehouseList)) { | if (CollectionUtil.isEmpty(warehouseList)) { | ||||
log.info("仓库列表数据为空"); | log.info("仓库列表数据为空"); | ||||
} | } |
Integer tenantId = user.getTenantId(); | Integer tenantId = user.getTenantId(); | ||||
JsonResult result = this.check(tenantId, id); | JsonResult result = this.check(tenantId, id); | ||||
if (0 != result.getCode()) { | if (0 != result.getCode()) { | ||||
log.info("根据查询Id查询预警信息业务:校验失败:{}", result.getMsg()); | |||||
log.info("根据Id查询预警信息业务:校验失败:{}", result.getMsg()); | |||||
return result; | return result; | ||||
} | } | ||||
Warning warning = (Warning) result.getData(); | Warning warning = (Warning) result.getData(); |