Commit 1b0f2cfd authored by caotao's avatar caotao

1.重写车辆轨迹生成逻辑。

2.车辆超速信息增加分页功能。
parent c531aa85
......@@ -1475,8 +1475,8 @@ public class CarController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getCarWarningRecord", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-获取超速信息", notes = "车辆统计-获取超速信息")
public Page<CarSpeedWarningRecord> getCarWarningRecord(@RequestParam(required = false) String keyWord,@RequestParam String flag) {
return iCarService.getCarWarningRecord(keyWord);
public BasicTableDataDto getCarWarningRecord(@RequestParam(required = false) String keyWord,@RequestParam Integer current, @RequestParam Integer size) {
return iCarService.getCarWarningRecord(keyWord,current,size);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getBizOrgName", method = RequestMethod.GET)
......
package com.yeejoin.equipmanage.initbean;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.equipmanage.common.entity.Car;
import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.impl.WlCarMileageServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.List;
import java.util.concurrent.TimeUnit;
@Component
@Slf4j
public class JxiopCarReCountTimeBean {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private WlCarMileageServiceImpl wlCarMileageServiceImpl;
@Autowired
private ICarService iCarService;
@PostConstruct
public void reCountTime() {
log.info("---------------------车辆重新开始计时::开始-------------------------");
List<WlCarMileage> wlCarMileageList = wlCarMileageServiceImpl.list(new QueryWrapper<WlCarMileage>().isNull("end_time"));
for (int i = 0; i < wlCarMileageList.size(); i++) {
Car car = iCarService.getOne(new QueryWrapper<Car>().eq("iot_code", wlCarMileageList.get(i).getIotCode()));
if(ObjectUtils.isNotEmpty(car)){
String coordinate = String.valueOf(car.getLongitude()) + "," + String.valueOf(car.getLatitude());
redisTemplate.opsForValue().set(car.getIotCode(), coordinate, 10, TimeUnit.MINUTES);
}
}
log.info("---------------------车辆重新开始计时::结束-------------------------");
}
}
......@@ -2,6 +2,9 @@ package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.CarSpeedWarningRecord;
import org.apache.ibatis.annotations.Select;
public interface WlCarSpeedWaringRecordMapper extends BaseMapper<CarSpeedWarningRecord> {
@Select("select count(1) from wl_car_speed_warning_record")
Integer getCountOfRecords();
}
......@@ -202,7 +202,7 @@ public interface ICarService extends IService<Car> {
List<CarExportDto> exportCarMileageInfoByMoth(String date,String keyWord);
ZZChartsDto getCarMileageInfoByMothOFDay(String iotCode);
Page<CarExceptionDto> getCarExcepitonTrack(Integer type,String keyWord);
Page<CarSpeedWarningRecord> getCarWarningRecord(String keyWord);
BasicTableDataDto getCarWarningRecord(String keyWord,Integer current, Integer pageSize);
List<Map<String,String>> getBizOrgName();
/**
......
......@@ -1709,7 +1709,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
LocalDate localDate = LocalDate.now(ZoneId.of("+8"));
String endDate = localDate.toString();
String startDate = localDate.plusDays((0 - type)).toString();
List<Car> list =carMapper.selectList(new QueryWrapper<>()) ;
List<Car> list = carMapper.selectList(new QueryWrapper<>());
if (StringUtils.isNotEmpty(keyWord)) {
list = list.stream().filter(car -> car.getBizOrgName().contains(keyWord)).collect(Collectors.toList());
}
......@@ -1734,22 +1734,29 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
}
@Override
public Page<CarSpeedWarningRecord> getCarWarningRecord(String keyWord) {
public BasicTableDataDto getCarWarningRecord(String keyWord, Integer current, Integer pageSize) {
BasicTableDataDto basicTableDataDto=new BasicTableDataDto();
Page<CarSpeedWarningRecord> carSpeedWarningRecordPage = new Page<>();
List<ColModel> colModels = new ArrayList<>();
colModels.add(new ColModel("carNum", "车牌号"));
colModels.add(new ColModel("bizOrgName", "所属单位"));
colModels.add(new ColModel("waringDate", "超速时间"));
colModels.add(new ColModel("overSpeed", "超速值(Km/h)"));
Date date = new Date();
String endTime = DateUtil.format(date, DatePattern.NORM_DATETIME_FORMAT);
date = DateUtil.offsetDay(date, -15);
date = DateUtil.offsetDay(date, -5);
String startTime = DateUtil.format(date, DatePattern.NORM_DATETIME_FORMAT);
List<CarSpeedWarningRecord> list = wlCarSpeedWaringRecordMapper.selectList(new QueryWrapper<CarSpeedWarningRecord>().ge("waring_date", startTime).le("waring_date", endTime));
QueryWrapper queryWrapper = new QueryWrapper<CarSpeedWarningRecord>();
if (StringUtils.isNotEmpty(keyWord)) {
list = list.stream().filter(carSpeedWarningRecord -> carSpeedWarningRecord.getBizOrgName().contains(keyWord) || carSpeedWarningRecord.getOwnership().contains(keyWord)).collect(Collectors.toList());
}
Collections.sort(list, (e1, e2) -> e2.getOverSpeed().compareTo(e1.getOverSpeed()));
carSpeedWarningRecordPage.setRecords(list);
carSpeedWarningRecordPage.setTotal(list.size());
carSpeedWarningRecordPage.setSize(1);
carSpeedWarningRecordPage.setCurrent(1);
return carSpeedWarningRecordPage;
queryWrapper.like("biz_org_name", keyWord);
}
queryWrapper.orderByDesc("over_speed");
queryWrapper.last("limit "+ (current-1)*pageSize+","+current*pageSize);
List<CarSpeedWarningRecord> list = wlCarSpeedWaringRecordMapper.selectList(queryWrapper);
DataGridMock dataGridMock = new DataGridMock(current,wlCarSpeedWaringRecordMapper.getCountOfRecords(),true,current,list);
basicTableDataDto.setDataGridMock(dataGridMock);
basicTableDataDto.setColModel(colModels);
return basicTableDataDto;
}
@Override
......
......@@ -3,7 +3,6 @@ package com.yeejoin;
import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils;
import com.yeejoin.equipmanage.listener.CarIotListener;
import com.yeejoin.equipmanage.listener.CarIotNewListener;
import com.yeejoin.equipmanage.thread.ThreadCarMileageTreatment;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
......@@ -59,8 +58,6 @@ public class AmostEquipApplication {
@Autowired
private CarIotNewListener carIotNewListener;
@Autowired
private ThreadCarMileageTreatment threadCarMileageTreatment;
......@@ -102,9 +99,4 @@ public class AmostEquipApplication {
}
}
// 江西电建服务重启后对于未计时且未结束的里程的进行处理
@Bean
void initCarMelige() {
threadCarMileageTreatment.start();
}
}
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