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