fine()添加故障缓存
parent
bb56bc2393
commit
015d7c0896
|
@ -4,7 +4,7 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 159.75.188.178:8848
|
||||
addr: 127.0.0.1:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: eight
|
||||
|
|
|
@ -4,7 +4,7 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 159.75.188.178:8848
|
||||
addr: 127.0.0.1:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: eight
|
||||
|
|
|
@ -4,7 +4,7 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 159.75.188.178:8848
|
||||
addr: 127.0.0.1:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: eight
|
||||
|
|
|
@ -4,7 +4,7 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 159.75.188.178:8848
|
||||
addr: 127.0.0.1:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: eight
|
||||
|
|
|
@ -71,8 +71,8 @@ public class CarInformation {
|
|||
/**
|
||||
* 车辆类型外键ID
|
||||
*/
|
||||
@Schema(title = "车辆类型外键ID", type = "Integer")
|
||||
private Integer carInformationType;
|
||||
// @Schema(title = "车辆类型外键ID", type = "Long")
|
||||
private Long carInformationType;
|
||||
/**
|
||||
* 车辆品牌
|
||||
*/
|
||||
|
@ -107,6 +107,13 @@ public class CarInformation {
|
|||
*/
|
||||
private Integer carInformationState;
|
||||
|
||||
/**
|
||||
* 车辆策略id
|
||||
*/
|
||||
private Integer carStrategyId;
|
||||
|
||||
|
||||
|
||||
public static CarInformation carInformationBuilder(CarInformation carInformation) {
|
||||
return CarInformation.builder()
|
||||
.carInformationId(carInformation.getCarInformationId())
|
||||
|
@ -163,6 +170,7 @@ public class CarInformation {
|
|||
.carInformationFence(carInformation.getCarInformationFence())
|
||||
.carInformationType(carInformation.getCarInformationType())
|
||||
.carInformationMotorModel(carInformation.getCarInformationMotorModel())
|
||||
.carStrategyId(carInformation.getCarStrategyId())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public class FaultCode {
|
|||
|
||||
public static FaultCode addfaultcode(FaultCodeAddReq faultCodeAddReq){
|
||||
return FaultCode.builder()
|
||||
.faultcodeId(0)
|
||||
.faultcodeId(faultCodeAddReq.getFaultcodeId())
|
||||
.messageTypeId(faultCodeAddReq.getMessageTypeId())
|
||||
.faultcodeNumber(faultCodeAddReq.getFaultcodeNumber())
|
||||
.faultGroup(faultCodeAddReq.getFaultGroup())
|
||||
|
|
|
@ -31,7 +31,7 @@ public class FaultCodeCache {
|
|||
/**
|
||||
* 故障标签信息
|
||||
*/
|
||||
private List<FaultLabel> faultLabels;
|
||||
private WarnStrategy warnStrategies;
|
||||
|
||||
/**
|
||||
* 车辆信息
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.domain.req.FaultConditionAddReq;
|
||||
import com.muyu.domain.req.FaultConditionUpdReq;
|
||||
import com.muyu.domain.resp.FaultConditionTotalListResp;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
@ -39,7 +40,7 @@ public class FaultCondition {
|
|||
/**
|
||||
* 车辆类型Id
|
||||
*/
|
||||
private long carTypeId;
|
||||
private Long carTypeId;
|
||||
/**
|
||||
*故障名称Id
|
||||
*/
|
||||
|
@ -89,7 +90,11 @@ public class FaultCondition {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static FaultCondition faultConditionBuilder(FaultCondition faultCondition) {
|
||||
return FaultCondition.builder()
|
||||
.carconditionId(faultCondition.getCarconditionId())
|
||||
.carTypeId(faultCondition.getCarTypeId())
|
||||
.messageTypeId(faultCondition.getMessageTypeId())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ public class FaultLabel {
|
|||
|
||||
public static FaultLabel addfaultLabel(FaultLabel faultLabel){
|
||||
return FaultLabel.builder()
|
||||
.messageTypeId(0)
|
||||
.messageTypeId(faultLabel.getMessageTypeId())
|
||||
.messageTypeCode(faultLabel.getMessageTypeCode())
|
||||
.messageTypeName(faultLabel.getMessageTypeName())
|
||||
|
|
|
@ -78,7 +78,7 @@ public class CarInformationAddReq {
|
|||
/**
|
||||
* 车辆类型外键ID
|
||||
*/
|
||||
private Integer carInformationType;
|
||||
private Long carInformationType;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class CarInformationUpdReq {
|
|||
* 车辆类型外键ID
|
||||
*/
|
||||
@Schema(title = "车辆类型外键ID", type = "Integer")
|
||||
private Integer carInformationType;
|
||||
private Long carInformationType;
|
||||
|
||||
/**
|
||||
* 是否重点车辆 (0否默认 1是 )
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.muyu.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -21,6 +23,10 @@ import lombok.experimental.SuperBuilder;
|
|||
@Builder
|
||||
public class FaultCodeAddReq {
|
||||
|
||||
/**
|
||||
*故障码Id
|
||||
*/
|
||||
private long faultcodeId;
|
||||
/**
|
||||
*故障名称Id
|
||||
*/
|
||||
|
|
|
@ -31,7 +31,7 @@ public class FaultConditionListResp {
|
|||
* 车辆类型Id
|
||||
*/
|
||||
private long carTypeId;
|
||||
/**
|
||||
/**
|
||||
*故障名称Id
|
||||
*/
|
||||
private long messageTypeId;
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.muyu.domain.req.FaultCodeUpdReq;
|
|||
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 org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
@RestController
|
||||
@RequestMapping("/faultcode")
|
||||
@Tag(name = "车辆故障码控制层",description = "从故障信息表中查询数据")
|
||||
public class FaultCodeController {
|
||||
|
||||
@Autowired
|
||||
|
|
|
@ -59,7 +59,7 @@ public class FaultConditionController {
|
|||
if (faultConditionList.size()>0){
|
||||
return Result.error("此车辆类型已存在所对应的故障规则,无需重新制定,可在原规则上进行修改");
|
||||
}
|
||||
faultConditionService.save(FaultCondition.faultConditionadd(faultConditionAddReq));
|
||||
faultConditionService.saveFaultCondition(FaultCondition.faultConditionadd(faultConditionAddReq));
|
||||
return Result.success(null,"规则制定成功");
|
||||
}
|
||||
|
||||
|
|
|
@ -51,9 +51,7 @@ public interface CarFenceService extends IService<CarFence> {
|
|||
List<CarFenceGroupsResp> carGroupList(CarFenceGroupReq req);
|
||||
|
||||
/**
|
||||
* 查询围栏信息
|
||||
* @param carInformationFence
|
||||
* @return
|
||||
* 查询车辆围栏信息
|
||||
*/
|
||||
CarFence selectCarFenceList(Integer carInformationFence);
|
||||
List<CarFence> CarFenceList(Integer carInformationFence);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ import com.muyu.domain.req.FaultCodeListReq;
|
|||
import com.muyu.domain.req.FaultCodeUpdReq;
|
||||
import com.muyu.domain.resp.FaultCodeTotalListResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 车辆故障码业务层
|
||||
|
@ -50,4 +52,10 @@ public interface FaultCodeService extends IService<FaultCode> {
|
|||
* @return
|
||||
*/
|
||||
void del(Integer messageTypeId);
|
||||
|
||||
/**
|
||||
* 故障码展示(故障码联查)
|
||||
* @return
|
||||
*/
|
||||
List<FaultCode> faultCodeList(long messageTypeId);
|
||||
}
|
||||
|
|
|
@ -32,4 +32,12 @@ public interface FaultConditionService extends IService<FaultCondition> {
|
|||
* @return
|
||||
*/
|
||||
List<FaultCondition> selectBytypeAndlabel(FaultConditionAddReq faultConditionAddReq);
|
||||
|
||||
void saveFaultCondition(FaultCondition faultCondition);
|
||||
|
||||
/**
|
||||
* 故障规则查询
|
||||
* @return
|
||||
*/
|
||||
List<FaultCondition> saveFaultConditionList();
|
||||
}
|
||||
|
|
|
@ -43,5 +43,4 @@ public interface FaultLabelService extends IService<FaultLabel> {
|
|||
*/
|
||||
Integer delfaultlabel(Integer messageTypeId);
|
||||
|
||||
List<FaultLabel> selectFaultCode(long messageTypeId);
|
||||
}
|
||||
|
|
|
@ -318,24 +318,10 @@ public class CarFenceServiceImpl
|
|||
}
|
||||
|
||||
@Override
|
||||
public CarFence selectCarFenceList(Integer carInformationFence) {
|
||||
List<CarFence> list = this.list(new LambdaQueryWrapper<CarFence>()
|
||||
.eq(CarFence::getId, carInformationFence))
|
||||
public List<CarFence> CarFenceList(Integer carInformationFence) {
|
||||
return this.list(new LambdaQueryWrapper<CarFence>().eq(CarFence::getId,carInformationFence))
|
||||
.stream()
|
||||
.map(CarFence::carFenceBuild)
|
||||
.toList();
|
||||
CarFence carFence1 = new CarFence();
|
||||
list.forEach(carFence -> {
|
||||
carFence1.setId(carFence.getId());
|
||||
carFence1.setName(carFence.getName());
|
||||
carFence1.setFenceText(carFence.getFenceText());
|
||||
carFence1.setClazzId(carFence.getClazzId());
|
||||
carFence1.setFenceEnd(carFence.getFenceEnd());
|
||||
carFence1.setFenceCreate(carFence.getFenceCreate());
|
||||
carFence1.setTypeId(carFence.getTypeId());
|
||||
carFence1.setFenceStart(carFence.getFenceStart());
|
||||
carFence1.setMiddleId(carFence.getMiddleId());
|
||||
});
|
||||
return carFence1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,11 +152,12 @@ public class CarInformationServiceImpl
|
|||
|
||||
@Override
|
||||
public List<CarInformation> selectCarInformation(Long faulttypeId) {
|
||||
return this.list(new LambdaQueryWrapper<CarInformation>()
|
||||
.eq(CarInformation::getCarInformationType, faulttypeId))
|
||||
List<CarInformation> list = this.list(new LambdaQueryWrapper<CarInformation>()
|
||||
.eq(CarInformation::getCarInformationType, faulttypeId))
|
||||
.stream()
|
||||
.map(CarInformation::carInformationListBuilder)
|
||||
.toList();
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ 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;
|
||||
|
||||
|
@ -34,14 +35,13 @@ import java.util.List;
|
|||
* @Date:2024/9/17 14:53
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode> implements FaultCodeService {
|
||||
@Autowired
|
||||
private FaultCodeMapper faultCodeMapper;
|
||||
@Autowired
|
||||
private FaultLabelService faultLabelService;
|
||||
private VehicleCacheFaultCodeAddService vehicleCacheFaultCodeAddService;
|
||||
private CarInformationService carInformationService;
|
||||
private CarFenceService carFenceService;
|
||||
|
||||
private final FaultCodeMapper faultCodeMapper;
|
||||
private final FaultLabelService faultLabelService;
|
||||
private final CarInformationService carInformationService;
|
||||
private final CarFenceService carFenceService;
|
||||
|
||||
/**
|
||||
* 故障码展示(故障码联查)
|
||||
|
@ -107,42 +107,9 @@ public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode
|
|||
faultLabelService.insertfaultlabel(faultLabel1);
|
||||
//添加故障码表
|
||||
faultCodeMapper.insert(FaultCode.addfaultcode(faultCodeAddReq));
|
||||
|
||||
|
||||
this.faultCache(faultLabel1.getMessageTypeId()
|
||||
,faultCodeAddReq.getFaulttypeId()
|
||||
,faultCodeAddReq.getFaultcodeNumber());
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改故障码
|
||||
|
@ -164,10 +131,24 @@ public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode
|
|||
public void del(Integer messageTypeId) {
|
||||
// 使用LambdaQueryWrapper来构建查询条件
|
||||
LambdaQueryWrapper<FaultCode> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(FaultCode::getMessageTypeId, messageTypeId); // 假设FaultCode实体类中有一个getMessageTypeId方法
|
||||
// 假设FaultCode实体类中有一个getMessageTypeId方法
|
||||
queryWrapper.eq(FaultCode::getMessageTypeId, messageTypeId);
|
||||
//删除故障码表信息
|
||||
faultCodeMapper.delete(queryWrapper);
|
||||
//删除对应的故障名称表信息
|
||||
faultLabelService.delfaultlabel(messageTypeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 故障码展示(故障码联查)
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<FaultCode> faultCodeList(long messageTypeId) {
|
||||
return this.list(new LambdaQueryWrapper<FaultCode>()
|
||||
.eq(FaultCode::getMessageTypeId,messageTypeId))
|
||||
.stream()
|
||||
.map(FaultCode::faultCodeBuilder)
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,7 @@ 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.domain.CarType;
|
||||
import com.muyu.domain.FaultCode;
|
||||
import com.muyu.domain.FaultCondition;
|
||||
import com.muyu.domain.FaultLabel;
|
||||
import com.muyu.domain.*;
|
||||
import com.muyu.domain.req.FaultConditionAddReq;
|
||||
import com.muyu.domain.req.FaultConditionListReq;
|
||||
import com.muyu.domain.resp.FaultConditionListResp;
|
||||
|
@ -15,9 +12,11 @@ import com.muyu.domain.resp.FaultConditionTotalListResp;
|
|||
import com.muyu.domain.resp.FaultLogListResp;
|
||||
import com.muyu.server.mapper.FaultConditionMapper;
|
||||
import com.muyu.server.service.FaultConditionService;
|
||||
import com.muyu.server.util.ObtainRootLogin;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -30,7 +29,9 @@ import java.util.List;
|
|||
*/
|
||||
|
||||
@Service
|
||||
public class FaultConditionServiceImpl extends ServiceImpl<FaultConditionMapper, FaultCondition> implements FaultConditionService {
|
||||
public class FaultConditionServiceImpl
|
||||
extends ServiceImpl<FaultConditionMapper, FaultCondition>
|
||||
implements FaultConditionService {
|
||||
|
||||
@Autowired
|
||||
private FaultConditionMapper faultConditionMapper;
|
||||
|
@ -83,4 +84,42 @@ public class FaultConditionServiceImpl extends ServiceImpl<FaultConditionMapper,
|
|||
List<FaultCondition> list = this.list(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveFaultCondition(FaultCondition faultCondition) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FaultCondition> saveFaultConditionList() {
|
||||
return this.list().stream().map(FaultCondition::faultConditionBuilder).toList();
|
||||
}
|
||||
|
||||
// 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);
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -56,12 +56,12 @@ public class FaultLabelServiceImpl extends ServiceImpl<FaultLabelMapper, FaultLa
|
|||
|
||||
/**
|
||||
* 添加故障项表
|
||||
* @param faultCodeAddReq
|
||||
* @param faultLabel
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Integer insertfaultlabel(FaultLabel faultLabel) {
|
||||
return faultLabelMapper.insert(FaultLabel.addfaultLabel(faultLabel));
|
||||
return this.save(faultLabel)?1:0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,12 +78,4 @@ public class FaultLabelServiceImpl extends ServiceImpl<FaultLabelMapper, FaultLa
|
|||
return faultLabelMapper.delete(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FaultLabel> selectFaultCode(long messageTypeId) {
|
||||
|
||||
return this.list(new LambdaQueryWrapper<FaultLabel>()
|
||||
.eq(FaultLabel::getMessageTypeId,messageTypeId))
|
||||
.stream().map(FaultLabel::selectFaultLabel)
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class FaultRuleServiceImpl extends ServiceImpl<FaultRuleMapper, CarFaultR
|
|||
new LambdaQueryWrapper<CarInformation>()
|
||||
.eq(CarInformation::getCarInformationVIN, carFaultRule.getVin()));
|
||||
//根据车辆类型,查询表获取对应的类型的故障规则
|
||||
Integer carInformationType = null;
|
||||
Long carInformationType = null;
|
||||
for (CarInformation carInformation : carInformationList) {
|
||||
carInformationType= carInformation.getCarInformationType();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
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 lombok.AllArgsConstructor;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.AbstractList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:yang
|
||||
* @Package:com.muyu.server.util
|
||||
* @Project:cloud-server-8
|
||||
* @name:RunCarCondition
|
||||
* @Date:2024/10/7 19:43
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class RunCarCondition implements ApplicationRunner {
|
||||
|
||||
private final VehicleCacheFaultCodeAddService vehicleCacheFaultCodeAddService;
|
||||
private final FaultConditionService faultConditionService;
|
||||
private final CarInformationService carInformationService;
|
||||
private final CarFenceService carFenceService;
|
||||
private final WarnStrategyService warnStrategyService;
|
||||
private final FaultCodeService faultCodeService;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
List<FaultCondition> list = faultConditionService.saveFaultConditionList();
|
||||
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()));
|
||||
}
|
||||
ArrayList<CarInformation> carInformations = new ArrayList<>();
|
||||
carInformations.add(carInformation);
|
||||
faultCodeCache.setCarInformation(carInformations);
|
||||
vehicleCacheFaultCodeAddService.put(vehicleCacheFaultCodeAddService
|
||||
.keyPre()+carInformation
|
||||
.getCarInformationVIN(), faultCodeCache);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 159.75.188.178:8848
|
||||
addr: 127.0.0.1:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: eight
|
||||
|
|
|
@ -4,7 +4,7 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 159.75.188.178:8848
|
||||
addr: 127.0.0.1:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: eight
|
||||
|
|
|
@ -4,7 +4,7 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 159.75.188.178:8848
|
||||
addr: 127.0.0.1:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: eight
|
||||
|
|
|
@ -4,7 +4,7 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 159.75.188.178:8848
|
||||
addr: 127.0.0.1:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: eight
|
||||
|
|
|
@ -4,7 +4,7 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 159.75.188.178:8848
|
||||
addr: 127.0.0.1:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: eight
|
||||
|
|
Loading…
Reference in New Issue