Merge branch 'server_five_xiaoyao' into server_five_dongxiaodong
# Conflicts: # couplet-common/couplet-common-core/src/main/java/com/couplet/common/core/constant/ServiceNameConstants.java # couplet-modules/couplet-analyze/couplet-analyze-msg/pom.xmlserver_five_liuyunhu
commit
976f35f212
|
@ -84,10 +84,11 @@ public class Fence extends BaseEntity{
|
|||
|
||||
private Integer alarmStatus;
|
||||
|
||||
@TableField(exist = false)
|
||||
|
||||
/**
|
||||
* 标识
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer logoId;
|
||||
@TableField(exist = false)
|
||||
private String logoName;
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.couplet.common.domain.request;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author fufanrui
|
||||
* @version 1.0
|
||||
* @description: 车辆实时数据请求参数
|
||||
* @date 2024/4/4 14:35
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class RealTimeDataRequest {
|
||||
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String vin;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -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
|
|
@ -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,33 @@
|
|||
package com.couplet.common.redis.configure;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
|
||||
/**
|
||||
* @Author: LiJiaYao
|
||||
* @Date: 2024/4/4
|
||||
* @Description: redis监听配置
|
||||
*/
|
||||
@Configuration
|
||||
public class RedisListenerConfig {
|
||||
|
||||
@Bean
|
||||
RedisMessageListenerContainer listenerContainer(RedisConnectionFactory redisConnectionFactory) {
|
||||
|
||||
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
|
||||
container.setConnectionFactory(redisConnectionFactory);
|
||||
return container;
|
||||
}
|
||||
|
||||
@Bean
|
||||
KeyExpirationEventMessageListener redisKeyExpirationListener(RedisMessageListenerContainer listenerContainer) {
|
||||
return new KeyExpirationEventMessageListener(listenerContainer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -86,11 +86,13 @@
|
|||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||
<version>1.2.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- RabbitMQ依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-modules-mq</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-business</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
|||
* @date 2024/4/2 8:39
|
||||
* @description
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@SpringBootApplication(scanBasePackages = "com.couplet")
|
||||
@EnableScheduling
|
||||
@EnableFeignClients(basePackages = "com.couplet.**")
|
||||
public class CoupletMsgApplication {
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
package com.couplet.analyze.msg.consumer;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||
import com.couplet.analyze.msg.mapper.IncidentMapper;
|
||||
import com.couplet.analyze.msg.service.impl.realTimeData.RealTimeJudge;
|
||||
import com.couplet.common.domain.request.RealTimeDataRequest;
|
||||
import com.rabbitmq.client.Channel;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @Author: LiJiaYao
|
||||
* @Date: 2024/4/4
|
||||
* @Description:
|
||||
*/
|
||||
@Log4j2
|
||||
@Component
|
||||
@RabbitListener(queues = "vinQueue")
|
||||
public class MsgConsumer {
|
||||
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
@Autowired
|
||||
private IncidentMapper incidentMapper;
|
||||
private static final Map<String, Set<Long>> setMap = new HashMap<>();
|
||||
|
||||
|
||||
@RabbitHandler
|
||||
public void realTimeDataConsumer(RealTimeDataRequest realTimeDataRequest, Channel channel, Message message) throws IOException {
|
||||
|
||||
log.info("消息进入队列,传入的数据是:[{}]", realTimeDataRequest);
|
||||
|
||||
String messageId = message.getMessageProperties().getMessageId();
|
||||
long deliveryTag = message.getMessageProperties().getDeliveryTag();
|
||||
if (!redisTemplate.hasKey("消息不丢失:" + messageId)) {
|
||||
redisTemplate.opsForValue().set("消息不丢失:" + messageId, "" + deliveryTag, 1, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
Long add = redisTemplate.opsForSet().add("消息不重复:" + messageId, messageId);
|
||||
redisTemplate.expire("消息不重复:" + messageId, 5, TimeUnit.MINUTES);
|
||||
try {
|
||||
if (0 < add) {
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(String.valueOf(realTimeDataRequest));
|
||||
String vin = jsonObject.getString("vin");
|
||||
Long userId = jsonObject.getLong("userId");
|
||||
RealTimeDataRequest request = new RealTimeDataRequest();
|
||||
request.setVin(vin);
|
||||
request.setUserId(userId);
|
||||
RealTimeJudge.addRealTime(request);
|
||||
//判断车辆是否有实时数据,如果没有则删除数据
|
||||
if (RealTimeJudge.isJudge(realTimeDataRequest.getVin())){
|
||||
log.info("开始实时数据传输:[{}]",realTimeDataRequest.getVin());
|
||||
}
|
||||
CoupletMsgData incident = incidentMapper.queryByIncident(realTimeDataRequest.getVin());
|
||||
if (incident == null){
|
||||
log.error("没有数据......");
|
||||
}
|
||||
redisTemplate.opsForList().rightPush("coupletMsgData", JSON.toJSONString(incident));
|
||||
|
||||
channel.basicAck(deliveryTag, false);
|
||||
} else {
|
||||
log.error("消息不能重复消费:[{}]", realTimeDataRequest);
|
||||
channel.basicReject(deliveryTag, false);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
log.error("消息未进入队列,传入的信息是:【{}】", realTimeDataRequest);
|
||||
String s = redisTemplate.opsForValue().get("消息不丢失:" + messageId);
|
||||
|
||||
Long o = Long.valueOf(s);
|
||||
if (deliveryTag == o + 2) {
|
||||
log.error("消息已丢失,无法传入的信息是:【{}】", realTimeDataRequest);
|
||||
channel.basicNack(deliveryTag, false, false);
|
||||
} else {
|
||||
log.error("消息已丢失,已再次传入的信息是:【{}】", realTimeDataRequest);
|
||||
channel.basicNack(deliveryTag, true, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.couplet.analyze.msg.contents;
|
||||
|
||||
import io.swagger.models.auth.In;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author: LiJiaYao
|
||||
* @Date: 2024/4/4
|
||||
* @Description:
|
||||
*/
|
||||
@Component
|
||||
public class StateConstant {
|
||||
|
||||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
public static final Integer VEHICLE_STATUS = 1;
|
||||
|
||||
/**
|
||||
* 充电状态
|
||||
*/
|
||||
public static final Integer CHARGING_STATUS = 1;
|
||||
|
||||
/**
|
||||
* 运行状态
|
||||
*/
|
||||
public static final Integer OPERATING_STATUS = 1;
|
||||
|
||||
/**
|
||||
* soc状态
|
||||
*/
|
||||
public static final Integer SOC_STATUS = 1;
|
||||
|
||||
/**
|
||||
* 可充电储能装置工作状态
|
||||
*/
|
||||
public static final Integer CHARGING_ENERGY_STORAGE_STATUS = 1;
|
||||
|
||||
/**
|
||||
* 驱动电机状态
|
||||
*/
|
||||
public static final Integer DRIVE_MOTOR_STATUS = 1;
|
||||
|
||||
/**
|
||||
* 定位是否有效
|
||||
*/
|
||||
public static final Integer POSITION_STATUS = 1;
|
||||
|
||||
/**
|
||||
* EAS(汽车防盗系统)状态
|
||||
*/
|
||||
public static final Integer EAS_STATUS = 1;
|
||||
|
||||
/**
|
||||
* PTC(电动加热器)状态
|
||||
*/
|
||||
public static final Integer PTC_STATUS = 1;
|
||||
|
||||
/**
|
||||
* ABS(防抱死)状态
|
||||
*/
|
||||
public static final Integer ABS_STATUS = 1;
|
||||
|
||||
/**
|
||||
* MCU(电机/逆变器)状态
|
||||
*/
|
||||
public static final Integer MCU_STATUS = 1;
|
||||
/**
|
||||
* 动力电池加热状态
|
||||
*/
|
||||
public static final Integer HEATING_STATUS = 1;
|
||||
/**
|
||||
* 动力电池当前状态
|
||||
*/
|
||||
public static final Integer BATTERY_STATUS = 1;
|
||||
/**
|
||||
* 动力电池保温状态
|
||||
*/
|
||||
public static final Integer BATTERY_INSULATION_STATUS = 1;
|
||||
/**
|
||||
* DCDC(电力交换系统) 状态
|
||||
*/
|
||||
public static final Integer DCDC_STATUS = 1;
|
||||
/**
|
||||
* CHG(充电机)状态
|
||||
*/
|
||||
public static final Integer CHG_STATUS = 1;
|
||||
|
||||
}
|
|
@ -15,4 +15,11 @@ public interface IncidentMapper {
|
|||
* @param coupletMsgData
|
||||
*/
|
||||
public void reportMapper(CoupletMsgData coupletMsgData);
|
||||
|
||||
/**
|
||||
* 查询是否存在该vin
|
||||
*/
|
||||
// CoupletMsgData queryByIncident(RealTimeDataRequest realTimeDataRequest);
|
||||
CoupletMsgData queryByIncident(String vin);
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -110,7 +111,7 @@ public class ModelMessage {
|
|||
|
||||
Thread.sleep(1000*60*10);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new AnalyzeException("连接断开:"+ e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.couplet.analyze.msg.service;
|
|||
|
||||
import com.couplet.analyze.msg.contents.MsgContent;
|
||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||
import com.couplet.common.domain.request.RealTimeDataRequest;
|
||||
|
||||
/**
|
||||
* @Author: LiJiaYao
|
||||
|
@ -25,4 +26,5 @@ public interface IncidentService {
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,19 +1,43 @@
|
|||
package com.couplet.analyze.msg.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.couplet.analyze.msg.contents.StateConstant;
|
||||
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.aspectj.bridge.Message;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @Author: LiJiaYao
|
||||
* @Date: 2024/4/2
|
||||
* @Description: 故障事件
|
||||
*/
|
||||
@Service("breakdown")
|
||||
@Log4j2
|
||||
public class BreakdownServiceImpl implements IncidentService {
|
||||
public class BreakdownServiceImpl extends KeyExpirationEventMessageListener implements IncidentService {
|
||||
|
||||
/**
|
||||
* 设置redis存储
|
||||
*/
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(BreakdownServiceImpl.class);
|
||||
|
||||
public BreakdownServiceImpl(RedisMessageListenerContainer listenerContainer) {
|
||||
super(listenerContainer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 故障事件
|
||||
*
|
||||
|
@ -23,10 +47,36 @@ public class BreakdownServiceImpl implements IncidentService {
|
|||
public void incident(CoupletMsgData coupletMsgData) {
|
||||
|
||||
log.info("故障事件开始.....");
|
||||
log.info("故障事件结束.....");
|
||||
long l = System.currentTimeMillis();
|
||||
log.info("开始时间是:"+l);
|
||||
if (StateConstant.VEHICLE_STATUS != coupletMsgData.getVehicleStatus()
|
||||
|| StateConstant.CHARGING_STATUS!=coupletMsgData.getChgStatus()
|
||||
|| StateConstant.OPERATING_STATUS!=coupletMsgData.getOperatingStatus()
|
||||
|| StateConstant.SOC_STATUS!=coupletMsgData.getSocStatus()
|
||||
|| StateConstant.CHARGING_ENERGY_STORAGE_STATUS != coupletMsgData.getChargingEnergyStorageStatus()
|
||||
|| StateConstant.DRIVE_MOTOR_STATUS != coupletMsgData.getDriveMotorStatus()
|
||||
|| StateConstant.POSITION_STATUS != coupletMsgData.getPositionStatus()
|
||||
|| StateConstant.EAS_STATUS != coupletMsgData.getEasStatus()
|
||||
|| StateConstant.PTC_STATUS != coupletMsgData.getPtcStatus()
|
||||
|| StateConstant.ABS_STATUS != coupletMsgData.getAbsStatus()
|
||||
|| StateConstant.MCU_STATUS != coupletMsgData.getMcuStatus()
|
||||
|| StateConstant.HEATING_STATUS != coupletMsgData.getHeatingStatus()
|
||||
|| StateConstant.BATTERY_STATUS != coupletMsgData.getBatteryStatus()
|
||||
|| StateConstant.BATTERY_INSULATION_STATUS != coupletMsgData.getBatteryInsulationStatus()
|
||||
|| StateConstant.DCDC_STATUS != coupletMsgData.getDcdcStatus()
|
||||
|| StateConstant.CHG_STATUS != coupletMsgData.getChgStatus()){
|
||||
//获取过期的key
|
||||
String expireKey = coupletMsgData.toString();
|
||||
redisTemplate.opsForValue().set(String.valueOf(coupletMsgData),JSON.toJSONString(coupletMsgData),10, TimeUnit.MINUTES);
|
||||
|
||||
long timeMillis = System.currentTimeMillis();
|
||||
log.debug("失效+key is:"+ expireKey);
|
||||
log.info("故障事件结束时间:"+timeMillis);
|
||||
log.info("故障事件检测结束.....");
|
||||
|
||||
}
|
||||
log.info("故障事件检测结束.....");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 获取事件名称
|
||||
|
|
|
@ -1,10 +1,20 @@
|
|||
package com.couplet.analyze.msg.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||
import com.couplet.analyze.msg.mapper.IncidentMapper;
|
||||
import com.couplet.analyze.msg.service.IncidentService;
|
||||
import com.couplet.analyze.msg.service.impl.realTimeData.RealTimeJudge;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Author: LiJiaYao
|
||||
* @Date: 2024/4/2
|
||||
|
@ -14,6 +24,15 @@ import org.springframework.stereotype.Service;
|
|||
@Log4j2
|
||||
public class RealTimeDataServiceImpl implements IncidentService {
|
||||
|
||||
/**
|
||||
* 查询传入的数据是否存在
|
||||
*/
|
||||
@Autowired
|
||||
private IncidentMapper incidentMapper;
|
||||
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
/**
|
||||
* 实时数据事件
|
||||
*
|
||||
|
@ -23,6 +42,19 @@ public class RealTimeDataServiceImpl implements IncidentService {
|
|||
public void incident(CoupletMsgData coupletMsgData) {
|
||||
|
||||
log.info("实时数据事件开始.....");
|
||||
|
||||
if (redisTemplate.hasKey("coupletMsgData")){
|
||||
redisTemplate.delete("coupletMsgData");
|
||||
}
|
||||
// Set<Long> userId = setMap.get(coupletMsgData.getVin());
|
||||
// if (null == userId){
|
||||
// userId = new HashSet<>();
|
||||
// setMap.put(coupletMsgData.getVin(),userId);
|
||||
// }
|
||||
// userId.add(coupletMsgData.getUserId());
|
||||
|
||||
|
||||
|
||||
log.info("实时数据事件结束.....");
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package com.couplet.analyze.msg.service.impl.realTimeData;
|
||||
|
||||
|
||||
import com.couplet.analyze.msg.domain.CoupletMsgData;
|
||||
import com.couplet.common.domain.request.RealTimeDataRequest;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Author: LiJiaYao
|
||||
* @Date: 2024/4/4
|
||||
* @Description: 判断实时数据
|
||||
*/
|
||||
public class RealTimeJudge {
|
||||
|
||||
|
||||
/**
|
||||
* 常量
|
||||
*/
|
||||
private static final Map<String, Set<Long>> setMap = new HashMap<>();
|
||||
|
||||
public static boolean isJudge(String vin){
|
||||
return setMap.containsKey(vin);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param realTimeDataRequest
|
||||
* @return
|
||||
*/
|
||||
public static boolean addRealTime(RealTimeDataRequest realTimeDataRequest){
|
||||
Set<Long> userIds = setMap.get(realTimeDataRequest.getVin());
|
||||
if (userIds == null){
|
||||
userIds = new HashSet<>();
|
||||
setMap.put(realTimeDataRequest.getVin(),userIds);
|
||||
}
|
||||
userIds.add(realTimeDataRequest.getUserId());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -4,7 +4,6 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.couplet.analyze.msg.mapper.IncidentMapper">
|
||||
|
||||
|
||||
<insert id="reportMapper">
|
||||
INSERT INTO `couplet-cloud`.`couplet_msg_data`
|
||||
(`vin`, `create_time`, `longitude`, `latitude`,
|
||||
|
@ -18,7 +17,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`)
|
||||
|
@ -71,5 +70,10 @@
|
|||
#{brakePedal}
|
||||
);
|
||||
</insert>
|
||||
<select id="queryByIncident" resultType="com.couplet.analyze.msg.domain.CoupletMsgData"
|
||||
parameterType="com.couplet.common.domain.request.RealTimeDataRequest">
|
||||
SELECT * FROM couplet_msg_data WHERE vin =#{vin}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package com.couplet.business.server.controller;
|
||||
|
||||
import com.couplet.business.server.service.VehicleDetectionService;
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.domain.Vehicle;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fufanrui
|
||||
* @version 1.0
|
||||
* @description: 车辆检测控制器
|
||||
* @date 2024/4/4 10:11
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("detection")
|
||||
public class VehicleDetectionController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private VehicleDetectionService vehicleDetectionService;
|
||||
|
||||
/*
|
||||
* @param :
|
||||
* @return Result<List<Vehicle>>
|
||||
* @author 付凡芮
|
||||
* @description 查询上线的车辆信息
|
||||
* @date
|
||||
*/
|
||||
@PostMapping("/detectionList")
|
||||
public Result<List<Vehicle>> detectionList() {
|
||||
return Result.success(vehicleDetectionService.detectionList());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @param vin:
|
||||
* @return Result<List<Vehicle>>
|
||||
* @author 付凡芮
|
||||
* @description 根据vin查询车辆信息
|
||||
* @date
|
||||
*/
|
||||
@PostMapping("/findByVin/{vehicleId}")
|
||||
public Result<List<Vehicle>> findByVin(@PathVariable("vehicleId") Integer vehicleId) {
|
||||
return Result.success(vehicleDetectionService.findByVin(vehicleId));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.couplet.business.server.mapper;
|
||||
|
||||
import com.couplet.common.domain.Vehicle;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface VehicleDetectionMapper {
|
||||
List<Vehicle> detectionList();
|
||||
|
||||
List<Vehicle> findByVin(Integer vehicleId);
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.couplet.business.server.service;
|
||||
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.domain.Vehicle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface VehicleDetectionService {
|
||||
|
||||
List<Vehicle> detectionList();
|
||||
|
||||
List<Vehicle> findByVin(Integer vehicleId);
|
||||
}
|
|
@ -61,7 +61,7 @@ public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence> implements
|
|||
public void fenceInsert(HttpServletRequest request, FenceRequest fenceRequest) {
|
||||
|
||||
//先添加围栏
|
||||
int a= fenceMapper.insertFence(fenceRequest);
|
||||
fenceMapper.insertFence(fenceRequest);
|
||||
String[] logoIds = fenceRequest.getLogoIds();
|
||||
String[] parts = new String[0];
|
||||
for (String logoId : logoIds) {
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package com.couplet.business.server.service.impl;
|
||||
|
||||
import com.couplet.business.server.mapper.VehicleDetectionMapper;
|
||||
import com.couplet.business.server.service.VehicleDetectionService;
|
||||
import com.couplet.business.server.service.VehicleManageService;
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.domain.Vehicle;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fufanrui
|
||||
* @version 1.0
|
||||
* @description: 车辆检测服务实现类
|
||||
* @date 2024/4/4 10:23
|
||||
*/
|
||||
@Service
|
||||
public class VehicleDetectionServiceImpl implements VehicleDetectionService{
|
||||
|
||||
@Autowired
|
||||
private VehicleDetectionMapper vehicleDetectionMapper;
|
||||
|
||||
@Override
|
||||
public List<Vehicle> detectionList() {
|
||||
return vehicleDetectionMapper.detectionList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Vehicle> findByVin(Integer vehicleId) {
|
||||
return vehicleDetectionMapper.findByVin(vehicleId);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.couplet.business.server.mapper.VehicleDetectionMapper">
|
||||
|
||||
<sql id="selectVehicle">
|
||||
SELECT
|
||||
v.vehicle_id,
|
||||
v.vehicle_type,
|
||||
v.motor_manufacturer,
|
||||
v.battery_manufacturer,
|
||||
v.motor_number,
|
||||
v.battery_number,
|
||||
v.vin,
|
||||
v.vehicle_state,
|
||||
v.isdelete,
|
||||
t.vehicle_type_id,
|
||||
t.vehicle_type_name
|
||||
FROM
|
||||
couplet_vehicle v
|
||||
LEFT JOIN couplet_vehicle_type t ON v.vehicle_type = t.vehicle_type_id
|
||||
WHERE v.isdelete = 0
|
||||
</sql>
|
||||
<select id="detectionList" resultType="com.couplet.common.domain.Vehicle">
|
||||
<include refid="selectVehicle"/>
|
||||
AND v.vehicle_state = 1
|
||||
</select>
|
||||
<select id="findByVin" resultType="com.couplet.common.domain.Vehicle">
|
||||
<include refid="selectVehicle"/>
|
||||
<if test="null!=vin and ''!=vin">
|
||||
AND v.vehicle_id, = #{vehicleId}
|
||||
</if>
|
||||
AND v.vehicle_state = 1
|
||||
</select>
|
||||
</mapper>
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -17,11 +17,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -17,11 +17,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -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,7 +4,6 @@ server:
|
|||
|
||||
# Spring
|
||||
spring:
|
||||
|
||||
application:
|
||||
# 应用名称
|
||||
name: couplet-system
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
Loading…
Reference in New Issue