Compare commits
No commits in common. "d7a1d79a122fa6accc1906d9b3801817c5378fd7" and "628b8d1fab737d1654bb7e5ae68e37ef5b3d21dc" have entirely different histories.
d7a1d79a12
...
628b8d1fab
|
@ -2,6 +2,7 @@ package com.muyu.auth.controller;
|
||||||
|
|
||||||
import com.muyu.auth.form.LoginBody;
|
import com.muyu.auth.form.LoginBody;
|
||||||
import com.muyu.auth.form.RegisterBody;
|
import com.muyu.auth.form.RegisterBody;
|
||||||
|
import com.muyu.auth.remote.RunCarConditionRemote;
|
||||||
import com.muyu.auth.service.SysLoginService;
|
import com.muyu.auth.service.SysLoginService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.JwtUtils;
|
import com.muyu.common.core.utils.JwtUtils;
|
||||||
|
@ -34,12 +35,16 @@ public class TokenController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysLoginService sysLoginService;
|
private SysLoginService sysLoginService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RunCarConditionRemote runCarCondition;
|
||||||
|
|
||||||
@PostMapping("login")
|
@PostMapping("login")
|
||||||
public Result<?> login (@RequestBody LoginBody form) {
|
public Result<?> login (@RequestBody LoginBody form) {
|
||||||
// 用户登录
|
// 用户登录
|
||||||
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(),form.getFirmName());
|
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(),form.getFirmName());
|
||||||
// 获取登录token
|
// 获取登录token
|
||||||
Map<String, Object> token = tokenService.createToken(userInfo);
|
Map<String, Object> token = tokenService.createToken(userInfo);
|
||||||
|
runCarCondition.runCarCondition();
|
||||||
return Result.success(token);
|
return Result.success(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.muyu.auth.remote;
|
||||||
|
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.auth.remote
|
||||||
|
* @Project:cloud-server-8
|
||||||
|
* @name:RunCarConditionRemote
|
||||||
|
* @Date:2024/10/8 22:21
|
||||||
|
*/
|
||||||
|
@FeignClient(name = "cloud-electronic")
|
||||||
|
public interface RunCarConditionRemote {
|
||||||
|
|
||||||
|
@GetMapping("/text")
|
||||||
|
public void runCarCondition();
|
||||||
|
}
|
|
@ -1,22 +1,16 @@
|
||||||
package com.muyu.common.rabbit;
|
package com.muyu.common.rabbit;
|
||||||
|
|
||||||
import org.springframework.amqp.core.Binding;
|
|
||||||
import org.springframework.amqp.core.BindingBuilder;
|
|
||||||
import org.springframework.amqp.core.DirectExchange;
|
|
||||||
import org.springframework.amqp.core.Queue;
|
|
||||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||||
import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar;
|
import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Primary;
|
|
||||||
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
|
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
|
||||||
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
|
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class RabbitListenerConfigurer implements org.springframework.amqp.rabbit.annotation.RabbitListenerConfigurer {
|
public class RabbitListenerConfigurer implements org.springframework.amqp.rabbit.annotation.RabbitListenerConfigurer {
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.setProperty("spring.amqp.deserialization.trust.all", "true");
|
System.setProperty("spring.amqp.deserialization.trust.all", "true");
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,14 @@ package com.muyu.carData.consumer;
|
||||||
import com.muyu.carData.util.CacheUtil;
|
import com.muyu.carData.util.CacheUtil;
|
||||||
import com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService;
|
import com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.amqp.core.Binding;
|
||||||
|
import org.springframework.amqp.core.BindingBuilder;
|
||||||
|
import org.springframework.amqp.core.DirectExchange;
|
||||||
|
import org.springframework.amqp.core.Queue;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**车辆上线消费者
|
/**车辆上线消费者
|
||||||
|
@ -25,24 +31,21 @@ public class CarOnlineConsumer {
|
||||||
private VehicleCacheFaultCodeAddService vehicleCacheCarInformationAddService;
|
private VehicleCacheFaultCodeAddService vehicleCacheCarInformationAddService;
|
||||||
|
|
||||||
|
|
||||||
@RabbitListener(queues = "myQueue",containerFactory = "rabbitListenerContainerFactory")
|
|
||||||
public void consumeMessage(String message) {
|
|
||||||
// 处理接收到的消息
|
|
||||||
log.info("接收到消息======>>" + message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
/**
|
||||||
|
* 创建网关路由交换机
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public DirectExchange initVehicleGatewayExchange(){
|
public DirectExchange initVehicleGatewayExchange(){
|
||||||
return new DirectExchange(VehicleGatewayConstants.VEHICLE_GETAWAY_EXCHANGE);
|
return new DirectExchange(VehicleGatewayConstants.VEHICLE_GETAWAY_EXCHANGE);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
|
||||||
/*@Bean
|
|
||||||
@Primary
|
@Primary
|
||||||
public Queue initQueue(){
|
public Queue initQueue(){
|
||||||
return new Queue("gateway", true);
|
return new Queue("test", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@ -53,8 +56,8 @@ public class CarOnlineConsumer {
|
||||||
.with(VehicleGatewayConstants.VEHICLE_GETAWAY_ROUTING_KEY);
|
.with(VehicleGatewayConstants.VEHICLE_GETAWAY_ROUTING_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RabbitListener(queues = "gateway")
|
@RabbitListener(queues = "test")
|
||||||
public void msg(@RequestBody WebHookConnection webHookConnection){
|
public void msg(String msg){
|
||||||
log.info("消费者接收到车辆上线信息:{}",webHookConnection);
|
log.info(msg);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,9 @@ public class IdentifyingFailuresListener implements EventListener {
|
||||||
String vin = (String) data.get("vin");
|
String vin = (String) data.get("vin");
|
||||||
String str = cacheUtil.get(vin).toString();
|
String str = cacheUtil.get(vin).toString();
|
||||||
FaultCodeCache faultCodeCache = JSON.parseObject(str, FaultCodeCache.class);
|
FaultCodeCache faultCodeCache = JSON.parseObject(str, FaultCodeCache.class);
|
||||||
|
faultCodeCache.getFaultCode().forEach(faultCode -> {
|
||||||
|
|
||||||
|
});
|
||||||
log.info("规则预警事件结束...");
|
log.info("规则预警事件结束...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package com.muyu.enterprise.cache.car;
|
package com.muyu.enterprise.cache.car;
|
||||||
|
|
||||||
import com.muyu.common.cache.CacheAbsBasic;
|
import com.muyu.common.cache.CacheAbsBasic;
|
||||||
|
import com.muyu.domain.CarInformation;
|
||||||
import com.muyu.domain.req.CarInformationAddReq;
|
import com.muyu.domain.req.CarInformationAddReq;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加车辆信息
|
* 添加车辆信息
|
||||||
* @Author:yang
|
* @Author:yang
|
||||||
|
|
|
@ -1,21 +1,23 @@
|
||||||
package com.muyu.enterprise.cache.car;
|
package com.muyu.enterprise.cache.car;
|
||||||
|
|
||||||
import com.muyu.common.cache.CacheAbsBasic;
|
import com.muyu.common.cache.CacheAbsBasic;
|
||||||
import com.muyu.domain.CarFence;
|
import com.muyu.domain.req.CarInformationAddReq;
|
||||||
import com.muyu.domain.CarType;
|
import com.muyu.domain.resp.CarInformationResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆类型表缓存
|
* 车辆基础信息列表缓存
|
||||||
* @Author:yang
|
* @Author:yang
|
||||||
* @Package:com.muyu.cache
|
* @Package:com.muyu.cache
|
||||||
* @Project:cloud-server-8
|
* @Project:cloud-server-8
|
||||||
* @name:VehicleCacheService
|
* @name:VehicleCacheService
|
||||||
* @Date:2024/9/30 11:50
|
* @Date:2024/9/30 11:50
|
||||||
*/
|
*/
|
||||||
public class VehicleCacheCarTypeService extends CacheAbsBasic<String, CarType> {
|
public class VehicleCacheCarInformationFenceRespService extends CacheAbsBasic<String, List<CarInformationResp>> {
|
||||||
@Override
|
@Override
|
||||||
public String keyPre() {
|
public String keyPre() {
|
||||||
return "CarType:info:";
|
return "CarInformationFenceResp:info:";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -1,24 +1,24 @@
|
||||||
package com.muyu.enterprise.cache.fence;
|
package com.muyu.enterprise.cache.car;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.muyu.common.cache.CacheAbsBasic;
|
import com.muyu.common.cache.CacheAbsBasic;
|
||||||
import com.muyu.domain.CarFence;
|
|
||||||
import com.muyu.domain.CarInformation;
|
import com.muyu.domain.CarInformation;
|
||||||
import com.muyu.domain.resp.CarFenceResp;
|
import com.muyu.domain.resp.CarInformationResp;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电子围栏缓存
|
* 分页查询车辆信息
|
||||||
* @Author:yang
|
* @Author:yang
|
||||||
* @Package:com.muyu.cache
|
* @Package:com.muyu.cache
|
||||||
* @Project:cloud-server-8
|
* @Project:cloud-server-8
|
||||||
* @name:VehicleCacheService
|
* @name:VehicleCacheService
|
||||||
* @Date:2024/9/30 11:50
|
* @Date:2024/9/30 11:50
|
||||||
*/
|
*/
|
||||||
public class VehicleCacheFenceService extends CacheAbsBasic<String, CarFenceResp> {
|
public class VehicleCacheCarInformationRespService extends CacheAbsBasic<String, Page<CarInformationResp>> {
|
||||||
@Override
|
@Override
|
||||||
public String keyPre() {
|
public String keyPre() {
|
||||||
return "CarFenceResp:info:";
|
return "CarInformationResp:info:";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -1,20 +1,20 @@
|
||||||
package com.muyu.enterprise.cache.car;
|
package com.muyu.enterprise.cache.car;
|
||||||
|
|
||||||
import com.muyu.common.cache.CacheAbsBasic;
|
import com.muyu.common.cache.CacheAbsBasic;
|
||||||
import com.muyu.domain.resp.CarInformationResp;
|
import com.muyu.domain.CarInformation;
|
||||||
import org.springframework.stereotype.Service;
|
import com.muyu.domain.resp.CarFenceGroupResp;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆缓存
|
* 查询车辆
|
||||||
* @Author:yang
|
* @Author:yang
|
||||||
* @Package:com.muyu.cache
|
* @Package:com.muyu.cache
|
||||||
* @Project:cloud-server-8
|
* @Project:cloud-server-8
|
||||||
* @name:VehicleCacheService
|
* @name:VehicleCacheService
|
||||||
* @Date:2024/9/30 11:50
|
* @Date:2024/9/30 11:50
|
||||||
*/
|
*/
|
||||||
public class VehicleCacheCarInformationService extends CacheAbsBasic<String, List<CarInformationResp>> {
|
public class VehicleCacheCarInformationService extends CacheAbsBasic<String, List<CarInformation>> {
|
||||||
@Override
|
@Override
|
||||||
public String keyPre() {
|
public String keyPre() {
|
||||||
return "CarInformation:info:";
|
return "CarInformation:info:";
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
package com.muyu.enterprise.cache.car;
|
package com.muyu.enterprise.cache.car;
|
||||||
|
|
||||||
import com.muyu.common.cache.CacheAbsBasic;
|
import com.muyu.common.cache.CacheAbsBasic;
|
||||||
|
import com.muyu.domain.req.CarInformationAddReq;
|
||||||
import com.muyu.domain.req.CarInformationUpdReq;
|
import com.muyu.domain.req.CarInformationUpdReq;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆管理修改缓存
|
* 修改车辆信息
|
||||||
* @Author:yang
|
* @Author:yang
|
||||||
* @Package:com.muyu.cache
|
* @Package:com.muyu.cache
|
||||||
* @Project:cloud-server-8
|
* @Project:cloud-server-8
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
package com.muyu.enterprise.cache.fault;
|
|
||||||
|
|
||||||
import com.muyu.common.cache.CacheAbsBasic;
|
|
||||||
import com.muyu.domain.FaultCode;
|
|
||||||
import com.muyu.domain.resp.CarFenceResp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 故障码缓存
|
|
||||||
* @Author:yang
|
|
||||||
* @Package:com.muyu.cache
|
|
||||||
* @Project:cloud-server-8
|
|
||||||
* @name:VehicleCacheService
|
|
||||||
* @Date:2024/9/30 11:50
|
|
||||||
*/
|
|
||||||
public class VehicleCacheFaultService extends CacheAbsBasic<String, FaultCode> {
|
|
||||||
@Override
|
|
||||||
public String keyPre() {
|
|
||||||
return "FaultCode:info:";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String decode(String key) {
|
|
||||||
return key.replace("vehicle:info:","");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,7 +6,7 @@ import com.muyu.domain.req.CarInformationAddReq;
|
||||||
import com.muyu.domain.req.FaultCodeAddReq;
|
import com.muyu.domain.req.FaultCodeAddReq;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加故障码缓存
|
* 添加车辆信息
|
||||||
* @Author:yang
|
* @Author:yang
|
||||||
* @Package:com.muyu.cache
|
* @Package:com.muyu.cache
|
||||||
* @Project:cloud-server-8
|
* @Project:cloud-server-8
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
package com.muyu.enterprise.cache.fence;
|
|
||||||
|
|
||||||
import com.muyu.common.cache.CacheAbsBasic;
|
|
||||||
import com.muyu.domain.CarFence;
|
|
||||||
import com.muyu.domain.resp.CarFenceResp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 电子围栏add缓存
|
|
||||||
* @Author:yang
|
|
||||||
* @Package:com.muyu.cache
|
|
||||||
* @Project:cloud-server-8
|
|
||||||
* @name:VehicleCacheService
|
|
||||||
* @Date:2024/9/30 11:50
|
|
||||||
*/
|
|
||||||
public class VehicleCacheFenceAddService extends CacheAbsBasic<String, CarFence> {
|
|
||||||
@Override
|
|
||||||
public String keyPre() {
|
|
||||||
return "CarFenceAdd:info:";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String decode(String key) {
|
|
||||||
return key.replace("vehicle:info:","");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package com.muyu.enterprise.cache.warn;
|
|
||||||
|
|
||||||
import com.muyu.common.cache.CacheAbsBasic;
|
|
||||||
import com.muyu.domain.WarnStrategy;
|
|
||||||
import com.muyu.domain.resp.CarFenceResp;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 电子围栏缓存
|
|
||||||
* @Author:yang
|
|
||||||
* @Package:com.muyu.cache
|
|
||||||
* @Project:cloud-server-8
|
|
||||||
* @name:VehicleCacheService
|
|
||||||
* @Date:2024/9/30 11:50
|
|
||||||
*/
|
|
||||||
public class VehicleCacheWarnService extends CacheAbsBasic<String, List<WarnStrategy>> {
|
|
||||||
@Override
|
|
||||||
public String keyPre() {
|
|
||||||
return "WarnStrategy:info:";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String decode(String key) {
|
|
||||||
return key.replace("vehicle:info:","");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +1,6 @@
|
||||||
com.muyu.enterprise.cache.car.VehicleCacheCarInformationService
|
com.muyu.enterprise.cache.car.VehicleCacheCarInformationService
|
||||||
|
com.muyu.enterprise.cache.car.VehicleCacheCarInformationRespService
|
||||||
com.muyu.enterprise.cache.car.VehicleCacheCarInformationAddService
|
com.muyu.enterprise.cache.car.VehicleCacheCarInformationAddService
|
||||||
com.muyu.enterprise.cache.car.VehicleCacheCarInformationUpdService
|
com.muyu.enterprise.cache.car.VehicleCacheCarInformationUpdService
|
||||||
com.muyu.enterprise.cache.car.VehicleCacheCarTypeService
|
com.muyu.enterprise.cache.car.VehicleCacheCarInformationFenceRespService
|
||||||
com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService
|
com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService
|
||||||
com.muyu.enterprise.cache.fence.VehicleCacheFenceService
|
|
||||||
com.muyu.enterprise.cache.fence.VehicleCacheFenceAddService
|
|
||||||
com.muyu.enterprise.cache.fault.VehicleCacheFaultService
|
|
||||||
com.muyu.enterprise.cache.warn.VehicleCacheWarnService
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.muyu.domain;
|
package com.muyu.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -27,7 +25,6 @@ public class CarFenceClazz {
|
||||||
/**
|
/**
|
||||||
* 业务类型ID
|
* 业务类型ID
|
||||||
*/
|
*/
|
||||||
@TableId(value = "clazz_id",type = IdType.AUTO)
|
|
||||||
private Integer clazzId;
|
private Integer clazzId;
|
||||||
/**
|
/**
|
||||||
* 业务类型名称
|
* 业务类型名称
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.muyu.domain;
|
package com.muyu.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -27,7 +25,6 @@ public class CarFenceType {
|
||||||
/**
|
/**
|
||||||
* 围栏类型ID
|
* 围栏类型ID
|
||||||
*/
|
*/
|
||||||
@TableId(value = "type_id",type = IdType.AUTO)
|
|
||||||
private Integer typeId;
|
private Integer typeId;
|
||||||
/**
|
/**
|
||||||
* 围栏类型名称
|
* 围栏类型名称
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.muyu.domain;
|
package com.muyu.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -27,7 +25,6 @@ public class CarMessage {
|
||||||
/**
|
/**
|
||||||
* 自增主键
|
* 自增主键
|
||||||
*/
|
*/
|
||||||
@TableId(value = "message_type_id",type = IdType.AUTO)
|
|
||||||
private Long messageTypeId;
|
private Long messageTypeId;
|
||||||
/**
|
/**
|
||||||
* 报文编码
|
* 报文编码
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.muyu.domain;
|
package com.muyu.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -28,8 +26,7 @@ public class CarType {
|
||||||
/**
|
/**
|
||||||
* 车辆类型ID
|
* 车辆类型ID
|
||||||
*/
|
*/
|
||||||
@TableId(value = "car_type_id",type = IdType.AUTO)
|
private long carTypeId;
|
||||||
private Long carTypeId;
|
|
||||||
/**
|
/**
|
||||||
* 车辆类型名
|
* 车辆类型名
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class FaultCode {
|
||||||
*故障码Id
|
*故障码Id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "faultcode_id",type = IdType.AUTO)
|
@TableId(value = "faultcode_id",type = IdType.AUTO)
|
||||||
private Long faultcodeId;
|
private long faultcodeId;
|
||||||
/**
|
/**
|
||||||
*故障名称Id
|
*故障名称Id
|
||||||
*/
|
*/
|
||||||
|
@ -97,7 +97,7 @@ public class FaultCode {
|
||||||
|
|
||||||
public static FaultCode updfaultcode(FaultCodeUpdReq faultCodeUpdReq){
|
public static FaultCode updfaultcode(FaultCodeUpdReq faultCodeUpdReq){
|
||||||
return FaultCode.builder()
|
return FaultCode.builder()
|
||||||
.faultcodeId(0L)
|
.faultcodeId(0)
|
||||||
.messageTypeId(faultCodeUpdReq.getMessageTypeId())
|
.messageTypeId(faultCodeUpdReq.getMessageTypeId())
|
||||||
.faultcodeNumber(faultCodeUpdReq.getFaultcodeNumber())
|
.faultcodeNumber(faultCodeUpdReq.getFaultcodeNumber())
|
||||||
.faultGroup(faultCodeUpdReq.getFaultGroup())
|
.faultGroup(faultCodeUpdReq.getFaultGroup())
|
||||||
|
|
|
@ -23,15 +23,25 @@ import java.util.List;
|
||||||
@Tag(name = "故障码,电子围栏,车辆,报文")
|
@Tag(name = "故障码,电子围栏,车辆,报文")
|
||||||
public class FaultCodeCache {
|
public class FaultCodeCache {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏信息
|
||||||
|
*/
|
||||||
|
private List<CarFence> carFences;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障标签信息
|
||||||
|
*/
|
||||||
|
private WarnStrategy warnStrategies;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆信息
|
* 车辆信息
|
||||||
*/
|
*/
|
||||||
public CarInformation carInformation;
|
public List<CarInformation> carInformation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障码信息
|
* 故障码信息
|
||||||
*/
|
*/
|
||||||
private FaultCode faultCode;
|
private List<FaultCode> faultCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障标签
|
* 故障标签
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class FaultCondition {
|
||||||
* 故障规则表Id
|
* 故障规则表Id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "carcondition_id",type = IdType.AUTO)
|
@TableId(value = "carcondition_id",type = IdType.AUTO)
|
||||||
private Long carconditionId;
|
private long carconditionId;
|
||||||
/**
|
/**
|
||||||
* 车辆类型Id
|
* 车辆类型Id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class FaultLabel {
|
||||||
*自增主键
|
*自增主键
|
||||||
*/
|
*/
|
||||||
@TableId(value = "message_type_id",type = IdType.AUTO)
|
@TableId(value = "message_type_id",type = IdType.AUTO)
|
||||||
private Long messageTypeId;
|
private long messageTypeId;
|
||||||
/**
|
/**
|
||||||
*报文编码
|
*报文编码
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class FaultLog {
|
||||||
* 故障日志Id
|
* 故障日志Id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "log_id",type = IdType.AUTO)
|
@TableId(value = "log_id",type = IdType.AUTO)
|
||||||
private Long logId;
|
private long logId;
|
||||||
/**
|
/**
|
||||||
* 故障码Id
|
* 故障码Id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class FaultType {
|
||||||
*故障类型Id
|
*故障类型Id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "faulttype_id",type = IdType.AUTO)
|
@TableId(value = "faulttype_id",type = IdType.AUTO)
|
||||||
private Long faulttypeId;
|
private long faulttypeId;
|
||||||
/**
|
/**
|
||||||
*故障类型名称
|
*故障类型名称
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class FirmPermission {
|
||||||
* 企业权限Id
|
* 企业权限Id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "permission_id")
|
@TableId(value = "permission_id")
|
||||||
private Long permissionId;
|
private long permissionId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限等级
|
* 权限等级
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class Message {
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "id",type = IdType.AUTO)
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
private Long id;
|
private long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送者
|
* 发送者
|
||||||
|
|
|
@ -44,6 +44,11 @@
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-modules-carData</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</dependency>
|
||||||
<!-- SpringCloud Alibaba Sentinel -->
|
<!-- SpringCloud Alibaba Sentinel -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
@ -94,6 +99,11 @@
|
||||||
<artifactId>pagehelper</artifactId>
|
<artifactId>pagehelper</artifactId>
|
||||||
<version>6.0.0</version>
|
<version>6.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-modules-carData</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-modules-enterprise-cache</artifactId>
|
<artifactId>cloud-modules-enterprise-cache</artifactId>
|
||||||
|
|
|
@ -7,7 +7,6 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
@ -24,12 +23,12 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/carFenceClazz")
|
@RequestMapping("/carFenceClazz")
|
||||||
@RestController
|
@RestController
|
||||||
|
@AllArgsConstructor
|
||||||
@Tag(name = "查询数据",description = "从围栏信息表中查询数据")
|
@Tag(name = "查询数据",description = "从围栏信息表中查询数据")
|
||||||
@Log4j2
|
@Log4j2
|
||||||
public class CarFenceClazzController {
|
public class CarFenceClazzController {
|
||||||
|
|
||||||
@Autowired
|
private final CarFenceClazzService carFenceClazzService;
|
||||||
private CarFenceClazzService carFenceClazzService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询围栏类型信息
|
* 查询围栏类型信息
|
||||||
|
|
|
@ -43,7 +43,6 @@ public class CarFenceController {
|
||||||
@Validated @RequestBody CarFenceReq req
|
@Validated @RequestBody CarFenceReq req
|
||||||
){
|
){
|
||||||
Page<CarFenceResp> connects = carFenceService.selectCarFence(req);
|
Page<CarFenceResp> connects = carFenceService.selectCarFence(req);
|
||||||
|
|
||||||
log.info("查询数据:"+ connects);
|
log.info("查询数据:"+ connects);
|
||||||
|
|
||||||
return Result.success(
|
return Result.success(
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
package com.muyu.server.controller;
|
package com.muyu.server.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.domain.CarFenceType;
|
||||||
import com.muyu.domain.CarInformation;
|
import com.muyu.domain.CarInformation;
|
||||||
import com.muyu.domain.req.CarInformationAddReq;
|
import com.muyu.domain.req.CarInformationAddReq;
|
||||||
import com.muyu.domain.req.CarInformationListReq;
|
import com.muyu.domain.req.CarInformationListReq;
|
||||||
import com.muyu.domain.req.CarInformationUpdReq;
|
import com.muyu.domain.req.CarInformationUpdReq;
|
||||||
import com.muyu.domain.resp.CarInformationResp;
|
import com.muyu.domain.resp.CarInformationResp;
|
||||||
import com.muyu.enterprise.cache.car.VehicleCacheCarInformationAddService;
|
import com.muyu.enterprise.cache.car.*;
|
||||||
import com.muyu.enterprise.cache.car.VehicleCacheCarInformationService;
|
|
||||||
import com.muyu.enterprise.cache.car.VehicleCacheCarInformationUpdService;
|
|
||||||
import com.muyu.server.service.CarInformationService;
|
import com.muyu.server.service.CarInformationService;
|
||||||
import com.muyu.server.util.ObtainRootLogin;
|
import com.muyu.server.util.ObtainRootLogin;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -33,25 +34,33 @@ import java.util.List;
|
||||||
public class CarInformationController {
|
public class CarInformationController {
|
||||||
@Resource
|
@Resource
|
||||||
private CarInformationService carInformationService;
|
private CarInformationService carInformationService;
|
||||||
@Autowired
|
|
||||||
private VehicleCacheCarInformationService vehicleCacheCarInformationService;
|
private VehicleCacheCarInformationService vehicleCacheCarInformationService;
|
||||||
@Autowired
|
private VehicleCacheCarInformationRespService vehicleCacheCarInformationRespService;
|
||||||
private VehicleCacheCarInformationAddService vehicleCacheCarInformationAddService;
|
private VehicleCacheCarInformationAddService vehicleCacheCarInformationAddService;
|
||||||
@Autowired
|
|
||||||
private VehicleCacheCarInformationUpdService vehicleCacheCarInformationUpdService;
|
private VehicleCacheCarInformationUpdService vehicleCacheCarInformationUpdService;
|
||||||
|
private VehicleCacheCarInformationFenceRespService vehicleCacheCarInformationFenceRespService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询车辆业务信息
|
* 查询围栏业务信息
|
||||||
*/
|
*/
|
||||||
@PostMapping("/selectCarInformation")
|
@PostMapping("/selectCarInformation")
|
||||||
@Operation(summary = "查询数据",description = "查询数据")
|
@Operation(summary = "查询数据",description = "查询数据")
|
||||||
public Result<List<CarInformation>> selectConnect(){
|
public Result<List<CarInformation>> selectConnect(){
|
||||||
|
List<CarInformation> carFenceRespPage = vehicleCacheCarInformationService
|
||||||
|
.get(vehicleCacheCarInformationService
|
||||||
|
.keyPre()+ ObtainRootLogin
|
||||||
|
.obtain());
|
||||||
|
if (CollectionUtils.isEmpty(carFenceRespPage)) {
|
||||||
|
return Result.success(carFenceRespPage);
|
||||||
|
}
|
||||||
List<CarInformation> connects = carInformationService.list()
|
List<CarInformation> connects = carInformationService.list()
|
||||||
.stream()
|
.stream()
|
||||||
.map(CarInformation::carInformationBuilder)
|
.map(CarInformation::carInformationBuilder)
|
||||||
.toList();
|
.toList();
|
||||||
|
vehicleCacheCarInformationService.put(
|
||||||
|
vehicleCacheCarInformationService.keyPre()+ObtainRootLogin.obtain()
|
||||||
|
,connects);
|
||||||
return Result.success(
|
return Result.success(
|
||||||
connects, "操作成功"
|
connects, "操作成功"
|
||||||
);
|
);
|
||||||
|
@ -79,14 +88,18 @@ public class CarInformationController {
|
||||||
@Operation(summary = "企业车辆管理列表")
|
@Operation(summary = "企业车辆管理列表")
|
||||||
public Result<Page<CarInformationResp>> selectCarInformationList(@Validated @RequestBody CarInformationListReq carInformationListReq) {
|
public Result<Page<CarInformationResp>> selectCarInformationList(@Validated @RequestBody CarInformationListReq carInformationListReq) {
|
||||||
|
|
||||||
|
Page<CarInformationResp> carFenceRespPage = vehicleCacheCarInformationRespService
|
||||||
|
.get(vehicleCacheCarInformationRespService
|
||||||
|
.keyPre()+ ObtainRootLogin
|
||||||
|
.obtain());
|
||||||
|
if (CollectionUtils.isEmpty(carFenceRespPage.getRecords())) {
|
||||||
|
return Result.success(carFenceRespPage);
|
||||||
|
}
|
||||||
Page<CarInformationResp> pageInfo = carInformationService.selectCarInformationList(carInformationListReq);
|
Page<CarInformationResp> pageInfo = carInformationService.selectCarInformationList(carInformationListReq);
|
||||||
log.info("企业车辆管理列表查询",carInformationListReq,pageInfo);
|
log.info("企业车辆管理列表查询",carInformationListReq,pageInfo);
|
||||||
List<CarInformationResp> records = pageInfo.getRecords();
|
vehicleCacheCarInformationRespService.put(
|
||||||
records.forEach(carInformation -> {
|
vehicleCacheCarInformationRespService.keyPre()+ObtainRootLogin.obtain()
|
||||||
vehicleCacheCarInformationService.put(
|
,pageInfo);
|
||||||
vehicleCacheCarInformationService.keyPre()+carInformation.getCarInformationVIN()
|
|
||||||
,records);
|
|
||||||
});
|
|
||||||
return Result.success(pageInfo);
|
return Result.success(pageInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -103,7 +116,7 @@ public class CarInformationController {
|
||||||
|
|
||||||
vehicleCacheCarInformationAddService.put(
|
vehicleCacheCarInformationAddService.put(
|
||||||
vehicleCacheCarInformationAddService
|
vehicleCacheCarInformationAddService
|
||||||
.keyPre()+carInformationAddReq.getCarInformationVIN(), carInformationAddReq);
|
.keyPre()+ObtainRootLogin.obtain(), carInformationAddReq);
|
||||||
return carInformationService.addCarInformation(carInformationAddReq)
|
return carInformationService.addCarInformation(carInformationAddReq)
|
||||||
?Result.success("添加车辆成功")
|
?Result.success("添加车辆成功")
|
||||||
:Result.error(402,"添加车辆失败");
|
:Result.error(402,"添加车辆失败");
|
||||||
|
@ -156,8 +169,17 @@ public class CarInformationController {
|
||||||
@GetMapping("/selectCarInformationIdAndLicensePlate")
|
@GetMapping("/selectCarInformationIdAndLicensePlate")
|
||||||
@Operation(summary = "查询企业车辆 carInformationID 和 carInformationLicensePlate")
|
@Operation(summary = "查询企业车辆 carInformationID 和 carInformationLicensePlate")
|
||||||
public Result<List<CarInformationResp>> selectCarInformationIdAndLicensePlate(){
|
public Result<List<CarInformationResp>> selectCarInformationIdAndLicensePlate(){
|
||||||
|
List<CarInformationResp> carFenceRespPage = vehicleCacheCarInformationFenceRespService
|
||||||
|
.get(vehicleCacheCarInformationFenceRespService
|
||||||
|
.keyPre()+ ObtainRootLogin
|
||||||
|
.obtain());
|
||||||
|
if (CollectionUtils.isEmpty(carFenceRespPage)) {
|
||||||
|
return Result.success(carFenceRespPage);
|
||||||
|
}
|
||||||
List<CarInformationResp> carInformations = carInformationService.selectBycarInformationIDAndLicensePlate();
|
List<CarInformationResp> carInformations = carInformationService.selectBycarInformationIDAndLicensePlate();
|
||||||
|
vehicleCacheCarInformationFenceRespService.put(
|
||||||
|
vehicleCacheCarInformationFenceRespService.keyPre()+ObtainRootLogin.obtain()
|
||||||
|
,carInformations);
|
||||||
return Result.success(carInformations);
|
return Result.success(carInformations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,16 @@
|
||||||
package com.muyu.server.controller;
|
package com.muyu.server.controller;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.domain.CarInformation;
|
|
||||||
import com.muyu.domain.CarType;
|
import com.muyu.domain.CarType;
|
||||||
import com.muyu.enterprise.cache.car.VehicleCacheCarTypeService;
|
|
||||||
import com.muyu.server.service.CarInformationService;
|
|
||||||
import com.muyu.server.service.CarTypeService;
|
import com.muyu.server.service.CarTypeService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import lombok.AllArgsConstructor;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆类型控制层
|
* 车辆类型控制层
|
||||||
|
@ -28,12 +23,10 @@ import java.util.Locale;
|
||||||
|
|
||||||
@RequestMapping("/cartype")
|
@RequestMapping("/cartype")
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
|
||||||
public class CarTypeController {
|
public class CarTypeController {
|
||||||
|
|
||||||
private final CarTypeService carTypeService;
|
@Autowired
|
||||||
private final CarInformationService carInformationService;
|
private CarTypeService carTypeService;
|
||||||
private final VehicleCacheCarTypeService vehicleCacheCarTypeService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,16 +38,7 @@ public class CarTypeController {
|
||||||
public Result carTypeList(){
|
public Result carTypeList(){
|
||||||
|
|
||||||
List<CarType> data = carTypeService.selectcarType();
|
List<CarType> data = carTypeService.selectcarType();
|
||||||
data.forEach(carType -> {
|
|
||||||
List<CarInformation> list = carInformationService.list(new LambdaQueryWrapper<CarInformation>()
|
|
||||||
.eq(CarInformation::getCarInformationType, carType.getCarTypeId()));
|
|
||||||
list.forEach(carInformation -> {
|
|
||||||
vehicleCacheCarTypeService
|
|
||||||
.put(vehicleCacheCarTypeService
|
|
||||||
.keyPre()+carInformation
|
|
||||||
.getCarInformationVIN(),carType);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return Result.success(data);
|
return Result.success(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import com.muyu.domain.resp.FaultCodeTotalListResp;
|
||||||
import com.muyu.server.service.FaultCodeService;
|
import com.muyu.server.service.FaultCodeService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -25,12 +25,11 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/faultcode")
|
@RequestMapping("/faultcode")
|
||||||
@AllArgsConstructor
|
|
||||||
@Tag(name = "车辆故障码控制层",description = "从故障信息表中查询数据")
|
@Tag(name = "车辆故障码控制层",description = "从故障信息表中查询数据")
|
||||||
public class FaultCodeController {
|
public class FaultCodeController {
|
||||||
|
|
||||||
private final FaultCodeService faultCodeService;
|
@Autowired
|
||||||
|
private FaultCodeService faultCodeService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,10 @@ public class FaultConditionController {
|
||||||
if (faultConditionList.size()>0){
|
if (faultConditionList.size()>0){
|
||||||
return Result.error("此车辆类型已存在所对应的故障规则,无需重新制定,可在原规则上进行修改");
|
return Result.error("此车辆类型已存在所对应的故障规则,无需重新制定,可在原规则上进行修改");
|
||||||
}
|
}
|
||||||
faultConditionService.save(FaultCondition.faultConditionadd(faultConditionAddReq));
|
boolean save = faultConditionService.save(FaultCondition.faultConditionadd(faultConditionAddReq));
|
||||||
|
if (save){
|
||||||
|
faultConditionService.RunCarCondition();
|
||||||
|
}
|
||||||
return Result.success(null,"规则制定成功");
|
return Result.success(null,"规则制定成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,4 +39,8 @@ public interface FaultConditionService extends IService<FaultCondition> {
|
||||||
*/
|
*/
|
||||||
List<FaultCondition> saveFaultConditionList();
|
List<FaultCondition> saveFaultConditionList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加缓存
|
||||||
|
*/
|
||||||
|
void RunCarCondition();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,8 @@ import com.muyu.domain.req.*;
|
||||||
import com.muyu.domain.resp.CarFenceGroupResp;
|
import com.muyu.domain.resp.CarFenceGroupResp;
|
||||||
import com.muyu.domain.resp.CarFenceGroupsResp;
|
import com.muyu.domain.resp.CarFenceGroupsResp;
|
||||||
import com.muyu.domain.resp.CarFenceResp;
|
import com.muyu.domain.resp.CarFenceResp;
|
||||||
import com.muyu.enterprise.cache.fence.VehicleCacheFenceAddService;
|
|
||||||
import com.muyu.enterprise.cache.fence.VehicleCacheFenceService;
|
|
||||||
import com.muyu.server.mapper.CarFenceMapper;
|
import com.muyu.server.mapper.CarFenceMapper;
|
||||||
import com.muyu.server.service.*;
|
import com.muyu.server.service.*;
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -31,7 +28,6 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@AllArgsConstructor
|
|
||||||
public class CarFenceServiceImpl
|
public class CarFenceServiceImpl
|
||||||
extends ServiceImpl<CarFenceMapper, CarFence>
|
extends ServiceImpl<CarFenceMapper, CarFence>
|
||||||
implements CarFenceService {
|
implements CarFenceService {
|
||||||
|
@ -48,8 +44,6 @@ public class CarFenceServiceImpl
|
||||||
private CarMiddleSerivce carMiddleSerivce;
|
private CarMiddleSerivce carMiddleSerivce;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CarInformationService carInformationService;
|
private CarInformationService carInformationService;
|
||||||
private final VehicleCacheFenceService vehicleCacheFenceService;
|
|
||||||
private final VehicleCacheFenceAddService vehicleCacheFenceAddService;
|
|
||||||
/**
|
/**
|
||||||
* 查询围栏信息
|
* 查询围栏信息
|
||||||
*/
|
*/
|
||||||
|
@ -89,9 +83,8 @@ public class CarFenceServiceImpl
|
||||||
.toList();
|
.toList();
|
||||||
List<CarFence> carFenceList = carFencePage.getRecords();
|
List<CarFence> carFenceList = carFencePage.getRecords();
|
||||||
this.optimizeEntity(carFenceList,carFenceClazzList,carFenceTypeList);
|
this.optimizeEntity(carFenceList,carFenceClazzList,carFenceTypeList);
|
||||||
|
|
||||||
//构建一个新的分页响应对象
|
//构建一个新的分页响应对象
|
||||||
Page<CarFenceResp> carFenceRespPage = new Page<>() {{
|
return new Page<>() {{
|
||||||
//从查询结果中获取记录,并使用流式处理将每条记录转换为EtlDataScoreResp对象
|
//从查询结果中获取记录,并使用流式处理将每条记录转换为EtlDataScoreResp对象
|
||||||
List<CarFenceResp> etlDataScoreRespList = carFencePage.getRecords().stream()
|
List<CarFenceResp> etlDataScoreRespList = carFencePage.getRecords().stream()
|
||||||
//使用map操作将EtlDataScore对象转换为EtlDataScoreResp对象
|
//使用map操作将EtlDataScore对象转换为EtlDataScoreResp对象
|
||||||
|
@ -107,17 +100,6 @@ public class CarFenceServiceImpl
|
||||||
//设置分页响应中的每页记录数
|
//设置分页响应中的每页记录数
|
||||||
setSize(carFencePage.getSize());
|
setSize(carFencePage.getSize());
|
||||||
}};
|
}};
|
||||||
List<CarFenceResp> records = carFenceRespPage.getRecords();
|
|
||||||
records.forEach(carFenceResp -> {
|
|
||||||
List<CarInformation> list = carInformationService
|
|
||||||
.list(new LambdaQueryWrapper<CarInformation>()
|
|
||||||
.eq(CarInformation::getCarInformationFence, carFenceResp.getId()));
|
|
||||||
list.forEach(carInformation -> {
|
|
||||||
vehicleCacheFenceService.put(vehicleCacheFenceService.keyPre()+carInformation.getCarInformationVIN(),carFenceResp);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
return carFenceRespPage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -136,12 +118,6 @@ public class CarFenceServiceImpl
|
||||||
carMiddleGroup.setFenceGroupId(carFenceGroup.getId());
|
carMiddleGroup.setFenceGroupId(carFenceGroup.getId());
|
||||||
carMiddleGroupService.save(carMiddleGroup);
|
carMiddleGroupService.save(carMiddleGroup);
|
||||||
});
|
});
|
||||||
List<CarInformation> list = carInformationService
|
|
||||||
.list(new LambdaQueryWrapper<CarInformation>()
|
|
||||||
.eq(CarInformation::getCarInformationFence, carFence.getId()));
|
|
||||||
list.forEach(carInformation -> {
|
|
||||||
vehicleCacheFenceAddService.put(vehicleCacheFenceAddService.keyPre()+carInformation.getCarInformationVIN(),carFence);
|
|
||||||
});
|
|
||||||
return connects;
|
return connects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,29 @@
|
||||||
package com.muyu.server.service.impl;
|
package com.muyu.server.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.domain.FaultCode;
|
import com.muyu.domain.*;
|
||||||
import com.muyu.domain.FaultLabel;
|
|
||||||
import com.muyu.domain.req.FaultCodeAddReq;
|
import com.muyu.domain.req.FaultCodeAddReq;
|
||||||
import com.muyu.domain.req.FaultCodeListReq;
|
import com.muyu.domain.req.FaultCodeListReq;
|
||||||
import com.muyu.domain.req.FaultCodeUpdReq;
|
import com.muyu.domain.req.FaultCodeUpdReq;
|
||||||
import com.muyu.domain.resp.FaultCodeListResp;
|
import com.muyu.domain.resp.FaultCodeListResp;
|
||||||
import com.muyu.domain.resp.FaultCodeTotalListResp;
|
import com.muyu.domain.resp.FaultCodeTotalListResp;
|
||||||
|
import com.muyu.domain.resp.FaultConditionListResp;
|
||||||
|
import com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService;
|
||||||
import com.muyu.server.mapper.FaultCodeMapper;
|
import com.muyu.server.mapper.FaultCodeMapper;
|
||||||
import com.muyu.server.service.CarFenceService;
|
import com.muyu.server.service.CarFenceService;
|
||||||
import com.muyu.server.service.CarInformationService;
|
import com.muyu.server.service.CarInformationService;
|
||||||
import com.muyu.server.service.FaultCodeService;
|
import com.muyu.server.service.FaultCodeService;
|
||||||
import com.muyu.server.service.FaultLabelService;
|
import com.muyu.server.service.FaultLabelService;
|
||||||
|
import com.muyu.server.util.ObtainRootLogin;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +54,7 @@ public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode
|
||||||
long count = this.count(queryWrapper);
|
long count = this.count(queryWrapper);
|
||||||
|
|
||||||
MPJLambdaWrapper<FaultCode> wrapper = new MPJLambdaWrapper<>();
|
MPJLambdaWrapper<FaultCode> wrapper = new MPJLambdaWrapper<>();
|
||||||
MPJLambdaWrapper<FaultCode> eq = wrapper.select(
|
wrapper.select(
|
||||||
FaultCode::getFaultcodeId,
|
FaultCode::getFaultcodeId,
|
||||||
FaultCode::getMessageTypeId,
|
FaultCode::getMessageTypeId,
|
||||||
FaultCode::getFaultcodeNumber,
|
FaultCode::getFaultcodeNumber,
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.server.service.impl;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.domain.*;
|
import com.muyu.domain.*;
|
||||||
import com.muyu.domain.req.FaultConditionAddReq;
|
import com.muyu.domain.req.FaultConditionAddReq;
|
||||||
import com.muyu.domain.req.FaultConditionListReq;
|
import com.muyu.domain.req.FaultConditionListReq;
|
||||||
|
@ -11,11 +12,12 @@ import com.muyu.domain.resp.FaultConditionTotalListResp;
|
||||||
import com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService;
|
import com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService;
|
||||||
import com.muyu.server.mapper.FaultConditionMapper;
|
import com.muyu.server.mapper.FaultConditionMapper;
|
||||||
import com.muyu.server.service.*;
|
import com.muyu.server.service.*;
|
||||||
|
import com.muyu.server.util.RunCarCondition;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,12 +37,12 @@ public class FaultConditionServiceImpl
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FaultConditionMapper faultConditionMapper;
|
private FaultConditionMapper faultConditionMapper;
|
||||||
|
private final VehicleCacheFaultCodeAddService vehicleCacheFaultCodeAddService;
|
||||||
private final CarInformationService carInformationService;
|
private final CarInformationService carInformationService;
|
||||||
private final CarFenceService carFenceService;
|
private final CarFenceService carFenceService;
|
||||||
private final WarnStrategyService warnStrategyService;
|
private final WarnStrategyService warnStrategyService;
|
||||||
private final FaultCodeService faultCodeService;
|
private final FaultCodeService faultCodeService;
|
||||||
private final FaultLabelService faultLabelService;
|
private final FaultLabelService faultLabelService;
|
||||||
private final VehicleCacheFaultCodeAddService vehicleCacheFaultCodeAddService;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,36 +74,9 @@ public class FaultConditionServiceImpl
|
||||||
}
|
}
|
||||||
wrapper.last("LIMIT "+ ((faultConditionListReq.getPageNum()-1)*faultConditionListReq.getPageSize())+", "+faultConditionListReq.getPageSize());
|
wrapper.last("LIMIT "+ ((faultConditionListReq.getPageNum()-1)*faultConditionListReq.getPageSize())+", "+faultConditionListReq.getPageSize());
|
||||||
List<FaultConditionListResp> faultConditionListResps = faultConditionMapper.selectJoinList(FaultConditionListResp.class, wrapper);
|
List<FaultConditionListResp> faultConditionListResps = faultConditionMapper.selectJoinList(FaultConditionListResp.class, wrapper);
|
||||||
//添加故障车辆缓存
|
|
||||||
this.CacheFault(faultConditionListResps);
|
|
||||||
return FaultConditionTotalListResp.faultConditionTotalListResp(faultConditionListResps,count);
|
return FaultConditionTotalListResp.faultConditionTotalListResp(faultConditionListResps,count);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CacheFault(@NotNull List<FaultConditionListResp> faultConditionListResps) {
|
|
||||||
faultConditionListResps.forEach(faultConditionListResp -> {
|
|
||||||
List<CarInformation> list = carInformationService
|
|
||||||
.list(new LambdaQueryWrapper<CarInformation>()
|
|
||||||
.eq(CarInformation::getCarInformationType, faultConditionListResp.getCarTypeId()));
|
|
||||||
list.forEach(carInformation -> {
|
|
||||||
List<FaultCode> list1 = faultCodeService.list(new LambdaQueryWrapper<FaultCode>()
|
|
||||||
.eq(FaultCode::getFaultcodeId, faultConditionListResp.getMessageTypeId()));
|
|
||||||
list1.forEach(faultCode -> {
|
|
||||||
FaultCodeCache faultCodeCache = new FaultCodeCache();
|
|
||||||
faultCodeCache.setCarInformation(carInformation);
|
|
||||||
faultCodeCache.setFaultCode(faultCode);
|
|
||||||
FaultLabel faultLabel = new FaultLabel();
|
|
||||||
faultLabel.setMessageTypeId(faultConditionListResp.getMessageTypeId());
|
|
||||||
faultLabel.setMessageTypeName(faultConditionListResp.getMessageTypeName());
|
|
||||||
faultLabel.setMessageTypeCode(faultConditionListResp.getMessageTypeCode());
|
|
||||||
faultCodeCache.setFaultLabels(faultLabel);
|
|
||||||
vehicleCacheFaultCodeAddService.put(vehicleCacheFaultCodeAddService
|
|
||||||
.keyPre()+carInformation
|
|
||||||
.getCarInformationVIN(),faultCodeCache);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障规则添加 判断故障规则是否存在
|
* 故障规则添加 判断故障规则是否存在
|
||||||
|
@ -115,7 +90,6 @@ public class FaultConditionServiceImpl
|
||||||
queryWrapper.eq(FaultCondition::getCarTypeId,faultConditionAddReq.getCarTypeId())
|
queryWrapper.eq(FaultCondition::getCarTypeId,faultConditionAddReq.getCarTypeId())
|
||||||
.eq(FaultCondition::getMessageTypeId,faultConditionAddReq.getMessageTypeId());
|
.eq(FaultCondition::getMessageTypeId,faultConditionAddReq.getMessageTypeId());
|
||||||
List<FaultCondition> list = this.list(queryWrapper);
|
List<FaultCondition> list = this.list(queryWrapper);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,4 +98,67 @@ public class FaultConditionServiceImpl
|
||||||
List<FaultCondition> list = this.list();
|
List<FaultCondition> list = this.list();
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加缓存
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void RunCarCondition() {
|
||||||
|
List<FaultCondition> list = this.saveFaultConditionList();
|
||||||
|
text(list, carInformationService, carFenceService, warnStrategyService, faultCodeService, faultLabelService, vehicleCacheFaultCodeAddService);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void text(List<FaultCondition> list, CarInformationService carInformationService, CarFenceService carFenceService, WarnStrategyService warnStrategyService, FaultCodeService faultCodeService, FaultLabelService faultLabelService, VehicleCacheFaultCodeAddService vehicleCacheFaultCodeAddService) {
|
||||||
|
list.forEach(faultCondition -> {
|
||||||
|
List<CarInformation> carInformationList = carInformationService.selectCarInformation(faultCondition.getCarTypeId());
|
||||||
|
carInformationList.forEach(carInformation -> {
|
||||||
|
FaultCodeCache faultCodeCache = new FaultCodeCache();
|
||||||
|
if (StringUtils.isNotNull(carInformation.getCarInformationFence())){
|
||||||
|
faultCodeCache.setCarFences(carFenceService.CarFenceList(carInformation.getCarInformationFence()));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(carInformation.getCarInformationState())) {
|
||||||
|
faultCodeCache.setWarnStrategies(warnStrategyService
|
||||||
|
.selectWarnStrategyById(Long.valueOf(carInformation.getCarInformationState())));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(faultCondition.getMessageTypeId())) {
|
||||||
|
faultCodeCache.setFaultCode(faultCodeService.faultCodeList(faultCondition.getMessageTypeId()));
|
||||||
|
faultCodeCache.setFaultLabels(faultLabelService.faultLabelList(faultCondition.getMessageTypeId()));
|
||||||
|
}
|
||||||
|
ArrayList<CarInformation> carInformations = new ArrayList<>();
|
||||||
|
carInformations.add(carInformation);
|
||||||
|
faultCodeCache.setCarInformation(carInformations);
|
||||||
|
vehicleCacheFaultCodeAddService.put(vehicleCacheFaultCodeAddService
|
||||||
|
.keyPre()+carInformation
|
||||||
|
.getCarInformationVIN(), faultCodeCache);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// private void faultCache(long messageTypeId, Long faulttypeId,String faultcodeNumber) {
|
||||||
|
// FaultCodeCache faultCodeCache = new FaultCodeCache();
|
||||||
|
//
|
||||||
|
// //添加故障标签
|
||||||
|
// faultCodeCache.getFaultLabels().addAll(faultLabelService.selectFaultCode(messageTypeId));
|
||||||
|
//
|
||||||
|
// //添加车辆
|
||||||
|
// List<CarInformation> carInformationList = carInformationService.selectCarInformation(faulttypeId);
|
||||||
|
// faultCodeCache.getCarInformation().addAll(carInformationList);
|
||||||
|
//
|
||||||
|
// //添加故障码
|
||||||
|
// faultCodeCache.getFaultCode().addAll(this.list(new LambdaQueryWrapper<FaultCode>()
|
||||||
|
// .eq(FaultCode::getFaultcodeNumber, faultcodeNumber))
|
||||||
|
// .stream().map(FaultCode::faultCodeBuilder)
|
||||||
|
// .toList());
|
||||||
|
//
|
||||||
|
// //添加围栏
|
||||||
|
// ArrayList<CarFence> carFences1 = new ArrayList<>();
|
||||||
|
// carInformationList.forEach(carInformation -> {
|
||||||
|
// CarFence carFence = carFenceService.selectCarFenceList(carInformation.getCarInformationFence());
|
||||||
|
// carFences1.add(carFence);
|
||||||
|
// });
|
||||||
|
// faultCodeCache.getCarFences().addAll(carFences1);
|
||||||
|
// vehicleCacheFaultCodeAddService.put(vehicleCacheFaultCodeAddService.keyPre()
|
||||||
|
// + ObtainRootLogin.obtain()
|
||||||
|
// , faultCodeCache);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,11 @@ package com.muyu.server.service.impl;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.domain.CarInformation;
|
|
||||||
import com.muyu.domain.CarType;
|
import com.muyu.domain.CarType;
|
||||||
import com.muyu.domain.WarnStrategy;
|
import com.muyu.domain.WarnStrategy;
|
||||||
import com.muyu.domain.req.WarnStrategyReq;
|
import com.muyu.domain.req.WarnStrategyReq;
|
||||||
import com.muyu.enterprise.cache.warn.VehicleCacheWarnService;
|
|
||||||
import com.muyu.server.mapper.WarnStrategyMapper;
|
import com.muyu.server.mapper.WarnStrategyMapper;
|
||||||
import com.muyu.server.service.CarInformationService;
|
|
||||||
import com.muyu.server.service.WarnStrategyService;
|
import com.muyu.server.service.WarnStrategyService;
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
@ -27,14 +23,10 @@ import java.util.List;
|
||||||
* @Date:2024/9/20 下午7:29
|
* @Date:2024/9/20 下午7:29
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
|
||||||
public class WarnStrategyServiceImpl
|
public class WarnStrategyServiceImpl
|
||||||
extends ServiceImpl<WarnStrategyMapper, WarnStrategy>
|
extends ServiceImpl<WarnStrategyMapper, WarnStrategy>
|
||||||
implements WarnStrategyService {
|
implements WarnStrategyService {
|
||||||
|
|
||||||
private final CarInformationService carInformationService;
|
|
||||||
private final VehicleCacheWarnService vehicleCacheWarnService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 精确查询预警策略
|
* 精确查询预警策略
|
||||||
*
|
*
|
||||||
|
@ -70,16 +62,7 @@ public class WarnStrategyServiceImpl
|
||||||
if (StringUtils.isNotNull(warnStrategy.getMsgId())){
|
if (StringUtils.isNotNull(warnStrategy.getMsgId())){
|
||||||
queryWrapper.eq(WarnStrategy::getMsgId, warnStrategy.getMsgId());
|
queryWrapper.eq(WarnStrategy::getMsgId, warnStrategy.getMsgId());
|
||||||
}
|
}
|
||||||
List<WarnStrategy> list = this.list(queryWrapper);
|
return this.list(queryWrapper);
|
||||||
list.forEach(warnStrategy1 -> {
|
|
||||||
List<CarInformation> list1 = carInformationService
|
|
||||||
.list(new LambdaQueryWrapper<CarInformation>()
|
|
||||||
.eq(CarInformation::getCarInformationType, warnStrategy1.getCarTypeId()));
|
|
||||||
list1.forEach(carInformation -> {
|
|
||||||
vehicleCacheWarnService.put(vehicleCacheWarnService.keyPre()+carInformation.getCarInformationVIN(),list);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.muyu.server.util;
|
||||||
|
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.domain.*;
|
||||||
|
import com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService;
|
||||||
|
import com.muyu.server.service.*;
|
||||||
|
import com.muyu.server.service.impl.FaultConditionServiceImpl;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录存储redis缓存
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.server.util
|
||||||
|
* @Project:cloud-server-8
|
||||||
|
* @name:RunCarCondition
|
||||||
|
* @Date:2024/10/7 19:43
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RunCarCondition {
|
||||||
|
|
||||||
|
private final VehicleCacheFaultCodeAddService vehicleCacheFaultCodeAddService;
|
||||||
|
private final FaultConditionService faultConditionService;
|
||||||
|
private final CarInformationService carInformationService;
|
||||||
|
private final CarFenceService carFenceService;
|
||||||
|
private final WarnStrategyService warnStrategyService;
|
||||||
|
private final FaultCodeService faultCodeService;
|
||||||
|
private final FaultLabelService faultLabelService;
|
||||||
|
|
||||||
|
@GetMapping("text")
|
||||||
|
public void runCarCondition(){
|
||||||
|
List<FaultCondition> list = faultConditionService.saveFaultConditionList();
|
||||||
|
FaultConditionServiceImpl.text(list, carInformationService, carFenceService, warnStrategyService, faultCodeService, faultLabelService, vehicleCacheFaultCodeAddService);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue