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