Commit 65242508 authored by caotao's avatar caotao

1.按月统计里程接口增加筛选、异常轨迹接口增加筛选。

2.增加车辆告警相关功能代码。 3.车辆当月里程导出里程规范.
parent ea000999
package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentOnCarAppVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 消防车信息
*
* @author wujiang
* @date 2020-07-07
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value="wl_car_speed_warning_record",autoResultMap = true)
@ApiModel(value = "车辆告警信息实体类", description = "车辆告警信息")
public class CarSpeedWarningRecord extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "车牌号")
private String carNum;
@ApiModelProperty(value = "告警时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date waringDate;
@ApiModelProperty(value = "超速值")
@TableField("over_speed")
private Double overSpeed;
@ApiModelProperty(value = "机构/部门名称")
@TableField("biz_org_name")
private String bizOrgName;
// 2023年11月6日 11点16分添加
@ApiModelProperty(value = "司机")
@TableField("driver")
private String driver;
// 2023年11月6日 11点16分添加
@ApiModelProperty(value = "联系电话")
@TableField("phone")
private String phone;
@ApiModelProperty(value = "联系电话")
@TableField("ownership")
private String ownership;
}
......@@ -473,7 +473,7 @@ public class CarController extends AbstractBaseController {
/**
* 根据车辆id查询车辆详情信息,供iot_tree展示
*
* @param carNum
* @param id
* @return
*/
@RequestMapping(value = "/threeDimensional/getCarDetailById/{id}", method = RequestMethod.GET)
......@@ -1337,7 +1337,7 @@ public class CarController extends AbstractBaseController {
/**
* 根据查询车辆简要信息
*
* @param id
* @param carNum
* @return
*/
@RequestMapping(value = "/state/info", method = RequestMethod.GET)
......@@ -1422,8 +1422,8 @@ public class CarController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getCarEquipAlarmInfoDto", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-获取设备告警信息", notes = "车辆统计-获取设备告警信息")
public Page<CarEquipAlarmInfoDto> getCarEquipAlarmInfoDto() {
return iCarService.getCarEquipAlarmInfoDto();
public Page<CarEquipAlarmInfoDto> getCarEquipAlarmInfoDto(@RequestParam(required = false) String keyWord) {
return iCarService.getCarEquipAlarmInfoDto(keyWord);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
......@@ -1443,15 +1443,15 @@ public class CarController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getCarMileageInfoByMoth", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-按照月份统计车辆里程", notes = "车辆统计-按照月份统计车辆里程")
public BasicTableDataDto getCarMileageInfoByMoth(@RequestParam(required = false) String date, @RequestParam Integer current, @RequestParam Integer size) {
return iCarService.getCarMileageInfoByMoth(date, current, size);
public BasicTableDataDto getCarMileageInfoByMoth(@RequestParam(required = false) String date, @RequestParam Integer current, @RequestParam Integer size,@RequestParam(required = false) String keyWord) {
return iCarService.getCarMileageInfoByMoth(date, current, size, keyWord);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/exportCarMileageInfoByMoth", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-按照月份统计导出车辆里程", notes = "车辆统计-按照月份统计导出车辆里程")
public void exportCarMileageInfoByMoth(@RequestParam(required = false) String date, HttpServletResponse response) {
List<CarExportDto> list = this.iCarService.exportCarMileageInfoByMoth(date);
public void exportCarMileageInfoByMoth(@RequestParam(required = false) String date,@RequestParam(required = false) String keyWord, HttpServletResponse response) {
List<CarExportDto> list = this.iCarService.exportCarMileageInfoByMoth(date,keyWord);
if (org.springframework.util.StringUtils.isEmpty(date)) {
date = DateUtil.format(new Date(), "yyyy-MM");
}
......@@ -1469,7 +1469,14 @@ public class CarController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getCarExcepitonTrack", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-按照日期范围获取异常车辆", notes = "车辆统计-按照日期范围获取异常车辆")
public Page<CarExceptionDto> getCarExcepitonTrack(@RequestParam Integer type) {
return iCarService.getCarExcepitonTrack(type);
public Page<CarExceptionDto> getCarExcepitonTrack(@RequestParam Integer type,@RequestParam(required = false) String keyWord) {
return iCarService.getCarExcepitonTrack(type,keyWord);
}
@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) {
return iCarService.getCarWarningRecord(keyWord);
}
}
......@@ -16,4 +16,6 @@ public class MileageDto {
private String number;
//iotCode+date
private String iotCode;
//所属单位
private String bizOrgName;
}
package com.yeejoin.equipmanage.listener;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.equipmanage.common.entity.Car;
import com.yeejoin.equipmanage.common.entity.CarSpeedWarningRecord;
import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.mapper.WlCarSpeedWaringRecordMapper;
import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IWlCarMileageService;
import com.yeejoin.equipmanage.thread.ThreadCar;
......@@ -43,8 +47,13 @@ public class CarIotNewListener extends EmqxListener {
@Autowired
private IotFeign iotFeign;
@Autowired
private WlCarSpeedWaringRecordMapper wlCarSpeedWaringRecordMapper;
@Value("${mileage.clippingtime:600000}")
private Long clipping_time;
@Value("${default.maxspeed:70.0}")
private Double defaultMaxSpeed;
private final String GUIDE_KEY = "813684495d9a3981dd2c7694916fe404";
private final String GUIDE_URL = "https://restapi.amap.com/v3/geocode/regeo?";
......@@ -191,7 +200,9 @@ public class CarIotNewListener extends EmqxListener {
double startLongitude = jsonObject.getDoubleValue("FireCar_Longitude");
double startLatitude = jsonObject.getDoubleValue("FireCar_Latitude");
int direction = jsonObject.getIntValue("direction");
String waringDate = jsonObject.getString("createdTime");
Double speed=jsonObject.getDoubleValue("FireCar_Speed");
Double maxSpeed = defaultMaxSpeed;
// 地图推送消息
Car car = iCarService.getOne(new LambdaQueryWrapper<Car>().eq(Car::getIotCode, iotCode));
if (car != null && startLongitude != 0 && startLatitude != 0) {
......@@ -208,7 +219,22 @@ public class CarIotNewListener extends EmqxListener {
mqttMessage.setPayload(sendArr.toJSONString().getBytes());
car.setLongitude(startLongitude);
car.setLatitude(startLatitude);
if(!ObjectUtils.isEmpty(car.getMaxSpeed())){
maxSpeed =car.getMaxSpeed();
}
iCarService.updateById(car);
if(speed > maxSpeed){
CarSpeedWarningRecord carSpeedWarningRecord = new CarSpeedWarningRecord();
carSpeedWarningRecord.setCarNum(car.getCarNum());
carSpeedWarningRecord.setDriver(car.getDriver());
carSpeedWarningRecord.setPhone(car.getPhone());
carSpeedWarningRecord.setOverSpeed(speed-maxSpeed);
carSpeedWarningRecord.setOwnership(car.getOwnership());
carSpeedWarningRecord.setBizOrgName(car.getBizOrgName());
carSpeedWarningRecord.setWaringDate(DateUtil.parse(waringDate, DatePattern.NORM_DATETIME_PATTERN));
wlCarSpeedWaringRecordMapper.insert(carSpeedWarningRecord);
logger.info("-----------触发车辆超速告警成功--------");
}
logger.info("-----------推送车辆位置消息到到地图成功--------");
try {
emqkeeper.getMqttClient().publish("car/location", mqttMessage);
......
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.CarSpeedWarningRecord;
public interface WlCarSpeedWaringRecordMapper extends BaseMapper<CarSpeedWarningRecord> {
}
......@@ -8,10 +8,7 @@ import com.yeejoin.equipmanage.common.datasync.entity.FireVehicle;
import com.yeejoin.equipmanage.common.dto.CarFusionDto;
import com.yeejoin.equipmanage.common.dto.CarInfoDto;
import com.yeejoin.equipmanage.common.dto.CarStatusInfoDto;
import com.yeejoin.equipmanage.common.entity.Car;
import com.yeejoin.equipmanage.common.entity.CarInfo;
import com.yeejoin.equipmanage.common.entity.CarProperty;
import com.yeejoin.equipmanage.common.entity.EquipmentCategory;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.dto.CarDto;
import com.yeejoin.equipmanage.common.entity.dto.CarEquipAlarmInfoDto;
import com.yeejoin.equipmanage.common.entity.dto.CarEquipStateInfoDto;
......@@ -19,6 +16,7 @@ import com.yeejoin.equipmanage.common.entity.vo.CarIndexVo;
import com.yeejoin.equipmanage.common.entity.vo.CarPropertyVo;
import com.yeejoin.equipmanage.common.vo.*;
import com.yeejoin.equipmanage.dto.*;
import javassist.compiler.ast.Keyword;
import java.util.HashMap;
import java.util.List;
......@@ -200,19 +198,18 @@ public interface ICarService extends IService<Car> {
Map<String,Integer> getCountOfCarBelongCompany();
List<ChartIntegerDto> getCarCategoryInfo() ;
Page<CarEquipStateInfoDto> getCarEquipStateInfo();
Page<CarEquipAlarmInfoDto> getCarEquipAlarmInfoDto();
Page<CarEquipAlarmInfoDto> getCarEquipAlarmInfoDto(String keyWord);
List<ChartIntegerDto>getCarBelongAreaInfo() ;
Page<CarAreaInfoDto> getCarAreaInfo(String areaName ) ;
BasicTableDataDto getCarMileageInfoByMoth(String date,Integer current,Integer pageSize);
List<CarExportDto> exportCarMileageInfoByMoth(String date);
BasicTableDataDto getCarMileageInfoByMoth(String date, Integer current, Integer pageSize,String keyWord);
List<CarExportDto> exportCarMileageInfoByMoth(String date,String keyWord);
ZZChartsDto getCarMileageInfoByMothOFDay(String iotCode);
Page<CarExceptionDto> getCarExcepitonTrack(Integer type);
Page<CarExceptionDto> getCarExcepitonTrack(Integer type,String keyWord);
Page<CarSpeedWarningRecord> getCarWarningRecord(String keyWord);
/**
* 查询车辆启动状态,赋码
*/
List<Map<String, String>> updateCarStartStatus();
/**
* 赋码
*/
......
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