kaiyu
2021-08-31 9c83d6bf41457e97a343c867f5b5261f222c158d
screen-api/src/main/java/com/moral/api/controller/SpecialDeviceController.java
@@ -6,6 +6,7 @@
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -32,6 +33,16 @@
    private SpecialDeviceService specialDeviceService;
    /**
     * @return 返回请求成功后的对象信息
     */
    @GetMapping("getCarsByOrg")
    @ApiOperation(value = "获取当前组织下所有走航车列表", notes = "走航车轨迹")
    public ResultMessage getCarsInfo() {
        List<Map<String, Object>> response = specialDeviceService.getCarsInfo();
        return ResultMessage.ok(response);
    }
    /**
     * @param request 请求信息
     * @return 返回请求成功后的对象信息
     */
@@ -40,16 +51,15 @@
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"),
            @ApiImplicitParam(name = "mac", value = "设备mac", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "sensorCode", value = "传感器code", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "time", value = "时间,2021-08-18", required = true, paramType = "query", dataType = "String")
    })
    public ResultMessage carTrajectory(HttpServletRequest request) {
        Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
        if (!params.containsKey("mac") || !params.containsKey("sensorCode") || !params.containsKey("time")) {
        if (!params.containsKey("mac") || !params.containsKey("time")) {
            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
        }
        List<Map<String, Object>> response = specialDeviceService.carTrajectory(params);
        return ResultMessage.ok(response);
        return ObjectUtils.isEmpty(response) ? ResultMessage.ok() : ResultMessage.ok(response);
    }
}