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.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;
|
||||
|
@ -34,12 +35,16 @@ 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
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,8 +3,14 @@ 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;
|
||||
|
||||
/**车辆上线消费者
|
||||
|
@ -25,24 +31,21 @@ 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("gateway", true);
|
||||
return new Queue("test", true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@ -53,8 +56,8 @@ public class CarOnlineConsumer {
|
|||
.with(VehicleGatewayConstants.VEHICLE_GETAWAY_ROUTING_KEY);
|
||||
}
|
||||
|
||||
@RabbitListener(queues = "gateway")
|
||||
public void msg(@RequestBody WebHookConnection webHookConnection){
|
||||
log.info("消费者接收到车辆上线信息:{}",webHookConnection);
|
||||
}*/
|
||||
@RabbitListener(queues = "test")
|
||||
public void msg(String msg){
|
||||
log.info(msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,9 @@ 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,8 +1,11 @@
|
|||
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,21 +1,23 @@
|
|||
package com.muyu.enterprise.cache.car;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBasic;
|
||||
import com.muyu.domain.CarFence;
|
||||
import com.muyu.domain.CarType;
|
||||
import com.muyu.domain.req.CarInformationAddReq;
|
||||
import com.muyu.domain.resp.CarInformationResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆类型表缓存
|
||||
* 车辆基础信息列表缓存
|
||||
* @Author:yang
|
||||
* @Package:com.muyu.cache
|
||||
* @Project:cloud-server-8
|
||||
* @name:VehicleCacheService
|
||||
* @Date:2024/9/30 11:50
|
||||
*/
|
||||
public class VehicleCacheCarTypeService extends CacheAbsBasic<String, CarType> {
|
||||
public class VehicleCacheCarInformationFenceRespService extends CacheAbsBasic<String, List<CarInformationResp>> {
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "CarType:info:";
|
||||
return "CarInformationFenceResp:info:";
|
||||
}
|
||||
|
||||
@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.domain.CarFence;
|
||||
import com.muyu.domain.CarInformation;
|
||||
import com.muyu.domain.resp.CarFenceResp;
|
||||
import com.muyu.domain.resp.CarInformationResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电子围栏缓存
|
||||
* 分页查询车辆信息
|
||||
* @Author:yang
|
||||
* @Package:com.muyu.cache
|
||||
* @Project:cloud-server-8
|
||||
* @name:VehicleCacheService
|
||||
* @Date:2024/9/30 11:50
|
||||
*/
|
||||
public class VehicleCacheFenceService extends CacheAbsBasic<String, CarFenceResp> {
|
||||
public class VehicleCacheCarInformationRespService extends CacheAbsBasic<String, Page<CarInformationResp>> {
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "CarFenceResp:info:";
|
||||
return "CarInformationResp:info:";
|
||||
}
|
||||
|
||||
@Override
|
|
@ -1,20 +1,20 @@
|
|||
package com.muyu.enterprise.cache.car;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBasic;
|
||||
import com.muyu.domain.resp.CarInformationResp;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.domain.CarInformation;
|
||||
import com.muyu.domain.resp.CarFenceGroupResp;
|
||||
|
||||
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<CarInformationResp>> {
|
||||
public class VehicleCacheCarInformationService extends CacheAbsBasic<String, List<CarInformation>> {
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "CarInformation:info:";
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
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,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;
|
||||
|
||||
/**
|
||||
* 添加故障码缓存
|
||||
* 添加车辆信息
|
||||
* @Author:yang
|
||||
* @Package:com.muyu.cache
|
||||
* @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.VehicleCacheCarInformationRespService
|
||||
com.muyu.enterprise.cache.car.VehicleCacheCarInformationAddService
|
||||
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.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;
|
||||
|
||||
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;
|
||||
|
@ -27,7 +25,6 @@ public class CarFenceClazz {
|
|||
/**
|
||||
* 业务类型ID
|
||||
*/
|
||||
@TableId(value = "clazz_id",type = IdType.AUTO)
|
||||
private Integer clazzId;
|
||||
/**
|
||||
* 业务类型名称
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
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;
|
||||
|
@ -27,7 +25,6 @@ public class CarFenceType {
|
|||
/**
|
||||
* 围栏类型ID
|
||||
*/
|
||||
@TableId(value = "type_id",type = IdType.AUTO)
|
||||
private Integer typeId;
|
||||
/**
|
||||
* 围栏类型名称
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
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;
|
||||
|
@ -27,7 +25,6 @@ public class CarMessage {
|
|||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
@TableId(value = "message_type_id",type = IdType.AUTO)
|
||||
private Long messageTypeId;
|
||||
/**
|
||||
* 报文编码
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
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;
|
||||
|
@ -28,8 +26,7 @@ public class CarType {
|
|||
/**
|
||||
* 车辆类型ID
|
||||
*/
|
||||
@TableId(value = "car_type_id",type = IdType.AUTO)
|
||||
private Long carTypeId;
|
||||
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(0L)
|
||||
.faultcodeId(0)
|
||||
.messageTypeId(faultCodeUpdReq.getMessageTypeId())
|
||||
.faultcodeNumber(faultCodeUpdReq.getFaultcodeNumber())
|
||||
.faultGroup(faultCodeUpdReq.getFaultGroup())
|
||||
|
|
|
@ -23,15 +23,25 @@ import java.util.List;
|
|||
@Tag(name = "故障码,电子围栏,车辆,报文")
|
||||
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
|
||||
*/
|
||||
@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,6 +44,11 @@
|
|||
<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>
|
||||
|
@ -94,6 +99,11 @@
|
|||
<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,7 +7,6 @@ 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;
|
||||
|
@ -24,12 +23,12 @@ import java.util.List;
|
|||
*/
|
||||
@RequestMapping("/carFenceClazz")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@Tag(name = "查询数据",description = "从围栏信息表中查询数据")
|
||||
@Log4j2
|
||||
public class CarFenceClazzController {
|
||||
|
||||
@Autowired
|
||||
private CarFenceClazzService carFenceClazzService;
|
||||
private final CarFenceClazzService carFenceClazzService;
|
||||
|
||||
/**
|
||||
* 查询围栏类型信息
|
||||
|
|
|
@ -43,8 +43,7 @@ public class CarFenceController {
|
|||
@Validated @RequestBody CarFenceReq req
|
||||
){
|
||||
Page<CarFenceResp> connects = carFenceService.selectCarFence(req);
|
||||
|
||||
log.info("查询数据:"+ connects);
|
||||
log.info("查询数据:"+ connects);
|
||||
|
||||
return Result.success(
|
||||
connects, "操作成功"
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
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.VehicleCacheCarInformationAddService;
|
||||
import com.muyu.enterprise.cache.car.VehicleCacheCarInformationService;
|
||||
import com.muyu.enterprise.cache.car.VehicleCacheCarInformationUpdService;
|
||||
import com.muyu.enterprise.cache.car.*;
|
||||
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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -33,25 +34,33 @@ import java.util.List;
|
|||
public class CarInformationController {
|
||||
@Resource
|
||||
private CarInformationService carInformationService;
|
||||
@Autowired
|
||||
private VehicleCacheCarInformationService vehicleCacheCarInformationService;
|
||||
@Autowired
|
||||
private VehicleCacheCarInformationRespService vehicleCacheCarInformationRespService;
|
||||
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, "操作成功"
|
||||
);
|
||||
|
@ -79,14 +88,18 @@ 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);
|
||||
List<CarInformationResp> records = pageInfo.getRecords();
|
||||
records.forEach(carInformation -> {
|
||||
vehicleCacheCarInformationService.put(
|
||||
vehicleCacheCarInformationService.keyPre()+carInformation.getCarInformationVIN()
|
||||
,records);
|
||||
});
|
||||
vehicleCacheCarInformationRespService.put(
|
||||
vehicleCacheCarInformationRespService.keyPre()+ObtainRootLogin.obtain()
|
||||
,pageInfo);
|
||||
return Result.success(pageInfo);
|
||||
|
||||
}
|
||||
|
@ -103,7 +116,7 @@ public class CarInformationController {
|
|||
|
||||
vehicleCacheCarInformationAddService.put(
|
||||
vehicleCacheCarInformationAddService
|
||||
.keyPre()+carInformationAddReq.getCarInformationVIN(), carInformationAddReq);
|
||||
.keyPre()+ObtainRootLogin.obtain(), carInformationAddReq);
|
||||
return carInformationService.addCarInformation(carInformationAddReq)
|
||||
?Result.success("添加车辆成功")
|
||||
:Result.error(402,"添加车辆失败");
|
||||
|
@ -156,8 +169,17 @@ 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,21 +1,16 @@
|
|||
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 lombok.AllArgsConstructor;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* 车辆类型控制层
|
||||
|
@ -28,12 +23,10 @@ import java.util.Locale;
|
|||
|
||||
@RequestMapping("/cartype")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class CarTypeController {
|
||||
|
||||
private final CarTypeService carTypeService;
|
||||
private final CarInformationService carInformationService;
|
||||
private final VehicleCacheCarTypeService vehicleCacheCarTypeService;
|
||||
@Autowired
|
||||
private CarTypeService carTypeService;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -45,16 +38,7 @@ 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 lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -25,12 +25,11 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
@RestController
|
||||
@RequestMapping("/faultcode")
|
||||
@AllArgsConstructor
|
||||
@Tag(name = "车辆故障码控制层",description = "从故障信息表中查询数据")
|
||||
public class FaultCodeController {
|
||||
|
||||
private final FaultCodeService faultCodeService;
|
||||
|
||||
@Autowired
|
||||
private FaultCodeService faultCodeService;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -59,7 +59,10 @@ public class FaultConditionController {
|
|||
if (faultConditionList.size()>0){
|
||||
return Result.error("此车辆类型已存在所对应的故障规则,无需重新制定,可在原规则上进行修改");
|
||||
}
|
||||
faultConditionService.save(FaultCondition.faultConditionadd(faultConditionAddReq));
|
||||
boolean save = faultConditionService.save(FaultCondition.faultConditionadd(faultConditionAddReq));
|
||||
if (save){
|
||||
faultConditionService.RunCarCondition();
|
||||
}
|
||||
return Result.success(null,"规则制定成功");
|
||||
}
|
||||
|
||||
|
|
|
@ -39,4 +39,8 @@ public interface FaultConditionService extends IService<FaultCondition> {
|
|||
*/
|
||||
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.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;
|
||||
|
@ -31,7 +28,6 @@ import java.util.List;
|
|||
*/
|
||||
@Service
|
||||
@Log4j2
|
||||
@AllArgsConstructor
|
||||
public class CarFenceServiceImpl
|
||||
extends ServiceImpl<CarFenceMapper, CarFence>
|
||||
implements CarFenceService {
|
||||
|
@ -48,8 +44,6 @@ public class CarFenceServiceImpl
|
|||
private CarMiddleSerivce carMiddleSerivce;
|
||||
@Autowired
|
||||
private CarInformationService carInformationService;
|
||||
private final VehicleCacheFenceService vehicleCacheFenceService;
|
||||
private final VehicleCacheFenceAddService vehicleCacheFenceAddService;
|
||||
/**
|
||||
* 查询围栏信息
|
||||
*/
|
||||
|
@ -89,9 +83,8 @@ public class CarFenceServiceImpl
|
|||
.toList();
|
||||
List<CarFence> carFenceList = carFencePage.getRecords();
|
||||
this.optimizeEntity(carFenceList,carFenceClazzList,carFenceTypeList);
|
||||
|
||||
//构建一个新的分页响应对象
|
||||
Page<CarFenceResp> carFenceRespPage = new Page<>() {{
|
||||
return new Page<>() {{
|
||||
//从查询结果中获取记录,并使用流式处理将每条记录转换为EtlDataScoreResp对象
|
||||
List<CarFenceResp> etlDataScoreRespList = carFencePage.getRecords().stream()
|
||||
//使用map操作将EtlDataScore对象转换为EtlDataScoreResp对象
|
||||
|
@ -107,17 +100,6 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,12 +118,6 @@ 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,24 +1,29 @@
|
|||
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.FaultCode;
|
||||
import com.muyu.domain.FaultLabel;
|
||||
import com.muyu.domain.*;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -49,7 +54,7 @@ public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode
|
|||
long count = this.count(queryWrapper);
|
||||
|
||||
MPJLambdaWrapper<FaultCode> wrapper = new MPJLambdaWrapper<>();
|
||||
MPJLambdaWrapper<FaultCode> eq = wrapper.select(
|
||||
wrapper.select(
|
||||
FaultCode::getFaultcodeId,
|
||||
FaultCode::getMessageTypeId,
|
||||
FaultCode::getFaultcodeNumber,
|
||||
|
@ -59,9 +64,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,6 +3,7 @@ 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;
|
||||
|
@ -11,11 +12,12 @@ 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;
|
||||
|
||||
/**
|
||||
|
@ -35,12 +37,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;
|
||||
|
||||
|
||||
|
||||
|
@ -72,36 +74,9 @@ 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);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 故障规则添加 判断故障规则是否存在
|
||||
|
@ -115,7 +90,6 @@ public class FaultConditionServiceImpl
|
|||
queryWrapper.eq(FaultCondition::getCarTypeId,faultConditionAddReq.getCarTypeId())
|
||||
.eq(FaultCondition::getMessageTypeId,faultConditionAddReq.getMessageTypeId());
|
||||
List<FaultCondition> list = this.list(queryWrapper);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -124,4 +98,67 @@ 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,15 +3,11 @@ 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;
|
||||
|
||||
|
@ -27,14 +23,10 @@ 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;
|
||||
|
||||
/**
|
||||
* 精确查询预警策略
|
||||
*
|
||||
|
@ -70,16 +62,7 @@ public class WarnStrategyServiceImpl
|
|||
if (StringUtils.isNotNull(warnStrategy.getMsgId())){
|
||||
queryWrapper.eq(WarnStrategy::getMsgId, warnStrategy.getMsgId());
|
||||
}
|
||||
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;
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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