Commit f07b4320 authored by caotao's avatar caotao

增加时速阈值 防止返回垃圾数据

parent 11b26b24
...@@ -13,6 +13,7 @@ import io.swagger.annotations.Api; ...@@ -13,6 +13,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -20,6 +21,7 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType; ...@@ -20,6 +21,7 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -34,6 +36,8 @@ import java.util.*; ...@@ -34,6 +36,8 @@ import java.util.*;
@Api(tags = "车量里程表Api") @Api(tags = "车量里程表Api")
@RequestMapping(value = "/wl-car-mileage", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/wl-car-mileage", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class WlCarMileageController { public class WlCarMileageController {
@Value("${car.max.speed:100}")
private Integer CAR_MAX_SPEED ;
@Autowired @Autowired
IWlCarMileageService iWlCarMileageService; IWlCarMileageService iWlCarMileageService;
...@@ -170,7 +174,10 @@ public class WlCarMileageController { ...@@ -170,7 +174,10 @@ public class WlCarMileageController {
BeanUtil.copyPropertiesIgnoreNull(wl, wlCarMileageDto); BeanUtil.copyPropertiesIgnoreNull(wl, wlCarMileageDto);
wlCarMileageDto.setStartTime(sdf.format(wl.getStartTime())); wlCarMileageDto.setStartTime(sdf.format(wl.getStartTime()));
wlCarMileageDto.setEndTime(sdf.format(wl.getEndTime())); wlCarMileageDto.setEndTime(sdf.format(wl.getEndTime()));
list.add(wlCarMileageDto); //判断当前车辆全程是否异常,如果时速小于阈值 则对数据进行返回 否则不予返回
if((wlCarMileage.getTravel()/(wlCarMileage.getTakeTime()/3600000))<CAR_MAX_SPEED){
list.add(wlCarMileageDto);
}
} }
carTravelDto.setRecords(list); carTravelDto.setRecords(list);
// // 初始化format格式 // // 初始化format格式
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment