Commit 5421f63a authored by KeYong's avatar KeYong

Merge branch 'develop_dl' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl

parents ac9a93e0 65242508
...@@ -116,13 +116,18 @@ public class Car extends BaseEntity { ...@@ -116,13 +116,18 @@ public class Car extends BaseEntity {
@ApiModelProperty(value = "机构编码") @ApiModelProperty(value = "机构编码")
@TableField("biz_org_code") @TableField("biz_org_code")
private String bizOrgCode; private String bizOrgCode;
// 2023年11月6日 11点16分添加
@ApiModelProperty(value = "司机")
@TableField("driver")
private String driver;
// 2023年11月6日 11点16分添加
@ApiModelProperty(value = "联系电话")
@TableField("phone")
private String phone;
// 2023年11月6日 11点16分添加
@ApiModelProperty(value = "速度阈值")
@TableField("max_speed")
private Double maxSpeed;
@ApiModelProperty(value = "图片") @ApiModelProperty(value = "图片")
@TableField(exist = false) @TableField(exist = false)
private List<UploadFile> img; private List<UploadFile> img;
...@@ -177,7 +182,6 @@ public class Car extends BaseEntity { ...@@ -177,7 +182,6 @@ public class Car extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private String iotStatus; private String iotStatus;
@TableField(exist = false) @TableField(exist = false)
private Long categoryId; private Long categoryId;
...@@ -232,4 +236,6 @@ public class Car extends BaseEntity { ...@@ -232,4 +236,6 @@ public class Car extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private String iotDeviceName; private String iotDeviceName;
@TableField(exist = false)
private Double monthTravel;
} }
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;
}
...@@ -75,6 +75,11 @@ ...@@ -75,6 +75,11 @@
<version>2.4</version> <version>2.4</version>
<classifier>jdk15</classifier> <classifier>jdk15</classifier>
</dependency> </dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.3.10</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -86,7 +86,7 @@ public class BasicTableDataDto { ...@@ -86,7 +86,7 @@ public class BasicTableDataDto {
// } // }
// ] // ]
// } // }
private MypageDto dataGridMock; private DataGridMock dataGridMock;
private List<ColModel> colModel ; private List<ColModel> colModel ;
} }
...@@ -9,6 +9,10 @@ public class CarExportDto { ...@@ -9,6 +9,10 @@ public class CarExportDto {
private String code; private String code;
@Excel(name="车牌号") @Excel(name="车牌号")
private String carNumber; private String carNumber;
@Excel(name = "司机")
private String driver;
@Excel(name = "联系电话")
private String phone;
@Excel(name="所属单位") @Excel(name="所属单位")
private String orgName; private String orgName;
@Excel(name="车辆型号") @Excel(name="车辆型号")
...@@ -17,4 +21,5 @@ public class CarExportDto { ...@@ -17,4 +21,5 @@ public class CarExportDto {
private String displacement; private String displacement;
@Excel(name = "里程数(km)") @Excel(name = "里程数(km)")
private String totalTravel; private String totalTravel;
} }
package com.yeejoin.equipmanage.dto;
import io.swagger.models.auth.In;
import lombok.Data;
import java.util.List;
@Data
public class DataGridMock {
private int current;
private int total;
private boolean pagination;
private int totalPage;
private List dataList;
public DataGridMock(int current, int total, boolean pagination, int totalPage, List dataList) {
this.current = current;
this.total = total;
this.pagination = pagination;
this.totalPage = totalPage;
this.dataList = dataList;
}
}
...@@ -4,10 +4,18 @@ import lombok.Data; ...@@ -4,10 +4,18 @@ import lombok.Data;
@Data @Data
public class MileageDto { public class MileageDto {
private String carCode; //车辆编号
private String carNum; private String carCode;
private Double totalTravel; //车牌号
private String total; private String carNum;
//iotCode+date //百分比
private String iotCode; private Double totalTravel;
//当月总里程
private String total;
//车辆排名
private String number;
//iotCode+date
private String iotCode;
//所属单位
private String bizOrgName;
} }
package com.yeejoin.equipmanage.dto;
import io.swagger.models.auth.In;
import lombok.Data;
import java.util.List;
@Data
public class MypageDto {
private Integer current ;
private Integer total;
private Boolean pagination;
private Integer totalPage;
private List dataList;
private Integer pageSize;
}
package com.yeejoin.equipmanage.listener; 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.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.equipmanage.common.entity.Car; 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.common.entity.WlCarMileage;
import com.yeejoin.equipmanage.fegin.IotFeign; import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.mapper.WlCarSpeedWaringRecordMapper;
import com.yeejoin.equipmanage.service.ICarService; import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IWlCarMileageService; import com.yeejoin.equipmanage.service.IWlCarMileageService;
import com.yeejoin.equipmanage.thread.ThreadCar; import com.yeejoin.equipmanage.thread.ThreadCar;
...@@ -43,8 +47,13 @@ public class CarIotNewListener extends EmqxListener { ...@@ -43,8 +47,13 @@ public class CarIotNewListener extends EmqxListener {
@Autowired @Autowired
private IotFeign iotFeign; private IotFeign iotFeign;
@Autowired
private WlCarSpeedWaringRecordMapper wlCarSpeedWaringRecordMapper;
@Value("${mileage.clippingtime:600000}") @Value("${mileage.clippingtime:600000}")
private Long clipping_time; private Long clipping_time;
@Value("${default.maxspeed:70.0}")
private Double defaultMaxSpeed;
private final String GUIDE_KEY = "813684495d9a3981dd2c7694916fe404"; private final String GUIDE_KEY = "813684495d9a3981dd2c7694916fe404";
private final String GUIDE_URL = "https://restapi.amap.com/v3/geocode/regeo?"; private final String GUIDE_URL = "https://restapi.amap.com/v3/geocode/regeo?";
...@@ -191,7 +200,9 @@ public class CarIotNewListener extends EmqxListener { ...@@ -191,7 +200,9 @@ public class CarIotNewListener extends EmqxListener {
double startLongitude = jsonObject.getDoubleValue("FireCar_Longitude"); double startLongitude = jsonObject.getDoubleValue("FireCar_Longitude");
double startLatitude = jsonObject.getDoubleValue("FireCar_Latitude"); double startLatitude = jsonObject.getDoubleValue("FireCar_Latitude");
int direction = jsonObject.getIntValue("direction"); 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)); Car car = iCarService.getOne(new LambdaQueryWrapper<Car>().eq(Car::getIotCode, iotCode));
if (car != null && startLongitude != 0 && startLatitude != 0) { if (car != null && startLongitude != 0 && startLatitude != 0) {
...@@ -208,7 +219,22 @@ public class CarIotNewListener extends EmqxListener { ...@@ -208,7 +219,22 @@ public class CarIotNewListener extends EmqxListener {
mqttMessage.setPayload(sendArr.toJSONString().getBytes()); mqttMessage.setPayload(sendArr.toJSONString().getBytes());
car.setLongitude(startLongitude); car.setLongitude(startLongitude);
car.setLatitude(startLatitude); car.setLatitude(startLatitude);
if(!ObjectUtils.isEmpty(car.getMaxSpeed())){
maxSpeed =car.getMaxSpeed();
}
iCarService.updateById(car); 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("-----------推送车辆位置消息到到地图成功--------"); logger.info("-----------推送车辆位置消息到到地图成功--------");
try { try {
emqkeeper.getMqttClient().publish("car/location", mqttMessage); 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; ...@@ -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.CarFusionDto;
import com.yeejoin.equipmanage.common.dto.CarInfoDto; import com.yeejoin.equipmanage.common.dto.CarInfoDto;
import com.yeejoin.equipmanage.common.dto.CarStatusInfoDto; import com.yeejoin.equipmanage.common.dto.CarStatusInfoDto;
import com.yeejoin.equipmanage.common.entity.Car; import com.yeejoin.equipmanage.common.entity.*;
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.dto.CarDto; import com.yeejoin.equipmanage.common.entity.dto.CarDto;
import com.yeejoin.equipmanage.common.entity.dto.CarEquipAlarmInfoDto; import com.yeejoin.equipmanage.common.entity.dto.CarEquipAlarmInfoDto;
import com.yeejoin.equipmanage.common.entity.dto.CarEquipStateInfoDto; import com.yeejoin.equipmanage.common.entity.dto.CarEquipStateInfoDto;
...@@ -19,6 +16,7 @@ import com.yeejoin.equipmanage.common.entity.vo.CarIndexVo; ...@@ -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.entity.vo.CarPropertyVo;
import com.yeejoin.equipmanage.common.vo.*; import com.yeejoin.equipmanage.common.vo.*;
import com.yeejoin.equipmanage.dto.*; import com.yeejoin.equipmanage.dto.*;
import javassist.compiler.ast.Keyword;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -200,19 +198,18 @@ public interface ICarService extends IService<Car> { ...@@ -200,19 +198,18 @@ public interface ICarService extends IService<Car> {
Map<String,Integer> getCountOfCarBelongCompany(); Map<String,Integer> getCountOfCarBelongCompany();
List<ChartIntegerDto> getCarCategoryInfo() ; List<ChartIntegerDto> getCarCategoryInfo() ;
Page<CarEquipStateInfoDto> getCarEquipStateInfo(); Page<CarEquipStateInfoDto> getCarEquipStateInfo();
Page<CarEquipAlarmInfoDto> getCarEquipAlarmInfoDto(); Page<CarEquipAlarmInfoDto> getCarEquipAlarmInfoDto(String keyWord);
List<ChartIntegerDto>getCarBelongAreaInfo() ; List<ChartIntegerDto>getCarBelongAreaInfo() ;
Page<CarAreaInfoDto> getCarAreaInfo(String areaName ) ; Page<CarAreaInfoDto> getCarAreaInfo(String areaName ) ;
Page<MileageDto> getCarMileageInfoByMoth(String date); BasicTableDataDto getCarMileageInfoByMoth(String date, Integer current, Integer pageSize,String keyWord);
List<CarExportDto> exportCarMileageInfoByMoth(String date); List<CarExportDto> exportCarMileageInfoByMoth(String date,String keyWord);
ZZChartsDto getCarMileageInfoByMothOFDay(String iotCode); 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(); List<Map<String, String>> updateCarStartStatus();
/** /**
* 赋码 * 赋码
*/ */
......
package com.yeejoin.equipmanage.service.impl; package com.yeejoin.equipmanage.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...@@ -24,11 +26,13 @@ import org.slf4j.Logger; ...@@ -24,11 +26,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -75,7 +79,9 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -75,7 +79,9 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
private Double mileageParameter; private Double mileageParameter;
@Resource @Resource
private EmqKeeper emqKeeper; private EmqKeeper emqKeeper;
@Autowired
@Lazy
private IWlCarMileageService iWlCarMileageService;
public static List<String> getDayByMonth(Date date) { public static List<String> getDayByMonth(Date date) {
List<String> data = new ArrayList<>(); List<String> data = new ArrayList<>();
try { try {
...@@ -478,12 +484,44 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -478,12 +484,44 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
@Override @Override
public Double getTotalTravelByIotCodeAndDate(String date, String iotCode) { public Double getTotalTravelByIotCodeAndDate(String date, String iotCode) {
return this.baseMapper.getTotalTravelByIotCodeAndDate(date, iotCode); if(StringUtils.isEmpty(date)){
date = DateUtil.format(new Date(),"yyyy-MM");
}
Double totalTravel = 0.0;
LambdaQueryWrapper<WlCarMileage> wrapper = new LambdaQueryWrapper<WlCarMileage>();
wrapper.eq(WlCarMileage::getIotCode,iotCode);
wrapper.ge(WlCarMileage::getTravel, 0.5);
wrapper.isNotNull(WlCarMileage::getEndTime);
wrapper.isNotNull(WlCarMileage::getStartTime);
wrapper.like(WlCarMileage::getStartTime,date);
List<WlCarMileage> list = iWlCarMileageService.list(wrapper);
for (WlCarMileage wl : list) {
//判断当前车辆全程是否异常,如果时速小于阈值 则对数据进行返回 否则不予返回
if (!org.springframework.util.ObjectUtils.isEmpty(wl.getTakeTime()) && !org.springframework.util.ObjectUtils.isEmpty(wl.getTravel()) && ((wl.getTravel() / (wl.getTakeTime() / 3600000.0)) < CAR_MAX_SPEED)) {
totalTravel += wl.getTravel();
}
}
return totalTravel;
} }
@Override @Override
public Double getTotalTravelByIotCodeAndDateProd(String startDate, String endDate, String iotCode) { public Double getTotalTravelByIotCodeAndDateProd(String startDate, String endDate, String iotCode) {
return this.baseMapper.getTotalTravelByIotCodeAndDateProd(startDate, endDate, iotCode); Double totalTravel = 0.0;
LambdaQueryWrapper<WlCarMileage> wrapper = new LambdaQueryWrapper<WlCarMileage>();
wrapper.eq(WlCarMileage::getIotCode,iotCode);
wrapper.ge(WlCarMileage::getTravel, 0.5);
wrapper.isNotNull(WlCarMileage::getEndTime);
wrapper.isNotNull(WlCarMileage::getStartTime);
wrapper.ge(WlCarMileage::getEndTime,endDate);
wrapper.le(WlCarMileage::getStartTime,startDate);
List<WlCarMileage> list = iWlCarMileageService.list(wrapper);
for (WlCarMileage wl : list) {
//判断当前车辆全程是否异常,如果时速小于阈值 则对数据进行返回 否则不予返回
if (!org.springframework.util.ObjectUtils.isEmpty(wl.getTakeTime()) && !org.springframework.util.ObjectUtils.isEmpty(wl.getTravel()) && ((wl.getTravel() / (wl.getTakeTime() / 3600000.0)) < CAR_MAX_SPEED)) {
totalTravel += wl.getTravel();
}
}
return totalTravel;
} }
/** /**
......
...@@ -1950,7 +1950,11 @@ ...@@ -1950,7 +1950,11 @@
And wlc.equip_status = #{equipTypeAmountPage.equipStatus} And wlc.equip_status = #{equipTypeAmountPage.equipStatus}
</if> </if>
<if test="equipTypeAmountPage.keyword!=null and equipTypeAmountPage.keyword!=''"> <if test="equipTypeAmountPage.keyword!=null and equipTypeAmountPage.keyword!=''">
And (wlc.`NAME` LIKE CONCAT('%',#{equipTypeAmountPage.keyword},'%') OR wlc.car_num LIKE CONCAT('%',#{equipTypeAmountPage.keyword},'%')) And (wlc.`NAME` LIKE CONCAT('%',#{equipTypeAmountPage.keyword},'%')
OR wlc.car_num LIKE CONCAT('%',#{equipTypeAmountPage.keyword},'%')
OR wlc.biz_org_name LIKE CONCAT('%',#{equipTypeAmountPage.keyword},'%')
OR wlc.ownership LIKE CONCAT('%',#{equipTypeAmountPage.keyword},'%')
)
</if> </if>
)s2 )s2
<if test="equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''"> <if test="equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''">
......
...@@ -58,8 +58,7 @@ ...@@ -58,8 +58,7 @@
SELECT SUM(travel) SELECT SUM(travel)
FROM wl_car_mileage FROM wl_car_mileage
WHERE date LIKE concat('%',#{date},'%') WHERE date LIKE concat('%',#{date},'%')
AND AND iot_code = #{iotCode}
iot_code = #{iotCode}
</select> </select>
<select id ="getTotalTravelByIotCodeAndDateProd" resultType="Double"> <select id ="getTotalTravelByIotCodeAndDateProd" resultType="Double">
......
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