对接报警系统
parent
eac2010731
commit
de724ddfbd
|
@ -105,6 +105,10 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>muyu-business-common</artifactId>
|
<artifactId>muyu-business-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-business-remote</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -37,197 +37,197 @@ public class BreakdownImpl implements VehicleService{
|
||||||
@Override
|
@Override
|
||||||
public void eventResolution(VehicleData vehicleData) {
|
public void eventResolution(VehicleData vehicleData) {
|
||||||
|
|
||||||
// log.info("故障事件解析");
|
log.info("故障事件解析");
|
||||||
// if (StateConstant.VEHICLE_STATUS != vehicleData.getVehicleStatus()
|
if (StateConstant.VEHICLE_STATUS != vehicleData.getVehicleStatus()
|
||||||
// || StateConstant.CHARGING_STATUS!=vehicleData.getChgStatus()
|
|| StateConstant.CHARGING_STATUS!=vehicleData.getChgStatus()
|
||||||
// || StateConstant.OPERATING_STATUS!=vehicleData.getOperatingStatus()
|
|| StateConstant.OPERATING_STATUS!=vehicleData.getOperatingStatus()
|
||||||
// || StateConstant.SOC_STATUS!=vehicleData.getSocStatus()
|
|| StateConstant.SOC_STATUS!=vehicleData.getSocStatus()
|
||||||
// || StateConstant.CHARGING_ENERGY_STORAGE_STATUS != vehicleData.getChargingEnergyStorageStatus()
|
|| StateConstant.CHARGING_ENERGY_STORAGE_STATUS != vehicleData.getChargingEnergyStorageStatus()
|
||||||
// || StateConstant.DRIVE_MOTOR_STATUS != vehicleData.getDriveMotorStatus()
|
|| StateConstant.DRIVE_MOTOR_STATUS != vehicleData.getDriveMotorStatus()
|
||||||
// || StateConstant.POSITION_STATUS != vehicleData.getPositionStatus()
|
|| StateConstant.POSITION_STATUS != vehicleData.getPositionStatus()
|
||||||
// || StateConstant.EAS_STATUS != vehicleData.getEasStatus()
|
|| StateConstant.EAS_STATUS != vehicleData.getEasStatus()
|
||||||
// || StateConstant.PTC_STATUS != vehicleData.getPtcStatus()
|
|| StateConstant.PTC_STATUS != vehicleData.getPtcStatus()
|
||||||
// || StateConstant.ABS_STATUS != vehicleData.getAbsStatus()
|
|| StateConstant.ABS_STATUS != vehicleData.getAbsStatus()
|
||||||
// || StateConstant.MCU_STATUS != vehicleData.getMcuStatus()
|
|| StateConstant.MCU_STATUS != vehicleData.getMcuStatus()
|
||||||
// || StateConstant.HEATING_STATUS != vehicleData.getHeatingStatus()
|
|| StateConstant.HEATING_STATUS != vehicleData.getHeatingStatus()
|
||||||
// || StateConstant.BATTERY_STATUS != vehicleData.getBatteryStatus()
|
|| StateConstant.BATTERY_STATUS != vehicleData.getBatteryStatus()
|
||||||
// || StateConstant.BATTERY_INSULATION_STATUS != vehicleData.getBatteryInsulationStatus()
|
|| StateConstant.BATTERY_INSULATION_STATUS != vehicleData.getBatteryInsulationStatus()
|
||||||
// || StateConstant.DCDC_STATUS != vehicleData.getDcdcStatus()
|
|| StateConstant.DCDC_STATUS != vehicleData.getDcdcStatus()
|
||||||
// || StateConstant.CHG_STATUS != vehicleData.getChgStatus()){
|
|| StateConstant.CHG_STATUS != vehicleData.getChgStatus()){
|
||||||
//
|
|
||||||
//
|
|
||||||
// FaultLogs faultLogsAddReq = new FaultLogs();
|
FaultLogs faultLogsAddReq = new FaultLogs();
|
||||||
// faultLogsAddReq.setCarVin(vehicleData.getVin());
|
faultLogsAddReq.setCarVin(vehicleData.getVin());
|
||||||
//
|
|
||||||
// // /**
|
// /**
|
||||||
//
|
|
||||||
//
|
|
||||||
// // * 车辆状态
|
// * 车辆状态
|
||||||
// // */
|
// */
|
||||||
// // private int vehicleStatus ;
|
// private int vehicleStatus ;
|
||||||
//
|
|
||||||
// if (vehicleData.getVehicleStatus()==0){
|
if (vehicleData.getVehicleStatus()==0){
|
||||||
// faultLogsAddReq.setFaultCode("GTB001");
|
faultLogsAddReq.setFaultCode("GTB001");
|
||||||
// faultLogsAddReq.setFaultLevel(3);
|
faultLogsAddReq.setFaultLevel(3);
|
||||||
// }
|
}
|
||||||
// // /**
|
// /**
|
||||||
// // * 充电状态
|
// * 充电状态
|
||||||
// // */
|
// */
|
||||||
// // private int chargingStatus;
|
// private int chargingStatus;
|
||||||
// if (vehicleData.getChargingStatus()==0){
|
if (vehicleData.getChargingStatus()==0){
|
||||||
// faultLogsAddReq.setFaultCode("GTB002");
|
faultLogsAddReq.setFaultCode("GTB002");
|
||||||
// faultLogsAddReq.setFaultLevel(3);
|
faultLogsAddReq.setFaultLevel(3);
|
||||||
// }
|
}
|
||||||
// // /**
|
// /**
|
||||||
// // * 运行状态
|
// * 运行状态
|
||||||
// // */
|
// */
|
||||||
// // private int operatingStatus;
|
// private int operatingStatus;
|
||||||
// if (vehicleData.getOperatingStatus()==0){
|
if (vehicleData.getOperatingStatus()==0){
|
||||||
// faultLogsAddReq.setFaultCode("GTB003");
|
faultLogsAddReq.setFaultCode("GTB003");
|
||||||
// faultLogsAddReq.setFaultLevel(3);
|
faultLogsAddReq.setFaultLevel(3);
|
||||||
// }
|
}
|
||||||
// // /**
|
// /**
|
||||||
// // * SOC
|
// * SOC
|
||||||
// // */
|
// */
|
||||||
// // private int socStatus;
|
// private int socStatus;
|
||||||
// if (vehicleData.getSocStatus()==0){
|
if (vehicleData.getSocStatus()==0){
|
||||||
// faultLogsAddReq.setFaultCode("GTO001");
|
faultLogsAddReq.setFaultCode("GTO001");
|
||||||
// faultLogsAddReq.setFaultLevel(2);
|
faultLogsAddReq.setFaultLevel(2);
|
||||||
// }
|
}
|
||||||
// //
|
//
|
||||||
// //
|
//
|
||||||
// //GTO003
|
//GTO003
|
||||||
//
|
|
||||||
// // /**
|
// /**
|
||||||
// // * 可充电储能装置工作状态
|
// * 可充电储能装置工作状态
|
||||||
// // */
|
// */
|
||||||
// // private int chargingEnergyStorageStatus ;
|
// private int chargingEnergyStorageStatus ;
|
||||||
// if (vehicleData.getChargingEnergyStorageStatus()==0){
|
if (vehicleData.getChargingEnergyStorageStatus()==0){
|
||||||
// faultLogsAddReq.setFaultCode("GTO002");
|
faultLogsAddReq.setFaultCode("GTO002");
|
||||||
// faultLogsAddReq.setFaultLevel(2);
|
faultLogsAddReq.setFaultLevel(2);
|
||||||
// }
|
}
|
||||||
// // /**
|
// /**
|
||||||
// // * 驱动电机状态
|
// * 驱动电机状态
|
||||||
// // */
|
// */
|
||||||
// // private int driveMotorStatus ;
|
// private int driveMotorStatus ;
|
||||||
// if (vehicleData.getDriveMotorStatus()==0){
|
if (vehicleData.getDriveMotorStatus()==0){
|
||||||
// faultLogsAddReq.setFaultCode("GT0003");
|
faultLogsAddReq.setFaultCode("GT0003");
|
||||||
// faultLogsAddReq.setFaultLevel(2);
|
faultLogsAddReq.setFaultLevel(2);
|
||||||
// }
|
}
|
||||||
// // /**
|
// /**
|
||||||
// // * 定位是否有效
|
// * 定位是否有效
|
||||||
// // */
|
// */
|
||||||
// // private int positionStatus ;
|
// private int positionStatus ;
|
||||||
// if (vehicleData.getPositionStatus()==0){
|
if (vehicleData.getPositionStatus()==0){
|
||||||
// faultLogsAddReq.setFaultCode("GT0004");
|
faultLogsAddReq.setFaultCode("GT0004");
|
||||||
// faultLogsAddReq.setFaultLevel(2);
|
faultLogsAddReq.setFaultLevel(2);
|
||||||
// } //GTO004
|
} //GTO004
|
||||||
// //GTO005
|
//GTO005
|
||||||
// //GTO006
|
//GTO006
|
||||||
// //GTO007
|
//GTO007
|
||||||
// // /**
|
// /**
|
||||||
// // * EAS(汽车防盗系统)状态
|
// * EAS(汽车防盗系统)状态
|
||||||
// // */
|
// */
|
||||||
// // private int easStatus ;
|
// private int easStatus ;
|
||||||
// if (vehicleData.getEasStatus()==0){
|
if (vehicleData.getEasStatus()==0){
|
||||||
// faultLogsAddReq.setFaultCode("GTO005");
|
faultLogsAddReq.setFaultCode("GTO005");
|
||||||
// faultLogsAddReq.setFaultLevel(2);
|
faultLogsAddReq.setFaultLevel(2);
|
||||||
// }
|
}
|
||||||
// // /**
|
// /**
|
||||||
// // * PTC(电动加热器)状态
|
// * PTC(电动加热器)状态
|
||||||
// // */
|
// */
|
||||||
// // private int ptcStatus ;
|
// private int ptcStatus ;
|
||||||
// if (vehicleData.getPtcStatus()==0){
|
if (vehicleData.getPtcStatus()==0){
|
||||||
//
|
|
||||||
// faultLogsAddReq.setFaultCode("GTO006");
|
faultLogsAddReq.setFaultCode("GTO006");
|
||||||
// faultLogsAddReq.setFaultLevel(2);
|
faultLogsAddReq.setFaultLevel(2);
|
||||||
// }
|
}
|
||||||
// // /**
|
// /**
|
||||||
// // * EPS(电动助力系统)状态
|
// * EPS(电动助力系统)状态
|
||||||
// // */
|
// */
|
||||||
// // private int epsStatus ;
|
// private int epsStatus ;
|
||||||
// if (vehicleData.getEpsStatus()==0){
|
if (vehicleData.getEpsStatus()==0){
|
||||||
//
|
|
||||||
// faultLogsAddReq.setFaultCode("GTO007");
|
faultLogsAddReq.setFaultCode("GTO007");
|
||||||
// faultLogsAddReq.setFaultLevel(2);
|
faultLogsAddReq.setFaultLevel(2);
|
||||||
// }
|
}
|
||||||
// // /**
|
// /**
|
||||||
// // * ABS(防抱死)状态
|
// * ABS(防抱死)状态
|
||||||
// // */
|
// */
|
||||||
// // private int absStatus ;
|
// private int absStatus ;
|
||||||
// if (vehicleData.getAbsStatus()==0){
|
if (vehicleData.getAbsStatus()==0){
|
||||||
//
|
|
||||||
// faultLogsAddReq.setFaultCode("GTX001");
|
faultLogsAddReq.setFaultCode("GTX001");
|
||||||
// faultLogsAddReq.setFaultLevel(1);
|
faultLogsAddReq.setFaultLevel(1);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // /**
|
// /**
|
||||||
// // * MCU(电机/逆变器)状态
|
// * MCU(电机/逆变器)状态
|
||||||
// // */
|
// */
|
||||||
// // private int mcuStatus ;
|
// private int mcuStatus ;
|
||||||
// if (vehicleData.getMcuStatus()==0){
|
if (vehicleData.getMcuStatus()==0){
|
||||||
//
|
|
||||||
// faultLogsAddReq.setFaultCode("GTX002");
|
faultLogsAddReq.setFaultCode("GTX002");
|
||||||
// faultLogsAddReq.setFaultLevel(1);
|
faultLogsAddReq.setFaultLevel(1);
|
||||||
// }
|
}
|
||||||
// // /**
|
// /**
|
||||||
// // * 动力电池加热状态
|
// * 动力电池加热状态
|
||||||
// // */
|
// */
|
||||||
// // private int heatingStatus ;
|
// private int heatingStatus ;
|
||||||
// if (vehicleData.getHeatingStatus()==0){
|
if (vehicleData.getHeatingStatus()==0){
|
||||||
//
|
|
||||||
// faultLogsAddReq.setFaultCode("GTX003");
|
faultLogsAddReq.setFaultCode("GTX003");
|
||||||
// faultLogsAddReq.setFaultLevel(1);
|
faultLogsAddReq.setFaultLevel(1);
|
||||||
// }
|
}
|
||||||
// // /**
|
// /**
|
||||||
// // * 动力电池当前状态
|
// * 动力电池当前状态
|
||||||
// // */
|
// */
|
||||||
// // private int batteryStatus ;
|
// private int batteryStatus ;
|
||||||
// if (vehicleData.getBatteryStatus()==0){
|
if (vehicleData.getBatteryStatus()==0){
|
||||||
//
|
|
||||||
// faultLogsAddReq.setFaultCode("GTX004");
|
faultLogsAddReq.setFaultCode("GTX004");
|
||||||
// faultLogsAddReq.setFaultLevel(1);
|
faultLogsAddReq.setFaultLevel(1);
|
||||||
// }
|
}
|
||||||
// // /**
|
// /**
|
||||||
// // * 动力电池保温状态
|
// * 动力电池保温状态
|
||||||
// // */
|
// */
|
||||||
// // private int batteryInsulationStatus ;
|
// private int batteryInsulationStatus ;
|
||||||
// if (vehicleData.getBatteryInsulationStatus()==0){
|
if (vehicleData.getBatteryInsulationStatus()==0){
|
||||||
//
|
|
||||||
// faultLogsAddReq.setFaultCode("GTX005");
|
faultLogsAddReq.setFaultCode("GTX005");
|
||||||
// faultLogsAddReq.setFaultLevel(1);
|
faultLogsAddReq.setFaultLevel(1);
|
||||||
// }
|
}
|
||||||
// // /**
|
// /**
|
||||||
// // * DCDC(电力交换系统)状态
|
// * DCDC(电力交换系统)状态
|
||||||
// // */
|
// */
|
||||||
// // private int dcdcStatus ;
|
// private int dcdcStatus ;
|
||||||
// if (vehicleData.getDcdcStatus()==0){
|
if (vehicleData.getDcdcStatus()==0){
|
||||||
//
|
|
||||||
// faultLogsAddReq.setFaultCode("GTX006");
|
faultLogsAddReq.setFaultCode("GTX006");
|
||||||
// faultLogsAddReq.setFaultLevel(1);
|
faultLogsAddReq.setFaultLevel(1);
|
||||||
// }
|
}
|
||||||
// // /**
|
// /**
|
||||||
// // * CHG(充电机)状态
|
// * CHG(充电机)状态
|
||||||
// // */
|
// */
|
||||||
// // private int chgStatus ;
|
// private int chgStatus ;
|
||||||
// if (vehicleData.getChgStatus()==0){
|
if (vehicleData.getChgStatus()==0){
|
||||||
//
|
|
||||||
// faultLogsAddReq.setFaultCode("GTX007");
|
faultLogsAddReq.setFaultCode("GTX007");
|
||||||
// faultLogsAddReq.setFaultLevel(1);
|
faultLogsAddReq.setFaultLevel(1);
|
||||||
// }
|
}
|
||||||
//// rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE, RabbitMqConfig.KEY,faultLogsAddReq, message -> {
|
// rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE, RabbitMqConfig.KEY,faultLogsAddReq, message -> {
|
||||||
//// message.getMessageProperties().setMessageId(UUID.randomUUID().toString());
|
// message.getMessageProperties().setMessageId(UUID.randomUUID().toString());
|
||||||
//// return message;
|
// return message;
|
||||||
//// } ,new CorrelationData(UUID.randomUUID().toString()));
|
// } ,new CorrelationData(UUID.randomUUID().toString()));
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// String key = "breakdown";
|
String key = "breakdown";
|
||||||
// String value = JSON.toJSONString(faultLogsAddReq);
|
String value = JSON.toJSONString(faultLogsAddReq);
|
||||||
// redisTemplate.opsForSet().add(key, value);
|
redisTemplate.opsForSet().add(key, value);
|
||||||
// long expireTime = 30;
|
long expireTime = 30;
|
||||||
// redisTemplate.expire(key, expireTime, TimeUnit.MINUTES);
|
redisTemplate.expire(key, expireTime, TimeUnit.MINUTES);
|
||||||
// }
|
}
|
||||||
|
|
||||||
log.info("故障事件结束");
|
log.info("故障事件结束");
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ package com.muyu.analyze.service.impl;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.muyu.analyze.mapper.VehicleMapper;
|
import com.muyu.analyze.mapper.VehicleMapper;
|
||||||
import com.muyu.analyze.service.VehicleService;
|
import com.muyu.analyze.service.VehicleService;
|
||||||
|
import com.muyu.business.remote.RemoteAlarmLogsService;
|
||||||
import com.muyu.system.common.domain.Car;
|
import com.muyu.system.common.domain.Car;
|
||||||
import com.muyu.system.common.domain.Fence;
|
import com.muyu.system.common.domain.Fence;
|
||||||
import com.muyu.system.common.domain.VehicleData;
|
import com.muyu.system.common.domain.VehicleData;
|
||||||
|
@ -14,6 +15,7 @@ import org.springframework.stereotype.Service;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static java.lang.Double.parseDouble;
|
import static java.lang.Double.parseDouble;
|
||||||
|
|
||||||
|
@ -33,6 +35,8 @@ public class FenceAlarmImpl implements VehicleService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private VehicleMapper vehicleMapper;
|
private VehicleMapper vehicleMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void eventResolution(VehicleData analyze) {
|
public void eventResolution(VehicleData analyze) {
|
||||||
|
|
||||||
|
@ -66,6 +70,14 @@ public class FenceAlarmImpl implements VehicleService {
|
||||||
System.out.println("车辆vin:"+vin+"------在安全区");
|
System.out.println("车辆vin:"+vin+"------在安全区");
|
||||||
}else {
|
}else {
|
||||||
System.out.println("车辆vin:"+vin+"------驶出围栏---报警");
|
System.out.println("车辆vin:"+vin+"------驶出围栏---报警");
|
||||||
|
|
||||||
|
String key = "fenceType1";
|
||||||
|
String value = JSON.toJSONString(fence);
|
||||||
|
redisTemplate.opsForSet().add(key, value);
|
||||||
|
long expireTime = 30;
|
||||||
|
redisTemplate.expire(key, expireTime, TimeUnit.MINUTES);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +85,13 @@ public class FenceAlarmImpl implements VehicleService {
|
||||||
if (fence.getFenceType().equals("驶入")){
|
if (fence.getFenceType().equals("驶入")){
|
||||||
if (withinFence){
|
if (withinFence){
|
||||||
System.out.println("车辆vin:"+vin+"------驶入禁行区----报警");
|
System.out.println("车辆vin:"+vin+"------驶入禁行区----报警");
|
||||||
|
|
||||||
|
String key = "fenceType1";
|
||||||
|
String value = JSON.toJSONString(fence);
|
||||||
|
redisTemplate.opsForSet().add(key, value);
|
||||||
|
long expireTime = 30;
|
||||||
|
redisTemplate.expire(key, expireTime, TimeUnit.MINUTES);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
System.out.println("车辆vin:"+vin+"------在安全区");
|
System.out.println("车辆vin:"+vin+"------在安全区");
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>muyu-business-common</artifactId>
|
<artifactId>muyu-business-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-system-common</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.muyu.business.domain.req.*;
|
||||||
import com.muyu.business.remote.factory.*;
|
import com.muyu.business.remote.factory.*;
|
||||||
import com.muyu.common.core.constant.*;
|
import com.muyu.common.core.constant.*;
|
||||||
import com.muyu.common.core.domain.*;
|
import com.muyu.common.core.domain.*;
|
||||||
|
import com.muyu.system.common.domain.Fence;
|
||||||
import org.springframework.cloud.openfeign.*;
|
import org.springframework.cloud.openfeign.*;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -20,4 +21,13 @@ public interface RemoteAlarmLogsService {
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Result add(@RequestBody AlarmLogsAddReq alarmLogsAddReq, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;
|
public Result add(@RequestBody AlarmLogsAddReq alarmLogsAddReq, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.business.remote.factory;
|
||||||
import com.muyu.business.domain.req.*;
|
import com.muyu.business.domain.req.*;
|
||||||
import com.muyu.business.remote.*;
|
import com.muyu.business.remote.*;
|
||||||
import com.muyu.common.core.domain.*;
|
import com.muyu.common.core.domain.*;
|
||||||
|
import com.muyu.system.common.domain.Fence;
|
||||||
import org.slf4j.*;
|
import org.slf4j.*;
|
||||||
import org.springframework.cloud.openfeign.*;
|
import org.springframework.cloud.openfeign.*;
|
||||||
import org.springframework.stereotype.*;
|
import org.springframework.stereotype.*;
|
||||||
|
@ -26,6 +27,8 @@ public class RemoteAlarmLogsFallbackFactory implements FallbackFactory<RemoteAla
|
||||||
public Result add(AlarmLogsAddReq alarmLogsAddReq, String source) {
|
public Result add(AlarmLogsAddReq alarmLogsAddReq, String source) {
|
||||||
return Result.error("报存报警日志失败:" + throwable.getMessage());
|
return Result.error("报存报警日志失败:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ProjectName: colud-vehicles
|
* @ProjectName: colud-vehicles
|
||||||
|
@ -19,6 +20,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
@EnableCustomSwagger2
|
@EnableCustomSwagger2
|
||||||
@EnableRyFeignClients
|
@EnableRyFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@EnableScheduling
|
||||||
@MapperScan("com.muyu.business.mapper")
|
@MapperScan("com.muyu.business.mapper")
|
||||||
public class MuYuBusinessApplication {
|
public class MuYuBusinessApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
|
@ -10,8 +10,10 @@ import com.muyu.common.core.web.page.*;
|
||||||
import com.muyu.common.log.annotation.*;
|
import com.muyu.common.log.annotation.*;
|
||||||
import com.muyu.common.log.enums.*;
|
import com.muyu.common.log.enums.*;
|
||||||
import com.muyu.common.security.annotation.*;
|
import com.muyu.common.security.annotation.*;
|
||||||
|
import com.muyu.system.common.domain.Fence;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.springframework.beans.factory.annotation.*;
|
import org.springframework.beans.factory.annotation.*;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -56,6 +58,11 @@ public class AlarmLogsController extends BaseController {
|
||||||
return toAjax(alarmLogsService.insertAlarmLogs(AlarmLogs.alarmLogsAddReq(alarmLogsAddReq)));
|
return toAjax(alarmLogsService.insertAlarmLogs(AlarmLogs.alarmLogsAddReq(alarmLogsAddReq)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Scheduled(cron = "0/10 * * * * * ")
|
||||||
|
public void alarmLogsService() {
|
||||||
|
alarmLogsService.alarmLogsService();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取报警日志详细信息
|
* 获取报警日志详细信息
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.muyu.common.log.enums.*;
|
||||||
import com.muyu.common.security.annotation.*;
|
import com.muyu.common.security.annotation.*;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.springframework.beans.factory.annotation.*;
|
import org.springframework.beans.factory.annotation.*;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.validation.annotation.*;
|
import org.springframework.validation.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -86,4 +87,9 @@ public class FaultLogsController extends BaseController {
|
||||||
public Result remove(@ApiParam(value = "故障日志Id", required = true) @PathVariable("logIds") Long[] logIds) {
|
public Result remove(@ApiParam(value = "故障日志Id", required = true) @PathVariable("logIds") Long[] logIds) {
|
||||||
return toAjax(faultLogsService.deleteFaultLogsByIds(logIds));
|
return toAjax(faultLogsService.deleteFaultLogsByIds(logIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Scheduled(cron = "0/10 * * * * * ")
|
||||||
|
public void faultLogsService() {
|
||||||
|
faultLogsService.faultLogsService();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.*;
|
||||||
import com.baomidou.mybatisplus.core.mapper.*;
|
import com.baomidou.mybatisplus.core.mapper.*;
|
||||||
import com.muyu.business.domain.*;
|
import com.muyu.business.domain.*;
|
||||||
import com.muyu.business.domain.res.*;
|
import com.muyu.business.domain.res.*;
|
||||||
|
import com.muyu.system.common.domain.Fence;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -21,4 +22,9 @@ public interface AlarmLogsMapper extends BaseMapper<AlarmLogs> {
|
||||||
* @return 报警日志集合
|
* @return 报警日志集合
|
||||||
*/
|
*/
|
||||||
List<AlarmLogs> selectAlarmLogsList(LambdaQueryWrapper<AlarmLogs> wrapper);
|
List<AlarmLogs> selectAlarmLogsList(LambdaQueryWrapper<AlarmLogs> wrapper);
|
||||||
|
|
||||||
|
void alarmLogsService(Fence fence);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.business.mapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.*;
|
import com.baomidou.mybatisplus.core.conditions.query.*;
|
||||||
import com.baomidou.mybatisplus.core.mapper.*;
|
import com.baomidou.mybatisplus.core.mapper.*;
|
||||||
import com.muyu.business.domain.*;
|
import com.muyu.business.domain.*;
|
||||||
|
import com.muyu.business.domain.req.FaultLogsAddReq;
|
||||||
import com.muyu.business.domain.res.*;
|
import com.muyu.business.domain.res.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -21,4 +22,8 @@ public interface FaultLogsMapper extends BaseMapper<FaultLogs> {
|
||||||
* @return 故障日志集合
|
* @return 故障日志集合
|
||||||
*/
|
*/
|
||||||
List<FaultLogsResponse> selectFaultLogsList(LambdaQueryWrapper<FaultLogs> wrapper);
|
List<FaultLogsResponse> selectFaultLogsList(LambdaQueryWrapper<FaultLogs> wrapper);
|
||||||
|
|
||||||
|
void FaultLogsService(FaultLogsAddReq faultLogsAddReq);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.*;
|
||||||
import com.muyu.business.domain.*;
|
import com.muyu.business.domain.*;
|
||||||
import com.muyu.business.domain.req.*;
|
import com.muyu.business.domain.req.*;
|
||||||
import com.muyu.business.domain.res.*;
|
import com.muyu.business.domain.res.*;
|
||||||
|
import com.muyu.system.common.domain.Fence;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -60,4 +61,8 @@ public interface AlarmLogsService extends IService<AlarmLogs> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteAlarmLogsByIds(Long[] alarmIds);
|
int deleteAlarmLogsByIds(Long[] alarmIds);
|
||||||
|
|
||||||
|
void alarmLogsService();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,4 +61,9 @@ public interface FaultLogsService extends IService<FaultLogs> {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int deleteFaultLogsByIds(Long[] logIds);
|
int deleteFaultLogsByIds(Long[] logIds);
|
||||||
|
|
||||||
|
void faultLogsService();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.business.service.impl;
|
package com.muyu.business.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.*;
|
import com.baomidou.mybatisplus.core.conditions.query.*;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.support.*;
|
import com.baomidou.mybatisplus.core.toolkit.support.*;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.*;
|
import com.baomidou.mybatisplus.extension.service.impl.*;
|
||||||
|
@ -10,10 +11,13 @@ import com.muyu.business.mapper.*;
|
||||||
import com.muyu.business.service.*;
|
import com.muyu.business.service.*;
|
||||||
import com.muyu.common.core.utils.*;
|
import com.muyu.common.core.utils.*;
|
||||||
import com.muyu.common.security.utils.*;
|
import com.muyu.common.security.utils.*;
|
||||||
|
import com.muyu.system.common.domain.Fence;
|
||||||
import org.springframework.beans.factory.annotation.*;
|
import org.springframework.beans.factory.annotation.*;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.*;
|
import org.springframework.stereotype.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报警日志Service业务层处理
|
* 报警日志Service业务层处理
|
||||||
|
@ -30,6 +34,8 @@ public class AlarmLogsServiceImpl extends ServiceImpl<AlarmLogsMapper, AlarmLogs
|
||||||
*/
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private AlarmLogsMapper alarmLogsMapper;
|
private AlarmLogsMapper alarmLogsMapper;
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate redisTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AlarmLogs> selectAlarmLogsList(AlarmLogsReq alarmLogsReq) {
|
public List<AlarmLogs> selectAlarmLogsList(AlarmLogsReq alarmLogsReq) {
|
||||||
|
@ -68,4 +74,31 @@ public class AlarmLogsServiceImpl extends ServiceImpl<AlarmLogsMapper, AlarmLogs
|
||||||
public int deleteAlarmLogsByIds(Long[] alarmIds) {
|
public int deleteAlarmLogsByIds(Long[] alarmIds) {
|
||||||
return alarmLogsMapper.deleteBatchIds(Arrays.asList(alarmIds));
|
return alarmLogsMapper.deleteBatchIds(Arrays.asList(alarmIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void alarmLogsService() {
|
||||||
|
|
||||||
|
// 获取key对应的Set中所有成员(即序列化后的Fence对象)
|
||||||
|
Set<String> fenceValues = redisTemplate.opsForSet().members("fenceType1");
|
||||||
|
|
||||||
|
// 遍历Set,将每个序列化的Fence对象反序列化为Fence对象
|
||||||
|
for (String serializedFence : fenceValues) {
|
||||||
|
|
||||||
|
Fence fence = JSON.parseObject(serializedFence, Fence.class);
|
||||||
|
// 处理反序列化得到的Fence对象...
|
||||||
|
//车辆vin
|
||||||
|
String carVin = fence.getCarVin();
|
||||||
|
//围栏类型,驶入还是驶出
|
||||||
|
String fenceType = fence.getFenceType();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
alarmLogsMapper.alarmLogsService(fence);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.business.service.impl;
|
package com.muyu.business.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.*;
|
import com.baomidou.mybatisplus.core.conditions.query.*;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.*;
|
import com.baomidou.mybatisplus.extension.service.impl.*;
|
||||||
import com.muyu.business.domain.*;
|
import com.muyu.business.domain.*;
|
||||||
|
@ -9,12 +10,15 @@ import com.muyu.business.mapper.*;
|
||||||
import com.muyu.business.service.*;
|
import com.muyu.business.service.*;
|
||||||
import com.muyu.common.core.utils.*;
|
import com.muyu.common.core.utils.*;
|
||||||
import com.muyu.common.security.utils.*;
|
import com.muyu.common.security.utils.*;
|
||||||
|
import com.muyu.system.common.domain.Fence;
|
||||||
import lombok.extern.slf4j.*;
|
import lombok.extern.slf4j.*;
|
||||||
import org.springframework.beans.factory.annotation.*;
|
import org.springframework.beans.factory.annotation.*;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.*;
|
import org.springframework.stereotype.*;
|
||||||
|
|
||||||
import java.text.*;
|
import java.text.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障日志Service业务层处理
|
* 故障日志Service业务层处理
|
||||||
|
@ -38,6 +42,8 @@ public class FaultLogsServiceImpl extends ServiceImpl<FaultLogsMapper, FaultLogs
|
||||||
*/
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private FaultCodesService faultCodesService;
|
private FaultCodesService faultCodesService;
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate redisTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FaultLogsResponse> selectFaultLogsList(FaultLogsReq faultLogsReq) {
|
public List<FaultLogsResponse> selectFaultLogsList(FaultLogsReq faultLogsReq) {
|
||||||
|
@ -86,4 +92,21 @@ public class FaultLogsServiceImpl extends ServiceImpl<FaultLogsMapper, FaultLogs
|
||||||
public int deleteFaultLogsByIds(Long[] logIds) {
|
public int deleteFaultLogsByIds(Long[] logIds) {
|
||||||
return faultLogsMapper.deleteBatchIds(Arrays.asList(logIds));
|
return faultLogsMapper.deleteBatchIds(Arrays.asList(logIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void faultLogsService() {
|
||||||
|
// 获取key对应的Set中所有成员(即序列化后的Fence对象)
|
||||||
|
Set<String> fenceValues = redisTemplate.opsForSet().members("breakdown");
|
||||||
|
|
||||||
|
// 遍历Set,将每个序列化的Fence对象反序列化为Fence对象
|
||||||
|
for (String serializedFence : fenceValues) {
|
||||||
|
|
||||||
|
FaultLogsAddReq faultLogsAddReq = JSON.parseObject(serializedFence, FaultLogsAddReq.class);
|
||||||
|
|
||||||
|
faultLogsMapper.FaultLogsService(faultLogsAddReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,4 +47,8 @@
|
||||||
<select id="selectAlarmLogsList" resultMap="AlarmLogsResult">
|
<select id="selectAlarmLogsList" resultMap="AlarmLogsResult">
|
||||||
<include refid="selectAlarmLogs"/>
|
<include refid="selectAlarmLogs"/>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="alarmLogsService">
|
||||||
|
INSERT INTO `bwie-cloud`.`alarm_logs` (`car_vin`, `fault_code`, `dispose_time`) VALUES
|
||||||
|
(#{carVin},#{fenceType}, now());
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue