Compare commits
7 Commits
0c71aec748
...
73546a7a5a
Author | SHA1 | Date |
---|---|---|
|
73546a7a5a | |
|
9e8106ab46 | |
|
93ccc7535e | |
|
562deda30a | |
|
ab079c7daf | |
|
ad5626f0af | |
|
f07dc734e4 |
|
@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.util.List;
|
||||
|
||||
@FeignClient(contextId = "remoteVehicleService" ,
|
||||
value = ServiceNameConstants.VEHICLE_SERVICE,
|
||||
value = ServiceNameConstants.BUSINESS_SERVICE,
|
||||
fallbackFactory = RemoteVehicleFallbackFactory.class,
|
||||
path = "/vehicle"
|
||||
)
|
||||
|
|
|
@ -48,6 +48,7 @@ public class RemoteVehicleFallbackFactory implements FallbackFactory<RemoteVehic
|
|||
|
||||
@Override
|
||||
public Result<List<Vehicle>> findByVIN(String vin) {
|
||||
log.error("车辆服务调用失败:"+cause.getMessage());
|
||||
return Result.error("车辆服务调用失败:" + cause.getMessage());
|
||||
}
|
||||
};
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
com.couplet.remote.factory.RemoteVehicleFallbackFactory
|
|
@ -26,8 +26,8 @@ public class ServiceNameConstants {
|
|||
* @param null:
|
||||
* @return null
|
||||
* @author 付凡芮
|
||||
* @description 车辆管理模块
|
||||
* @description couplet-business
|
||||
* @date
|
||||
*/
|
||||
public static final String VEHICLE_SERVICE = "couplet-vehicle";
|
||||
public static final String BUSINESS_SERVICE = "couplet-business";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package com.couplet.common.core.exception.analyze;
|
||||
|
||||
/**
|
||||
* @Author: LiJiaYao
|
||||
* @Date: 2024/4/4
|
||||
* @Description: 解析系统统一异常
|
||||
*/
|
||||
public class AnalyzeException extends RuntimeException{
|
||||
|
||||
private int code;
|
||||
private String message;
|
||||
|
||||
public AnalyzeException(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public AnalyzeException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public AnalyzeException() {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.couplet.analyze.msg.contents;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author: LiJiaYao
|
||||
* @Date: 2024/4/4
|
||||
* @Description:
|
||||
*/
|
||||
@Component
|
||||
public class StateConstant {
|
||||
|
||||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
public static final Integer VEHICLE_STATUS = 0;
|
||||
|
||||
/**
|
||||
* 充电状态
|
||||
*/
|
||||
public static final Integer CHARGING_STATUS = 0;
|
||||
|
||||
/**
|
||||
* 运行状态
|
||||
*/
|
||||
public static final Integer OPERATING_STATUS = 0;
|
||||
|
||||
/**
|
||||
* soc状态
|
||||
*/
|
||||
public static final Integer SOC_STATUS = 0;
|
||||
|
||||
/**
|
||||
* 可充电储能装置工作状态
|
||||
*/
|
||||
public static final Integer CHARGING_ENERGY_STORAGE_STATUS = 0 ;
|
||||
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.couplet.analyze.msg.model;
|
|||
|
||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||
import com.couplet.analyze.msg.service.IncidentService;
|
||||
import com.couplet.common.core.exception.analyze.AnalyzeException;
|
||||
import com.couplet.common.core.utils.SpringUtils;
|
||||
import com.couplet.common.core.utils.uuid.IdUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -108,9 +109,9 @@ public class ModelMessage {
|
|||
});
|
||||
mqttClient.subscribe("test",0);
|
||||
|
||||
Thread.sleep(1000*60*10);
|
||||
Thread.sleep(1000*6*10);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new AnalyzeException("连接断开:"+ e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,38 +1,39 @@
|
|||
//package com.couplet.analyze.msg.service.impl;
|
||||
//
|
||||
//import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||
//import com.couplet.analyze.msg.service.IncidentService;
|
||||
//import com.couplet.common.log.annotation.Log;
|
||||
//import lombok.extern.log4j.Log4j2;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
///**
|
||||
// * @Author: LiJiaYao
|
||||
// * @Date: 2024/4/2
|
||||
// * @Description: 故障事件
|
||||
// */
|
||||
//@Service("breakdown")
|
||||
//@Log4j2
|
||||
//public class BreakdownServiceImpl implements IncidentService {
|
||||
// /**
|
||||
// * 故障事件
|
||||
// *
|
||||
// * @param coupletMsgData
|
||||
// */
|
||||
// @Override
|
||||
// public void incident(CoupletMsgData coupletMsgData) {
|
||||
//
|
||||
// log.info("故障事件开始.....");
|
||||
// log.info("故障事件结束.....");
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return 获取事件名称
|
||||
// */
|
||||
// @Override
|
||||
// public String getName() {
|
||||
// return "breakdown";
|
||||
// }
|
||||
//}
|
||||
package com.couplet.analyze.msg.service.impl;
|
||||
|
||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||
import com.couplet.analyze.msg.service.IncidentService;
|
||||
import com.couplet.common.log.annotation.Log;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: LiJiaYao
|
||||
* @Date: 2024/4/2
|
||||
* @Description: 故障事件
|
||||
*/
|
||||
@Service("breakdown")
|
||||
@Log4j2
|
||||
public class BreakdownServiceImpl implements IncidentService {
|
||||
/**
|
||||
* 故障事件
|
||||
*
|
||||
* @param coupletMsgData
|
||||
*/
|
||||
@Override
|
||||
public void incident(CoupletMsgData coupletMsgData) {
|
||||
|
||||
log.info("故障事件开始.....");
|
||||
|
||||
log.info("故障事件结束.....");
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 获取事件名称
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "breakdown";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,33 +1,40 @@
|
|||
//package com.couplet.analyze.msg.service.impl;
|
||||
//
|
||||
//import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||
//import com.couplet.analyze.msg.service.IncidentService;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
///**
|
||||
// * @Author: LiJiaYao
|
||||
// * @Date: 2024/4/2
|
||||
// * @Description: 电子围栏事件服务实现类
|
||||
// */
|
||||
//@Service("electronic-fence")
|
||||
//public class ElectronicFenceServiceImpl implements IncidentService {
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 电子围栏事件
|
||||
// *
|
||||
// * @param coupletMsgData
|
||||
// */
|
||||
// @Override
|
||||
// public void incident(CoupletMsgData coupletMsgData) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return 电子围栏service 名称
|
||||
// */
|
||||
// @Override
|
||||
// public String getName() {
|
||||
// return "electronic-fence";
|
||||
// }
|
||||
//}
|
||||
package com.couplet.analyze.msg.service.impl;
|
||||
|
||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||
import com.couplet.analyze.msg.service.IncidentService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: LiJiaYao
|
||||
* @Date: 2024/4/2
|
||||
* @Description: 电子围栏事件服务实现类
|
||||
*/
|
||||
@Service("electronic-fence")
|
||||
@Log4j2
|
||||
public class ElectronicFenceServiceImpl implements IncidentService {
|
||||
|
||||
|
||||
/**
|
||||
* 电子围栏事件
|
||||
*
|
||||
* @param coupletMsgData
|
||||
*/
|
||||
@Override
|
||||
public void incident(CoupletMsgData coupletMsgData) {
|
||||
|
||||
log.info("电子围栏事件开始.......");
|
||||
log.info("电子围栏事件结束.......");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 电子围栏service 名称
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "electronic-fence";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,33 +1,41 @@
|
|||
//package com.couplet.analyze.msg.service.impl;
|
||||
//
|
||||
//import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||
//import com.couplet.analyze.msg.service.IncidentService;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
///**
|
||||
// * @Author: LiJiaYao
|
||||
// * @Date: 2024/4/2
|
||||
// * @Description: 实时数据事件
|
||||
// */
|
||||
//@Service("real-time-data")
|
||||
//public class RealTimeDataServiceImpl implements IncidentService {
|
||||
//
|
||||
// /**
|
||||
// * 实时数据事件
|
||||
// *
|
||||
// * @param coupletMsgData
|
||||
// */
|
||||
// @Override
|
||||
// public void incident(CoupletMsgData coupletMsgData) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 实时数据事件
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public String getName() {
|
||||
// return "real-time-data";
|
||||
// }
|
||||
//}
|
||||
package com.couplet.analyze.msg.service.impl;
|
||||
|
||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||
import com.couplet.analyze.msg.service.IncidentService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: LiJiaYao
|
||||
* @Date: 2024/4/2
|
||||
* @Description: 实时数据事件
|
||||
*/
|
||||
@Service("real-time-data")
|
||||
@Log4j2
|
||||
public class RealTimeDataServiceImpl implements IncidentService {
|
||||
|
||||
/**
|
||||
* 实时数据事件
|
||||
*
|
||||
* @param coupletMsgData
|
||||
*/
|
||||
@Override
|
||||
public void incident(CoupletMsgData coupletMsgData) {
|
||||
|
||||
log.info("实时数据事件开始.....");
|
||||
|
||||
|
||||
|
||||
log.info("实时数据事件结束.....");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 实时数据事件
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "real-time-data";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
com.couplet.analyze.msg.config.RabbitMQConfig
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
|
||||
<insert id="reportMapper">
|
||||
INSERT INTO `vehicle-resolver`.`resolver_report_data`
|
||||
INSERT INTO `couplet-cloud`.`couplet_msg_data`
|
||||
(`vin`, `create_time`, `longitude`, `latitude`,
|
||||
`speed`, `mileage`, `voltage`, `current`, `resistance`, `gear`,
|
||||
`acceleration_pedal`, `fuel_consumption_rate`,
|
||||
|
@ -18,7 +18,7 @@
|
|||
`single_battery_max_voltage`, `single_battery_min_voltage`,
|
||||
`single_battery_max_temperature`, `single_battery_min_temperature`,
|
||||
`available_battery_capacity`, `vehicle_status`, `charging_status`,
|
||||
`operatingStatus`, `soc_status`, `charging_energy_storage_status`,
|
||||
`operating_status`, `soc_status`, `charging_energy_storage_status`,
|
||||
`drive_motor_status`, `position_status`, `eas_status`, `ptc_status`,
|
||||
`eps_status`, `abs_status`, `mcu_status`, `heating_status`, `battery_status`,
|
||||
`battery_insulation_status`, `dcdc_status`, `chg_status`, `brake_pedal`)
|
||||
|
|
|
@ -19,6 +19,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
public class CoupletMqApplatcaion {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CoupletMqApplatcaion.class, args);
|
||||
System.out.println("获取报文、RabbitMQ模块启动成功");
|
||||
System.out.println("RabbitMQ模块启动成功");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,9 +18,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
//@EnableFeignClients
|
||||
public class OnlineApplication {
|
||||
public class CoupletOnlineApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(OnlineApplication.class);
|
||||
SpringApplication.run(CoupletOnlineApplication.class);
|
||||
System.out.println("车辆上线模块启动成功");
|
||||
}
|
||||
}
|
|
@ -4,8 +4,7 @@ server:
|
|||
|
||||
# Spring
|
||||
spring:
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
application:
|
||||
# 应用名称
|
||||
name: couplet-system
|
||||
|
|
Loading…
Reference in New Issue