Compare commits
2 Commits
6e4b268730
...
015d7c0896
Author | SHA1 | Date |
---|---|---|
|
015d7c0896 | |
|
bb56bc2393 |
|
@ -0,0 +1,26 @@
|
||||||
|
package com.muyu.enterprise.cache.faultCode;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBasic;
|
||||||
|
import com.muyu.domain.FaultCodeCache;
|
||||||
|
import com.muyu.domain.req.CarInformationAddReq;
|
||||||
|
import com.muyu.domain.req.FaultCodeAddReq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加车辆信息
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.cache
|
||||||
|
* @Project:cloud-server-8
|
||||||
|
* @name:VehicleCacheService
|
||||||
|
* @Date:2024/9/30 11:50
|
||||||
|
*/
|
||||||
|
public class VehicleCacheFaultCodeAddService extends CacheAbsBasic<String, FaultCodeCache> {
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "FaultCodeCache:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("vehicle:info:","");
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,3 +3,4 @@ com.muyu.enterprise.cache.car.VehicleCacheCarInformationRespService
|
||||||
com.muyu.enterprise.cache.car.VehicleCacheCarInformationAddService
|
com.muyu.enterprise.cache.car.VehicleCacheCarInformationAddService
|
||||||
com.muyu.enterprise.cache.car.VehicleCacheCarInformationUpdService
|
com.muyu.enterprise.cache.car.VehicleCacheCarInformationUpdService
|
||||||
com.muyu.enterprise.cache.car.VehicleCacheCarInformationFenceRespService
|
com.muyu.enterprise.cache.car.VehicleCacheCarInformationFenceRespService
|
||||||
|
com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService
|
||||||
|
|
|
@ -71,8 +71,8 @@ public class CarInformation {
|
||||||
/**
|
/**
|
||||||
* 车辆类型外键ID
|
* 车辆类型外键ID
|
||||||
*/
|
*/
|
||||||
@Schema(title = "车辆类型外键ID", type = "Integer")
|
// @Schema(title = "车辆类型外键ID", type = "Long")
|
||||||
private Integer carInformationType;
|
private Long carInformationType;
|
||||||
/**
|
/**
|
||||||
* 车辆品牌
|
* 车辆品牌
|
||||||
*/
|
*/
|
||||||
|
@ -107,6 +107,13 @@ public class CarInformation {
|
||||||
*/
|
*/
|
||||||
private Integer carInformationState;
|
private Integer carInformationState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆策略id
|
||||||
|
*/
|
||||||
|
private Integer carStrategyId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static CarInformation carInformationBuilder(CarInformation carInformation) {
|
public static CarInformation carInformationBuilder(CarInformation carInformation) {
|
||||||
return CarInformation.builder()
|
return CarInformation.builder()
|
||||||
.carInformationId(carInformation.getCarInformationId())
|
.carInformationId(carInformation.getCarInformationId())
|
||||||
|
@ -147,4 +154,23 @@ public class CarInformation {
|
||||||
.carInformationMotorModel(carInformation.getCarInformationMotorModel())
|
.carInformationMotorModel(carInformation.getCarInformationMotorModel())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CarInformation carInformationListBuilder(CarInformation carInformation) {
|
||||||
|
return CarInformation.builder()
|
||||||
|
.carInformationId(carInformation.getCarInformationId())
|
||||||
|
.carInformationVIN(carInformation.getCarInformationVIN())
|
||||||
|
.carInformationLicensePlate(carInformation.getCarInformationLicensePlate())
|
||||||
|
.carInformationBrand(carInformation.getCarInformationBrand())
|
||||||
|
.carInformationColor(carInformation.getCarInformationColor())
|
||||||
|
.carInformationDriver(carInformation.getCarInformationDriver())
|
||||||
|
.carInformationMotorManufacturer(carInformation.getCarInformationMotorManufacturer())
|
||||||
|
.carInformationMotorModel(carInformation.getCarInformationMotorModel())
|
||||||
|
.carInformationBatteryManufacturer(carInformation.getCarInformationBatteryManufacturer())
|
||||||
|
.carInformationBatteryModel(carInformation.getCarInformationBatteryModel())
|
||||||
|
.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){
|
public static FaultCode addfaultcode(FaultCodeAddReq faultCodeAddReq){
|
||||||
return FaultCode.builder()
|
return FaultCode.builder()
|
||||||
.faultcodeId(0)
|
.faultcodeId(faultCodeAddReq.getFaultcodeId())
|
||||||
.messageTypeId(faultCodeAddReq.getMessageTypeId())
|
.messageTypeId(faultCodeAddReq.getMessageTypeId())
|
||||||
.faultcodeNumber(faultCodeAddReq.getFaultcodeNumber())
|
.faultcodeNumber(faultCodeAddReq.getFaultcodeNumber())
|
||||||
.faultGroup(faultCodeAddReq.getFaultGroup())
|
.faultGroup(faultCodeAddReq.getFaultGroup())
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障码,电子围栏,车辆,报文
|
||||||
|
* @Author:yang
|
||||||
|
* @Package:com.muyu.domain
|
||||||
|
* @Project:cloud-server-8
|
||||||
|
* @name:FaultCodeCache
|
||||||
|
* @Date:2024/10/6 16:07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@Tag(name = "故障码,电子围栏,车辆,报文")
|
||||||
|
public class FaultCodeCache {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏信息
|
||||||
|
*/
|
||||||
|
private List<CarFence> carFences;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障标签信息
|
||||||
|
*/
|
||||||
|
private WarnStrategy warnStrategies;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆信息
|
||||||
|
*/
|
||||||
|
public List<CarInformation> carInformation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障码信息
|
||||||
|
*/
|
||||||
|
private List<FaultCode> faultCode;
|
||||||
|
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.muyu.domain.req.FaultConditionAddReq;
|
import com.muyu.domain.req.FaultConditionAddReq;
|
||||||
import com.muyu.domain.req.FaultConditionUpdReq;
|
import com.muyu.domain.req.FaultConditionUpdReq;
|
||||||
|
import com.muyu.domain.resp.FaultConditionTotalListResp;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -39,7 +40,7 @@ public class FaultCondition {
|
||||||
/**
|
/**
|
||||||
* 车辆类型Id
|
* 车辆类型Id
|
||||||
*/
|
*/
|
||||||
private long carTypeId;
|
private Long carTypeId;
|
||||||
/**
|
/**
|
||||||
*故障名称Id
|
*故障名称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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,16 +47,22 @@ public class FaultLabel {
|
||||||
private String messageTypeBelongs;
|
private String messageTypeBelongs;
|
||||||
|
|
||||||
|
|
||||||
public static FaultLabel addfaultLabel(FaultCodeAddReq faultCodeAddReq){
|
public static FaultLabel addfaultLabel(FaultLabel faultLabel){
|
||||||
return FaultLabel.builder()
|
return FaultLabel.builder()
|
||||||
.messageTypeId(0)
|
.messageTypeId(faultLabel.getMessageTypeId())
|
||||||
.messageTypeId(faultCodeAddReq.getMessageTypeId())
|
.messageTypeCode(faultLabel.getMessageTypeCode())
|
||||||
.messageTypeCode(faultCodeAddReq.getMessageTypeCode())
|
.messageTypeName(faultLabel.getMessageTypeName())
|
||||||
.messageTypeName(faultCodeAddReq.getMessageTypeName())
|
.messageTypeBelongs(faultLabel.getMessageTypeBelongs())
|
||||||
.messageTypeBelongs(faultCodeAddReq.getMessageTypeBelongs())
|
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static FaultLabel selectFaultLabel(FaultLabel faultLabel) {
|
||||||
|
return FaultLabel.builder()
|
||||||
|
.messageTypeId(faultLabel.messageTypeId)
|
||||||
|
.messageTypeCode(faultLabel.messageTypeCode)
|
||||||
|
.messageTypeName(faultLabel.messageTypeName)
|
||||||
|
.messageTypeBelongs(faultLabel.messageTypeBelongs)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class CarInformationAddReq {
|
||||||
/**
|
/**
|
||||||
* 车辆类型外键ID
|
* 车辆类型外键ID
|
||||||
*/
|
*/
|
||||||
private Integer carInformationType;
|
private Long carInformationType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class CarInformationUpdReq {
|
||||||
* 车辆类型外键ID
|
* 车辆类型外键ID
|
||||||
*/
|
*/
|
||||||
@Schema(title = "车辆类型外键ID", type = "Integer")
|
@Schema(title = "车辆类型外键ID", type = "Integer")
|
||||||
private Integer carInformationType;
|
private Long carInformationType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否重点车辆 (0否默认 1是 )
|
* 是否重点车辆 (0否默认 1是 )
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.domain.req;
|
package com.muyu.domain.req;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -21,6 +23,10 @@ import lombok.experimental.SuperBuilder;
|
||||||
@Builder
|
@Builder
|
||||||
public class FaultCodeAddReq {
|
public class FaultCodeAddReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*故障码Id
|
||||||
|
*/
|
||||||
|
private long faultcodeId;
|
||||||
/**
|
/**
|
||||||
*故障名称Id
|
*故障名称Id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class FaultConditionListResp {
|
||||||
* 车辆类型Id
|
* 车辆类型Id
|
||||||
*/
|
*/
|
||||||
private long carTypeId;
|
private long carTypeId;
|
||||||
/**
|
/**
|
||||||
*故障名称Id
|
*故障名称Id
|
||||||
*/
|
*/
|
||||||
private long messageTypeId;
|
private long messageTypeId;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.muyu.domain.req.FaultCodeUpdReq;
|
||||||
import com.muyu.domain.resp.FaultCodeTotalListResp;
|
import com.muyu.domain.resp.FaultCodeTotalListResp;
|
||||||
import com.muyu.server.service.FaultCodeService;
|
import com.muyu.server.service.FaultCodeService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -24,12 +25,14 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/faultcode")
|
@RequestMapping("/faultcode")
|
||||||
|
@Tag(name = "车辆故障码控制层",description = "从故障信息表中查询数据")
|
||||||
public class FaultCodeController {
|
public class FaultCodeController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FaultCodeService faultCodeService;
|
private FaultCodeService faultCodeService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障码展示(故障码联查)
|
* 故障码展示(故障码联查)
|
||||||
* @param faultCodeListReq
|
* @param faultCodeListReq
|
||||||
|
@ -51,6 +54,7 @@ public class FaultCodeController {
|
||||||
@PostMapping("/faultcodeadd")
|
@PostMapping("/faultcodeadd")
|
||||||
@Operation(summary = "新增故障码",description = "新增故障码信息")
|
@Operation(summary = "新增故障码",description = "新增故障码信息")
|
||||||
public Result insertfaultcode(@Validated @RequestBody FaultCodeAddReq faultCodeAddReq){
|
public Result insertfaultcode(@Validated @RequestBody FaultCodeAddReq faultCodeAddReq){
|
||||||
|
|
||||||
faultCodeService.insert(faultCodeAddReq);
|
faultCodeService.insert(faultCodeAddReq);
|
||||||
return Result.success(null,"新增成功");
|
return Result.success(null,"新增成功");
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class FaultConditionController {
|
||||||
if (faultConditionList.size()>0){
|
if (faultConditionList.size()>0){
|
||||||
return Result.error("此车辆类型已存在所对应的故障规则,无需重新制定,可在原规则上进行修改");
|
return Result.error("此车辆类型已存在所对应的故障规则,无需重新制定,可在原规则上进行修改");
|
||||||
}
|
}
|
||||||
faultConditionService.save(FaultCondition.faultConditionadd(faultConditionAddReq));
|
faultConditionService.saveFaultCondition(FaultCondition.faultConditionadd(faultConditionAddReq));
|
||||||
return Result.success(null,"规则制定成功");
|
return Result.success(null,"规则制定成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,4 +49,9 @@ public interface CarFenceService extends IService<CarFence> {
|
||||||
* 查询车辆围栏组信息
|
* 查询车辆围栏组信息
|
||||||
*/
|
*/
|
||||||
List<CarFenceGroupsResp> carGroupList(CarFenceGroupReq req);
|
List<CarFenceGroupsResp> carGroupList(CarFenceGroupReq req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆围栏信息
|
||||||
|
*/
|
||||||
|
List<CarFence> CarFenceList(Integer carInformationFence);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,4 +68,9 @@ public interface CarInformationService extends IService<CarInformation> {
|
||||||
*/
|
*/
|
||||||
List<CarInformationResp> selectBycarInformationIDAndLicensePlate();
|
List<CarInformationResp> selectBycarInformationIDAndLicensePlate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* chaxunCar
|
||||||
|
* @param faulttypeId
|
||||||
|
*/
|
||||||
|
List<CarInformation> selectCarInformation(Long faulttypeId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ import com.muyu.domain.req.FaultCodeListReq;
|
||||||
import com.muyu.domain.req.FaultCodeUpdReq;
|
import com.muyu.domain.req.FaultCodeUpdReq;
|
||||||
import com.muyu.domain.resp.FaultCodeTotalListResp;
|
import com.muyu.domain.resp.FaultCodeTotalListResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆故障码业务层
|
* 车辆故障码业务层
|
||||||
|
@ -50,4 +52,10 @@ public interface FaultCodeService extends IService<FaultCode> {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void del(Integer messageTypeId);
|
void del(Integer messageTypeId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障码展示(故障码联查)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<FaultCode> faultCodeList(long messageTypeId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,4 +32,12 @@ public interface FaultConditionService extends IService<FaultCondition> {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<FaultCondition> selectBytypeAndlabel(FaultConditionAddReq faultConditionAddReq);
|
List<FaultCondition> selectBytypeAndlabel(FaultConditionAddReq faultConditionAddReq);
|
||||||
|
|
||||||
|
void saveFaultCondition(FaultCondition faultCondition);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则查询
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<FaultCondition> saveFaultConditionList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,10 @@ public interface FaultLabelService extends IService<FaultLabel> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加故障项表
|
* 添加故障项表
|
||||||
* @param faultCodeAddReq
|
* @param faultLabel
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Integer insertfaultlabel(FaultCodeAddReq faultCodeAddReq);
|
Integer insertfaultlabel(FaultLabel faultLabel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除对应的故障名称表信息
|
* 删除对应的故障名称表信息
|
||||||
|
@ -42,4 +42,5 @@ public interface FaultLabelService extends IService<FaultLabel> {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Integer delfaultlabel(Integer messageTypeId);
|
Integer delfaultlabel(Integer messageTypeId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,4 +316,12 @@ public class CarFenceServiceImpl
|
||||||
});
|
});
|
||||||
return fenceGroupList;
|
return fenceGroupList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CarFence> CarFenceList(Integer carInformationFence) {
|
||||||
|
return this.list(new LambdaQueryWrapper<CarFence>().eq(CarFence::getId,carInformationFence))
|
||||||
|
.stream()
|
||||||
|
.map(CarFence::carFenceBuild)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.server.service.impl;
|
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.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
@ -149,4 +150,14 @@ public class CarInformationServiceImpl
|
||||||
return carInformationResps;
|
return carInformationResps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CarInformation> selectCarInformation(Long faulttypeId) {
|
||||||
|
List<CarInformation> list = this.list(new LambdaQueryWrapper<CarInformation>()
|
||||||
|
.eq(CarInformation::getCarInformationType, faulttypeId))
|
||||||
|
.stream()
|
||||||
|
.map(CarInformation::carInformationListBuilder)
|
||||||
|
.toList();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,20 +5,25 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.domain.FaultCode;
|
import com.muyu.domain.*;
|
||||||
import com.muyu.domain.FaultLabel;
|
|
||||||
import com.muyu.domain.req.FaultCodeAddReq;
|
import com.muyu.domain.req.FaultCodeAddReq;
|
||||||
import com.muyu.domain.req.FaultCodeListReq;
|
import com.muyu.domain.req.FaultCodeListReq;
|
||||||
import com.muyu.domain.req.FaultCodeUpdReq;
|
import com.muyu.domain.req.FaultCodeUpdReq;
|
||||||
import com.muyu.domain.resp.FaultCodeListResp;
|
import com.muyu.domain.resp.FaultCodeListResp;
|
||||||
import com.muyu.domain.resp.FaultCodeTotalListResp;
|
import com.muyu.domain.resp.FaultCodeTotalListResp;
|
||||||
import com.muyu.domain.resp.FaultConditionListResp;
|
import com.muyu.domain.resp.FaultConditionListResp;
|
||||||
|
import com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService;
|
||||||
import com.muyu.server.mapper.FaultCodeMapper;
|
import com.muyu.server.mapper.FaultCodeMapper;
|
||||||
|
import com.muyu.server.service.CarFenceService;
|
||||||
|
import com.muyu.server.service.CarInformationService;
|
||||||
import com.muyu.server.service.FaultCodeService;
|
import com.muyu.server.service.FaultCodeService;
|
||||||
import com.muyu.server.service.FaultLabelService;
|
import com.muyu.server.service.FaultLabelService;
|
||||||
|
import com.muyu.server.util.ObtainRootLogin;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,12 +35,13 @@ import java.util.List;
|
||||||
* @Date:2024/9/17 14:53
|
* @Date:2024/9/17 14:53
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode> implements FaultCodeService {
|
public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode> implements FaultCodeService {
|
||||||
@Autowired
|
|
||||||
private FaultCodeMapper faultCodeMapper;
|
|
||||||
@Autowired
|
|
||||||
private FaultLabelService faultLabelService;
|
|
||||||
|
|
||||||
|
private final FaultCodeMapper faultCodeMapper;
|
||||||
|
private final FaultLabelService faultLabelService;
|
||||||
|
private final CarInformationService carInformationService;
|
||||||
|
private final CarFenceService carFenceService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障码展示(故障码联查)
|
* 故障码展示(故障码联查)
|
||||||
|
@ -92,8 +98,13 @@ public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode
|
||||||
}
|
}
|
||||||
|
|
||||||
if (faultLabel==null && faultCode==null){
|
if (faultLabel==null && faultCode==null){
|
||||||
|
|
||||||
//添加故障项表
|
//添加故障项表
|
||||||
faultLabelService.insertfaultlabel(faultCodeAddReq);
|
FaultLabel faultLabel1 = new FaultLabel();
|
||||||
|
faultLabel1.setMessageTypeName(faultCodeAddReq.getMessageTypeName());
|
||||||
|
faultLabel1.setMessageTypeCode(faultCodeAddReq.getMessageTypeCode());
|
||||||
|
faultLabel1.setMessageTypeBelongs(faultCodeAddReq.getMessageTypeBelongs());
|
||||||
|
faultLabelService.insertfaultlabel(faultLabel1);
|
||||||
//添加故障码表
|
//添加故障码表
|
||||||
faultCodeMapper.insert(FaultCode.addfaultcode(faultCodeAddReq));
|
faultCodeMapper.insert(FaultCode.addfaultcode(faultCodeAddReq));
|
||||||
}
|
}
|
||||||
|
@ -120,10 +131,24 @@ public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode
|
||||||
public void del(Integer messageTypeId) {
|
public void del(Integer messageTypeId) {
|
||||||
// 使用LambdaQueryWrapper来构建查询条件
|
// 使用LambdaQueryWrapper来构建查询条件
|
||||||
LambdaQueryWrapper<FaultCode> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<FaultCode> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(FaultCode::getMessageTypeId, messageTypeId); // 假设FaultCode实体类中有一个getMessageTypeId方法
|
// 假设FaultCode实体类中有一个getMessageTypeId方法
|
||||||
|
queryWrapper.eq(FaultCode::getMessageTypeId, messageTypeId);
|
||||||
//删除故障码表信息
|
//删除故障码表信息
|
||||||
faultCodeMapper.delete(queryWrapper);
|
faultCodeMapper.delete(queryWrapper);
|
||||||
//删除对应的故障名称表信息
|
//删除对应的故障名称表信息
|
||||||
faultLabelService.delfaultlabel(messageTypeId);
|
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.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.muyu.domain.CarType;
|
import com.muyu.domain.*;
|
||||||
import com.muyu.domain.FaultCode;
|
|
||||||
import com.muyu.domain.FaultCondition;
|
|
||||||
import com.muyu.domain.FaultLabel;
|
|
||||||
import com.muyu.domain.req.FaultConditionAddReq;
|
import com.muyu.domain.req.FaultConditionAddReq;
|
||||||
import com.muyu.domain.req.FaultConditionListReq;
|
import com.muyu.domain.req.FaultConditionListReq;
|
||||||
import com.muyu.domain.resp.FaultConditionListResp;
|
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.domain.resp.FaultLogListResp;
|
||||||
import com.muyu.server.mapper.FaultConditionMapper;
|
import com.muyu.server.mapper.FaultConditionMapper;
|
||||||
import com.muyu.server.service.FaultConditionService;
|
import com.muyu.server.service.FaultConditionService;
|
||||||
|
import com.muyu.server.util.ObtainRootLogin;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +29,9 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class FaultConditionServiceImpl extends ServiceImpl<FaultConditionMapper, FaultCondition> implements FaultConditionService {
|
public class FaultConditionServiceImpl
|
||||||
|
extends ServiceImpl<FaultConditionMapper, FaultCondition>
|
||||||
|
implements FaultConditionService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FaultConditionMapper faultConditionMapper;
|
private FaultConditionMapper faultConditionMapper;
|
||||||
|
@ -83,4 +84,42 @@ public class FaultConditionServiceImpl extends ServiceImpl<FaultConditionMapper,
|
||||||
List<FaultCondition> list = this.list(queryWrapper);
|
List<FaultCondition> list = this.list(queryWrapper);
|
||||||
return list;
|
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
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Integer insertfaultlabel(FaultCodeAddReq faultCodeAddReq) {
|
public Integer insertfaultlabel(FaultLabel faultLabel) {
|
||||||
return faultLabelMapper.insert(FaultLabel.addfaultLabel(faultCodeAddReq));
|
return this.save(faultLabel)?1:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,7 +73,9 @@ public class FaultLabelServiceImpl extends ServiceImpl<FaultLabelMapper, FaultLa
|
||||||
public Integer delfaultlabel(Integer messageTypeId) {
|
public Integer delfaultlabel(Integer messageTypeId) {
|
||||||
// 使用LambdaQueryWrapper来构建查询条件
|
// 使用LambdaQueryWrapper来构建查询条件
|
||||||
LambdaQueryWrapper<FaultLabel> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<FaultLabel> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(FaultLabel::getMessageTypeId, messageTypeId); // 假设FaultCode实体类中有一个getMessageTypeId方法
|
// 假设FaultCode实体类中有一个getMessageTypeId方法
|
||||||
|
queryWrapper.eq(FaultLabel::getMessageTypeId, messageTypeId);
|
||||||
return faultLabelMapper.delete(queryWrapper);
|
return faultLabelMapper.delete(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class FaultRuleServiceImpl extends ServiceImpl<FaultRuleMapper, CarFaultR
|
||||||
new LambdaQueryWrapper<CarInformation>()
|
new LambdaQueryWrapper<CarInformation>()
|
||||||
.eq(CarInformation::getCarInformationVIN, carFaultRule.getVin()));
|
.eq(CarInformation::getCarInformationVIN, carFaultRule.getVin()));
|
||||||
//根据车辆类型,查询表获取对应的类型的故障规则
|
//根据车辆类型,查询表获取对应的类型的故障规则
|
||||||
Integer carInformationType = null;
|
Long carInformationType = null;
|
||||||
for (CarInformation carInformation : carInformationList) {
|
for (CarInformation carInformation : carInformationList) {
|
||||||
carInformationType= carInformation.getCarInformationType();
|
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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue