fix():优化故障规则
parent
c08a1376d6
commit
e3709fbcbb
|
@ -1,8 +1,7 @@
|
||||||
package com.muyu.enterprise.cache;
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
import com.muyu.enterprise.domain.FaultRule;
|
import com.muyu.enterprise.domain.CarFaultRule;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* redis故障业务层
|
* redis故障业务层
|
||||||
|
@ -11,16 +10,16 @@ import org.springframework.stereotype.Component;
|
||||||
* @Date 2024/10/3 15:22
|
* @Date 2024/10/3 15:22
|
||||||
* @author MingWei.Zong
|
* @author MingWei.Zong
|
||||||
*/
|
*/
|
||||||
public class CarFaultCacheService extends CacheAbsBasic<String, FaultRule> {
|
public class CarFaultCacheService extends CacheAbsBasic<String, CarFaultRule> {
|
||||||
@Override
|
@Override
|
||||||
public String keyPre() {
|
public String keyPre() {
|
||||||
return "faultRule:info:";
|
return "carFaultRule:info:";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String decode(String key) {
|
public String decode(String key) {
|
||||||
return key.replace("faultRule:info:","");
|
return key.replace("carFaultRule:info:","");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,14 +14,14 @@ import com.muyu.enterprise.domain.CarManage;
|
||||||
public class CarManageCacheService extends CacheAbsBasic<String, CarManage> {
|
public class CarManageCacheService extends CacheAbsBasic<String, CarManage> {
|
||||||
@Override
|
@Override
|
||||||
public String keyPre() {
|
public String keyPre() {
|
||||||
return "carManage:info:";
|
return "CarManage:info:";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String decode(String key) {
|
public String decode(String key) {
|
||||||
return key.replace("carManage:info:","");
|
return key.replace("CarManage:info:","");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,5 +3,5 @@ com.muyu.enterprise.cache.CarFaultCacheService
|
||||||
com.muyu.enterprise.cache.CarManageCacheService
|
com.muyu.enterprise.cache.CarManageCacheService
|
||||||
com.muyu.enterprise.cache.CarMessageCacheService
|
com.muyu.enterprise.cache.CarMessageCacheService
|
||||||
com.muyu.enterprise.cache.CarTemplateCacheService
|
com.muyu.enterprise.cache.CarTemplateCacheService
|
||||||
com.muyu.enterprise.cache.CarWarnCacheServic
|
com.muyu.enterprise.cache.CarWarnCacheService
|
||||||
com.muyu.enterprise.cache.ElectronicFenceCacheService
|
com.muyu.enterprise.cache.ElectronicFenceCacheService
|
||||||
|
|
|
@ -0,0 +1,216 @@
|
||||||
|
package com.muyu.enterprise.domain;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 故障规则测试类(故障)
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.domain.faultrule
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:PureElectricCar
|
||||||
|
* @Date:2024/9/20 20:22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@Tag(name = "故障规则测试类")
|
||||||
|
public class CarFaultRule {
|
||||||
|
/**
|
||||||
|
* VIN码
|
||||||
|
*/
|
||||||
|
private String vin;
|
||||||
|
/**
|
||||||
|
* 时间戳
|
||||||
|
*/
|
||||||
|
private long timestamp;
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
|
private double longitude;
|
||||||
|
/**
|
||||||
|
* 纬度
|
||||||
|
*/
|
||||||
|
private double latitude;
|
||||||
|
/**
|
||||||
|
* 车速
|
||||||
|
*/
|
||||||
|
private double speed;
|
||||||
|
/**
|
||||||
|
* 总里程
|
||||||
|
*/
|
||||||
|
private long TM;
|
||||||
|
/**
|
||||||
|
* 总电压
|
||||||
|
*/
|
||||||
|
private double TV;
|
||||||
|
/**
|
||||||
|
* 总电流
|
||||||
|
*/
|
||||||
|
private double CC;
|
||||||
|
/**
|
||||||
|
* 绝缘电阻
|
||||||
|
*/
|
||||||
|
private double IR;
|
||||||
|
/**
|
||||||
|
* 档位
|
||||||
|
*/
|
||||||
|
private String GP;
|
||||||
|
/**
|
||||||
|
* 加速踏板行程值
|
||||||
|
*/
|
||||||
|
private double APTV;
|
||||||
|
/**
|
||||||
|
* 制动踏板行程值
|
||||||
|
*/
|
||||||
|
private double BPTV;
|
||||||
|
/**
|
||||||
|
* 燃料消耗率
|
||||||
|
*/
|
||||||
|
private double SFC;
|
||||||
|
/**
|
||||||
|
* 电机控制器温度
|
||||||
|
*/
|
||||||
|
private double MCT;
|
||||||
|
/**
|
||||||
|
* 电机转速
|
||||||
|
*/
|
||||||
|
private int MS;
|
||||||
|
/**
|
||||||
|
* 电机转矩
|
||||||
|
*/
|
||||||
|
private double MTO;
|
||||||
|
/**
|
||||||
|
* 电机温度
|
||||||
|
*/
|
||||||
|
private double MTE;
|
||||||
|
/**
|
||||||
|
* 电机电压
|
||||||
|
*/
|
||||||
|
private double MV;
|
||||||
|
/**
|
||||||
|
* 电机电流
|
||||||
|
*/
|
||||||
|
private double MC;
|
||||||
|
/**
|
||||||
|
* 动力电池剩余电量SOC
|
||||||
|
*/
|
||||||
|
private double PBRSOC;
|
||||||
|
/**
|
||||||
|
* 当前状态允许的最大反馈功率
|
||||||
|
*/
|
||||||
|
private double MACSFP;
|
||||||
|
/**
|
||||||
|
* 当前状态允许最大放电功率
|
||||||
|
*/
|
||||||
|
private double CSATMDP;
|
||||||
|
/**
|
||||||
|
* BMS自检计数器
|
||||||
|
*/
|
||||||
|
private int BMS;
|
||||||
|
/**
|
||||||
|
* 动力电池充放电电流
|
||||||
|
*/
|
||||||
|
private double CADC;
|
||||||
|
/**
|
||||||
|
* 动力电池负载端总电压V3
|
||||||
|
*/
|
||||||
|
private double PBLETVV3;
|
||||||
|
/**
|
||||||
|
* 单次最大电压
|
||||||
|
*/
|
||||||
|
private double SMV;
|
||||||
|
/**
|
||||||
|
* 单体电池最低电压
|
||||||
|
*/
|
||||||
|
private double MVOAB;
|
||||||
|
/**
|
||||||
|
* 单体电池最高温度
|
||||||
|
*/
|
||||||
|
private double MAXBT;
|
||||||
|
/**
|
||||||
|
* 单体电池最低温度
|
||||||
|
*/
|
||||||
|
private double MINBT;
|
||||||
|
/**
|
||||||
|
* 动力电池可用容量
|
||||||
|
*/
|
||||||
|
private double PBAC;
|
||||||
|
/**
|
||||||
|
* 车辆状态
|
||||||
|
*/
|
||||||
|
private String VS;
|
||||||
|
/**
|
||||||
|
* 充电状态
|
||||||
|
*/
|
||||||
|
private String CS;
|
||||||
|
/**
|
||||||
|
* 运行状态
|
||||||
|
*/
|
||||||
|
private String RS;
|
||||||
|
/**
|
||||||
|
* SOC
|
||||||
|
*/
|
||||||
|
private double SOC;
|
||||||
|
/**
|
||||||
|
* 可充电储能装置工作状态
|
||||||
|
*/
|
||||||
|
private String RESDWC;
|
||||||
|
/**
|
||||||
|
* EAS
|
||||||
|
*/
|
||||||
|
private String EAS;
|
||||||
|
/**
|
||||||
|
* PTC
|
||||||
|
*/
|
||||||
|
private String PTC;
|
||||||
|
/**
|
||||||
|
* EPS
|
||||||
|
*/
|
||||||
|
private String EPS;
|
||||||
|
/**
|
||||||
|
* ABS
|
||||||
|
*/
|
||||||
|
private String ABS;
|
||||||
|
/**
|
||||||
|
* MCU
|
||||||
|
*/
|
||||||
|
private String MCU;
|
||||||
|
/**
|
||||||
|
* 动力电池加热状态
|
||||||
|
*/
|
||||||
|
private String PBHS;
|
||||||
|
/**
|
||||||
|
* 动力电池当前状态
|
||||||
|
*/
|
||||||
|
private String PBCS;
|
||||||
|
/**
|
||||||
|
* 动力电池保温状态
|
||||||
|
*/
|
||||||
|
private String PBIS;
|
||||||
|
/**
|
||||||
|
* DCDC
|
||||||
|
*/
|
||||||
|
private String DCDC;
|
||||||
|
/**
|
||||||
|
* CHG
|
||||||
|
*/
|
||||||
|
private String CHG;
|
||||||
|
/**
|
||||||
|
* 校验位
|
||||||
|
*/
|
||||||
|
private byte CHB;
|
||||||
|
/**
|
||||||
|
* 截止位
|
||||||
|
*/
|
||||||
|
private byte CUB;
|
||||||
|
/**
|
||||||
|
* 起始位
|
||||||
|
*/
|
||||||
|
private byte SOH;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -107,5 +107,10 @@ public class CarManage {
|
||||||
*/
|
*/
|
||||||
private Long enterpriseId;
|
private Long enterpriseId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型ID
|
||||||
|
*/
|
||||||
|
private Long carTypeId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,10 @@ import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障规则
|
* 报文模版表
|
||||||
* @Author: chenruijia
|
* @Author: chenruijia
|
||||||
* @Date 2024/9/28 12.23
|
* @Date 2024/9/28 12.23
|
||||||
* @Description FaultRule:故障规则
|
* @Description CarTemplate:报文模版表
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class CarType {
|
||||||
* 车辆类型id
|
* 车辆类型id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "car_type_id",type = IdType.AUTO)
|
@TableId(value = "car_type_id",type = IdType.AUTO)
|
||||||
private Integer carTypeId;
|
private Long carTypeId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆类型名称
|
* 车辆类型名称
|
||||||
|
@ -38,7 +38,7 @@ public class CarType {
|
||||||
/**
|
/**
|
||||||
* 模板id
|
* 模板id
|
||||||
*/
|
*/
|
||||||
private Integer templateId;
|
private Long templateId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.muyu.enterprise.domain;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障查询信息结果返回对象
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.domain
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:Vehicle
|
||||||
|
* @Date:2024/9/20 20:44
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@Tag(name = "故障查询信息结果返回对象")
|
||||||
|
public class Cheak {
|
||||||
|
/**
|
||||||
|
* 车辆VIN 唯一标识
|
||||||
|
*/
|
||||||
|
private String VIN;
|
||||||
|
/**
|
||||||
|
* 故障信息
|
||||||
|
*/
|
||||||
|
private String faultmessage;
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.muyu.enterprise.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.enterprise.domain.req.FaultConditionAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.FaultConditionUpdReq;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.domain
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FaultCondition
|
||||||
|
* @Date:2024/9/21 19:51
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@TableName(value = "fault_condition",autoResultMap = true)
|
||||||
|
@Tag(name = "故障规则")
|
||||||
|
public class FaultCondition {
|
||||||
|
/**
|
||||||
|
* 故障规则表Id
|
||||||
|
*/
|
||||||
|
@TableId(value = "fault_condition_id",type = IdType.AUTO)
|
||||||
|
private long faultConditionId;
|
||||||
|
/**
|
||||||
|
* 车辆类型Id
|
||||||
|
*/
|
||||||
|
private long carTypeId;
|
||||||
|
/**
|
||||||
|
*故障名称Id
|
||||||
|
*/
|
||||||
|
private long messageId;
|
||||||
|
/**
|
||||||
|
* 故障条件
|
||||||
|
*/
|
||||||
|
private String faultConditionIdentification;
|
||||||
|
/**
|
||||||
|
* 故障规则参数
|
||||||
|
*/
|
||||||
|
private BigDecimal faultConditionParameter;
|
||||||
|
|
||||||
|
|
||||||
|
public static FaultCondition faultConditionadd(FaultConditionAddReq faultConditionAddReq){
|
||||||
|
return FaultCondition.builder()
|
||||||
|
.carTypeId(faultConditionAddReq.getCarTypeId())
|
||||||
|
.messageId(faultConditionAddReq.getMessageId())
|
||||||
|
.faultConditionIdentification(faultConditionAddReq.getFaultConditionIdentification())
|
||||||
|
.faultConditionParameter(faultConditionAddReq.getFaultConditionParameter())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FaultCondition faultConditionupd(FaultConditionUpdReq faultConditionUpdReq, Supplier<Long> idSupplier){
|
||||||
|
return FaultCondition.builder()
|
||||||
|
.faultConditionId(faultConditionUpdReq.getFaultConditionId())
|
||||||
|
.carTypeId(faultConditionUpdReq.getCarTypeId())
|
||||||
|
.messageId(faultConditionUpdReq.getMessageId())
|
||||||
|
.faultConditionIdentification(faultConditionUpdReq.getFaultConditionIdentification())
|
||||||
|
.faultConditionParameter(faultConditionUpdReq.getFaultConditionParameter())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.muyu.enterprise.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障标签
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.domain
|
||||||
|
* @Project:cloud-faultmanage
|
||||||
|
* @name:FaultLabel
|
||||||
|
* @Date:2024/9/17 15:06
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@TableName(value = "car_message_type",autoResultMap = true)
|
||||||
|
@Tag(name = "故障标签")
|
||||||
|
public class FaultLabel {
|
||||||
|
/**
|
||||||
|
*自增主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "message_type_id",type = IdType.AUTO)
|
||||||
|
private long messageTypeId;
|
||||||
|
/**
|
||||||
|
*报文编码
|
||||||
|
*/
|
||||||
|
@TableField(value = "message_code")
|
||||||
|
private String messageTypeCode;
|
||||||
|
/**
|
||||||
|
*报文名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "message_name")
|
||||||
|
private String messageTypeName;
|
||||||
|
/**
|
||||||
|
*报文所属类别
|
||||||
|
*/
|
||||||
|
@TableField(value = "message_type")
|
||||||
|
private String messageTypeBelongs;
|
||||||
|
|
||||||
|
private String messageClass;
|
||||||
|
|
||||||
|
|
||||||
|
public static FaultLabel addfaultLabel(FaultLabel faultLabel){
|
||||||
|
return FaultLabel.builder()
|
||||||
|
.messageTypeId(0)
|
||||||
|
.messageTypeId(faultLabel.getMessageTypeId())
|
||||||
|
.messageTypeCode(faultLabel.getMessageTypeCode())
|
||||||
|
.messageTypeName(faultLabel.getMessageTypeName())
|
||||||
|
.messageTypeBelongs(faultLabel.getMessageTypeBelongs())
|
||||||
|
.messageClass(faultLabel.getMessageClass())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static FaultLabel selectFaultLabel(FaultLabel faultLabel) {
|
||||||
|
return FaultLabel.builder()
|
||||||
|
.messageTypeId(faultLabel.messageTypeId)
|
||||||
|
.messageTypeCode(faultLabel.messageTypeCode)
|
||||||
|
.messageTypeName(faultLabel.messageTypeName)
|
||||||
|
.messageTypeBelongs(faultLabel.messageTypeBelongs)
|
||||||
|
.messageClass(faultLabel.messageClass)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,68 +0,0 @@
|
||||||
package com.muyu.enterprise.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import lombok.*;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
/**
|
|
||||||
* 故障规则
|
|
||||||
* @Author: chenruijia
|
|
||||||
* @Date 2024/9/28 12.23
|
|
||||||
* @Description FaultRule:故障规则
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@SuperBuilder
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@TableName(value = "fault_rule",autoResultMap = true)
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Tag(name = "故障规则")
|
|
||||||
public class FaultRule extends BaseEntity {
|
|
||||||
/**
|
|
||||||
* 故障规则ID
|
|
||||||
*/
|
|
||||||
@TableId(value = "fault_rule_id", type= IdType.AUTO)
|
|
||||||
@Schema(defaultValue = "故障规则ID",type = "Long",description = "故障规则ID")
|
|
||||||
private Long faultRuleId;
|
|
||||||
/**
|
|
||||||
* 车辆类型ID
|
|
||||||
*/
|
|
||||||
@Schema(defaultValue = "车辆类型ID",type = "Integer",description = "车辆类型ID")
|
|
||||||
private Integer carTypeId;
|
|
||||||
/**
|
|
||||||
* 故障名称ID
|
|
||||||
*/
|
|
||||||
@Schema(defaultValue = "故障名称ID",type = "Integer",description = "故障名称ID")
|
|
||||||
private Integer faultId;
|
|
||||||
/**
|
|
||||||
* 故障条件
|
|
||||||
*/
|
|
||||||
@Schema(defaultValue = "故障条件",type = "String",description = "故障条件")
|
|
||||||
private String faultConditions;
|
|
||||||
/**
|
|
||||||
* 故障规则参数
|
|
||||||
*/
|
|
||||||
@Schema(defaultValue = "故障规则参数",type = "String",description = "故障规则参数")
|
|
||||||
private String ruleParameters;
|
|
||||||
/**
|
|
||||||
* 车辆类型名称
|
|
||||||
*/
|
|
||||||
@Schema(defaultValue = "车辆类型名称",type = "String",description = "车辆类型名称")
|
|
||||||
private String carTypeName;
|
|
||||||
/**
|
|
||||||
* 故障名称
|
|
||||||
*/
|
|
||||||
@Schema(defaultValue = "故障名称",type = "String",description = "故障名称")
|
|
||||||
private String faultName;
|
|
||||||
/**
|
|
||||||
* 车辆VIN
|
|
||||||
*/
|
|
||||||
@Schema(defaultValue = "车辆VIN",type = "String",description = "车辆VIN")
|
|
||||||
private String carVin;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.muyu.enterprise.domain.req;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则制定请求对象
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.domain.req
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FaultConditionAddReq
|
||||||
|
* @Date:2024/9/21 21:02
|
||||||
|
*/
|
||||||
|
@Tag(name = "故障规则制定请求对象")
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class FaultConditionAddReq {
|
||||||
|
/**
|
||||||
|
* 故障规则表Id
|
||||||
|
*/
|
||||||
|
private long faultConditionId;
|
||||||
|
/**
|
||||||
|
* 车辆类型Id
|
||||||
|
*/
|
||||||
|
private long carTypeId;
|
||||||
|
/**
|
||||||
|
*故障名称Id
|
||||||
|
*/
|
||||||
|
private long messageId;
|
||||||
|
/**
|
||||||
|
* 故障条件
|
||||||
|
*/
|
||||||
|
private String faultConditionIdentification;
|
||||||
|
/**
|
||||||
|
* 故障规则参数
|
||||||
|
*/
|
||||||
|
private BigDecimal faultConditionParameter;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.muyu.enterprise.domain.req;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则列表条件查询请求对象
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.domain.req
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FaultCondition
|
||||||
|
* @Date:2024/9/21 20:02
|
||||||
|
*/
|
||||||
|
@Tag(name = "故障规则列表请求对象")
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class FaultConditionListReq {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型Id
|
||||||
|
*/
|
||||||
|
private long carTypeId;
|
||||||
|
/**
|
||||||
|
*故障名称Id
|
||||||
|
*/
|
||||||
|
private long messageId;
|
||||||
|
/**
|
||||||
|
* 页码,从1开始
|
||||||
|
*/
|
||||||
|
private Integer pageNum=1;
|
||||||
|
/**
|
||||||
|
* 每页大小
|
||||||
|
*/
|
||||||
|
private Integer pageSize=10;
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.muyu.enterprise.domain.req;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则修改请求对象
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.domain.req
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FaultConditionUpdReq
|
||||||
|
* @Date:2024/9/22 9:38
|
||||||
|
*/
|
||||||
|
@Tag(name = "故障规则修改请求对象")
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class FaultConditionUpdReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则表Id
|
||||||
|
*/
|
||||||
|
private long faultConditionId;
|
||||||
|
/**
|
||||||
|
* 车辆类型Id
|
||||||
|
*/
|
||||||
|
private long carTypeId;
|
||||||
|
/**
|
||||||
|
*故障名称Id
|
||||||
|
*/
|
||||||
|
private long messageId;
|
||||||
|
/**
|
||||||
|
* 故障条件
|
||||||
|
*/
|
||||||
|
private String faultConditionIdentification;
|
||||||
|
/**
|
||||||
|
* 故障规则参数
|
||||||
|
*/
|
||||||
|
private BigDecimal faultConditionParameter;
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.muyu.enterprise.domain.resp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.muyu.enterprise.domain.FaultCondition;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则信息响应对象
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.domain.resp
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FaultConditionResp
|
||||||
|
* @Date:2024/9/21 19:59
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Tag(name="故障规则信息响应对象",description = "故障规则查询的响应结果")
|
||||||
|
public class FaultConditionListResp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则表Id
|
||||||
|
*/
|
||||||
|
private long faultConditionId;
|
||||||
|
/**
|
||||||
|
* 车辆类型Id
|
||||||
|
*/
|
||||||
|
private long carTypeId;
|
||||||
|
/**
|
||||||
|
*故障名称Id
|
||||||
|
*/
|
||||||
|
private long messageId;
|
||||||
|
/**
|
||||||
|
* 故障条件
|
||||||
|
*/
|
||||||
|
private String faultConditionIdentification;
|
||||||
|
/**
|
||||||
|
* 故障规则参数
|
||||||
|
*/
|
||||||
|
private BigDecimal faultConditionParameter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据库对象构建为返回结果对象
|
||||||
|
* @param faultCondition
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static FaultConditionListResp faultConditionListResp(FaultCondition faultCondition){
|
||||||
|
return FaultConditionListResp.builder()
|
||||||
|
.faultConditionId(faultCondition.getFaultConditionId())
|
||||||
|
.carTypeId(faultCondition.getCarTypeId())
|
||||||
|
.messageId(faultCondition.getMessageId())
|
||||||
|
.faultConditionIdentification(faultCondition.getFaultConditionIdentification())
|
||||||
|
.faultConditionParameter(faultCondition.getFaultConditionParameter())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.muyu.enterprise.domain.resp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则表
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.domain.resp
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FaultConditionResp 故障规则表
|
||||||
|
* @Date:2024/9/28 16:53
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Tag(name="故障规则表",description = "数据响应")
|
||||||
|
public class FaultConditionResp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则表Id
|
||||||
|
*/
|
||||||
|
@TableId(value = "fault_condition_id",type = IdType.AUTO)
|
||||||
|
private long faultConditionId;
|
||||||
|
/**
|
||||||
|
* 车辆类型Id
|
||||||
|
*/
|
||||||
|
private long carTypeId;
|
||||||
|
/**
|
||||||
|
*故障名称Id
|
||||||
|
*/
|
||||||
|
private long messageId;
|
||||||
|
/**
|
||||||
|
* 故障条件
|
||||||
|
*/
|
||||||
|
private String faultConditionIdentification;
|
||||||
|
/**
|
||||||
|
* 故障规则参数
|
||||||
|
*/
|
||||||
|
private BigDecimal faultConditionParameter;
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.muyu.enterprise.domain.resp;
|
||||||
|
|
||||||
|
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:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.domain.resp
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FaultConditionTotalListResp
|
||||||
|
* @Date:2024/9/21 20:00
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Tag(name="故障规则数据总数列表",description = "数据和总数的响应")
|
||||||
|
public class FaultConditionTotalListResp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则信息集合
|
||||||
|
*/
|
||||||
|
private List<FaultConditionListResp> faultConditionListRespList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总数量
|
||||||
|
*/
|
||||||
|
private long total;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param faultConditionListRespList
|
||||||
|
* @param total
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static FaultConditionTotalListResp faultConditionTotalListResp(List<FaultConditionListResp> faultConditionListRespList,long total){
|
||||||
|
FaultConditionTotalListResp faultConditionTotalListResp = new FaultConditionTotalListResp();
|
||||||
|
faultConditionTotalListResp.setFaultConditionListRespList(faultConditionListRespList);
|
||||||
|
faultConditionTotalListResp.setTotal(total);
|
||||||
|
return faultConditionTotalListResp;
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,26 +16,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
public class CloudEnterpriseApplication {
|
public class CloudEnterpriseApplication {
|
||||||
public static void main (String[] args) {
|
public static void main (String[] args) {
|
||||||
SpringApplication.run(CloudEnterpriseApplication.class, args);
|
SpringApplication.run(CloudEnterpriseApplication.class, args);
|
||||||
System.out.println(" _ooOoo_\n" +
|
|
||||||
" o8888888o\n" +
|
|
||||||
" 88\" . \"88\n" +
|
|
||||||
" (| -_- |)\n" +
|
|
||||||
" O\\ = /O\n" +
|
|
||||||
" ____/`---'\\____\n" +
|
|
||||||
" .' \\\\| |// `.\n" +
|
|
||||||
" / \\\\||| : |||// \\\n" +
|
|
||||||
" / _||||| -:- |||||- \\\n" +
|
|
||||||
" | | \\\\\\ - /// | |\n" +
|
|
||||||
" | \\_| ''\\---/'' | |\n" +
|
|
||||||
" \\ .-\\__ `-` ___/-. /\n" +
|
|
||||||
" ___`. .' /--.--\\ `. . __\n" +
|
|
||||||
" .\"\" '< `.___\\_<|>_/___.' >'\"\".\n" +
|
|
||||||
" | | : `- \\`.;`\\ _ /`;.`/ - ` : | |\n" +
|
|
||||||
" \\ \\ `-. \\_ __\\ /__ _/ .-` / /\n" +
|
|
||||||
" ======`-.____`-.___\\_____/___.-`____.-'======\n" +
|
|
||||||
" `=---='\n" +
|
|
||||||
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
|
|
||||||
" // 佛祖保佑 永不宕机 永无BUG //");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,18 @@
|
||||||
package com.muyu.enterprise.controller;
|
package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.muyu.enterprise.cache.CarManageCacheService;
|
import com.muyu.enterprise.cache.CarManageCacheService;
|
||||||
import com.muyu.enterprise.domain.CarManage;
|
import com.muyu.enterprise.domain.CarManage;
|
||||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
import com.muyu.enterprise.domain.dto.CarDTO;
|
||||||
import com.muyu.enterprise.domain.vo.CarVO;
|
import com.muyu.enterprise.domain.vo.CarVO;
|
||||||
import com.muyu.enterprise.service.CarCompanyService;
|
import com.muyu.enterprise.service.CarCompanyService;
|
||||||
import com.muyu.enterprise.service.CarManageService;
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import com.muyu.enterprise.service.CarManageService;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -29,13 +25,13 @@ import java.util.List;
|
||||||
* @Date 2024/9/28 16:52
|
* @Date 2024/9/28 16:52
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/carManage")
|
@RequestMapping("/CarManage")
|
||||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
||||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
||||||
@Tag(name = "CarManageController", description = "车辆管理")
|
@Tag(name = "CarManageController", description = "车辆管理")
|
||||||
public class CarManageController extends BaseController {
|
public class CarManageController extends BaseController {
|
||||||
|
|
||||||
private final CarManageCacheService carManageCacheService;
|
private final CarManageCacheService CarManageCacheService;
|
||||||
|
|
||||||
private final CarCompanyService sysCarCompanyService;
|
private final CarCompanyService sysCarCompanyService;
|
||||||
|
|
||||||
|
@ -69,8 +65,8 @@ public class CarManageController extends BaseController {
|
||||||
* @param carId
|
* @param carId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("carManageShowByCarId")
|
@PostMapping("CarManageShowByCarId")
|
||||||
public Result carManageShowByCarId(@RequestParam("carId") Long carId){
|
public Result CarManageShowByCarId(@RequestParam("carId") Long carId){
|
||||||
return Result.success(sysCarService.getById(carId));
|
return Result.success(sysCarService.getById(carId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,5 +113,16 @@ public class CarManageController extends BaseController {
|
||||||
return Result.success("车辆删除成功");
|
return Result.success("车辆删除成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据VIN码查询车辆信息
|
||||||
|
* @param carVin
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/selectVin/{carVin}",method = RequestMethod.POST)
|
||||||
|
public Result selectVin(@PathVariable String carVin){
|
||||||
|
CarManage CarManages = sysCarService.selectVin(carVin);
|
||||||
|
return Result.success(CarManages);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class CarTypeController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/catTypeId")
|
@PostMapping("/catTypeId")
|
||||||
private Result<CarType> catTypeId(@RequestParam("catTypeId") Integer catTypeId) {
|
private Result<CarType> catTypeId(@RequestParam("catTypeId") Long catTypeId) {
|
||||||
CarType carType = carTypeService.findById(catTypeId);
|
CarType carType = carTypeService.findById(catTypeId);
|
||||||
return Result.success(carType);
|
return Result.success(carType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.enterprise.domain.FaultCondition;
|
||||||
|
import com.muyu.enterprise.domain.req.FaultConditionAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.FaultConditionListReq;
|
||||||
|
import com.muyu.enterprise.domain.req.FaultConditionUpdReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.FaultConditionTotalListResp;
|
||||||
|
import com.muyu.enterprise.service.FaultConditionService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则控制层
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.controller
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FaultRuleController
|
||||||
|
* @Date:2024/9/19 22:10
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/faultcondition")
|
||||||
|
public class FaultConditionController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FaultConditionService faultConditionService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则
|
||||||
|
* @param faultConditionListReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/list")
|
||||||
|
@Operation(summary = "故障规则列表展示",description = "故障规则列表展示")
|
||||||
|
public Result getfaultrulelist(@RequestBody @Validated FaultConditionListReq faultConditionListReq){
|
||||||
|
|
||||||
|
FaultConditionTotalListResp getfaultrulelist = faultConditionService.getfaultrulelist(faultConditionListReq);
|
||||||
|
return Result.success(getfaultrulelist,"操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则添加
|
||||||
|
* @param faultConditionAddReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/faultconditionadd")
|
||||||
|
@Operation(summary = "添加规则",description = "添加故障规则")
|
||||||
|
public Result faultconditionadd(@RequestBody FaultConditionAddReq faultConditionAddReq){
|
||||||
|
//判断车辆类型是否已存在所对应的故障规则
|
||||||
|
List<FaultCondition> faultConditionList = faultConditionService.selectBytypeAndlabel(faultConditionAddReq);
|
||||||
|
if (faultConditionList.size()>0){
|
||||||
|
return Result.error("此车辆类型已存在所对应的故障规则,无需重新制定,可在原规则上进行修改");
|
||||||
|
}
|
||||||
|
faultConditionService.save(FaultCondition.faultConditionadd(faultConditionAddReq));
|
||||||
|
return Result.success(null,"规则制定成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则修改
|
||||||
|
* @param
|
||||||
|
* @param faultConditionUpdReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/faultconditionupd")
|
||||||
|
@Operation(summary = "修改规则",description = "修改故障规则")
|
||||||
|
public Result faultconditionupd(
|
||||||
|
@RequestBody @Validated FaultConditionUpdReq faultConditionUpdReq){
|
||||||
|
faultConditionService.updateById(FaultCondition.faultConditionupd(faultConditionUpdReq,()->faultConditionUpdReq.getFaultConditionId()));
|
||||||
|
return Result.success(null,"规则修改成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则删除
|
||||||
|
* @param faultConditionId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/faultconditiondel/{faultConditionId}")
|
||||||
|
@Operation(summary = "删除规则",description = "删除故障规则")
|
||||||
|
public Result faultconditiondel(@PathVariable("faultConditionId") long faultConditionId){
|
||||||
|
faultConditionService.removeById(faultConditionId);
|
||||||
|
return Result.success(null,"规则删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.muyu.enterprise.controller;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.enterprise.service.FaultLabelService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障项选择控制层
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.controller
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FaultTypeController
|
||||||
|
* @Date:2024/9/18 20:58
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/faultlabel")
|
||||||
|
public class FaultLabelController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FaultLabelService faultLabelService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障名称
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/list")
|
||||||
|
@Operation(summary = "故障名称查询",description = "故障名称信息")
|
||||||
|
public Result findfaulttype(){
|
||||||
|
return Result.success(faultLabelService.select());
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,19 +2,21 @@ package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.enterprise.domain.FaultRule;
|
import com.muyu.enterprise.domain.CarFaultRule;
|
||||||
|
import com.muyu.enterprise.domain.Cheak;
|
||||||
import com.muyu.enterprise.service.FaultRuleService;
|
import com.muyu.enterprise.service.FaultRuleService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
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.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
/**
|
/**
|
||||||
* 故障的规则控制层
|
* 故障的规则检测控制层
|
||||||
* @author chenruijia
|
* @author chenruijia
|
||||||
* @Date 2024/9/28 11:58
|
* @Date 2024/9/28 11:58
|
||||||
* @Description FaultRuleController:故障的规则控制层
|
* @Description FaultRuleController:故障的规则检测控制层
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/rule")
|
@RequestMapping("/rule")
|
||||||
|
@ -22,57 +24,17 @@ import java.util.List;
|
||||||
public class FaultRuleController {
|
public class FaultRuleController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FaultRuleService faultRuleList;
|
private FaultRuleService faultRuleService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询车辆故障列表
|
* 故障参数匹配检查
|
||||||
*/
|
* @param carFaultRule
|
||||||
@RequestMapping(value = "/faultRuleList", method = RequestMethod.GET)
|
|
||||||
public Result<List<FaultRule>> faultRuleList(FaultRule faultRule)
|
|
||||||
{
|
|
||||||
List<FaultRule> list = faultRuleList.faultRuleList(faultRule);
|
|
||||||
return Result.success(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加车辆规则
|
|
||||||
* @param faultRule
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/insertRule",method = RequestMethod.POST)
|
@PostMapping("/cheakfaults")
|
||||||
public Result insertRule(@RequestBody FaultRule faultRule){
|
@Operation(summary = "故障参数匹配检查",description = "获取报文数据与故障参数进行比较")
|
||||||
return Result.success(faultRuleList.save(faultRule));
|
public Result cheakfaults(@Validated @RequestBody CarFaultRule carFaultRule){
|
||||||
}
|
List<Cheak> checkfault = faultRuleService.checkfault(carFaultRule);
|
||||||
|
return Result.success(checkfault);
|
||||||
/**
|
|
||||||
* 修改车辆规则
|
|
||||||
* @param faultRule
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/updateRule",method = RequestMethod.POST)
|
|
||||||
public Result updateRule(@RequestBody FaultRule faultRule){
|
|
||||||
return Result.success(faultRuleList.updateById(faultRule));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取单条故障规则详细信息
|
|
||||||
* @param faultRuleId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/byidRuleId/{faultRuleId}",method = RequestMethod.GET)
|
|
||||||
public Result byidRuleId(@PathVariable Long faultRuleId){
|
|
||||||
FaultRule byid = faultRuleList.byidRuleId(faultRuleId);
|
|
||||||
return Result.success(byid);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除车辆故障
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/remove/{ids}",method = RequestMethod.DELETE)
|
|
||||||
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
|
||||||
{
|
|
||||||
faultRuleList.removeBatchByIds(Arrays.asList(ids));
|
|
||||||
return Result.success();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.enterprise.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.enterprise.domain.CarCompany;
|
import com.muyu.enterprise.domain.CarCompany;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,6 +12,7 @@ import com.muyu.enterprise.domain.CarCompany;
|
||||||
* @author MingWei.Zong
|
* @author MingWei.Zong
|
||||||
* @Date 2024/9/28 16:52
|
* @Date 2024/9/28 16:52
|
||||||
*/
|
*/
|
||||||
|
@Mapper
|
||||||
public interface CarCompanyMapper extends BaseMapper<CarCompany> {
|
public interface CarCompanyMapper extends BaseMapper<CarCompany> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆配置--持久层
|
* 车辆配置--持久层
|
||||||
* @ClassName CarManageMapper
|
* @ClassName CarManageService
|
||||||
* @Description 车辆配置 Mapper 层
|
* @Description 车辆配置 Mapper 层
|
||||||
* @author MingWei.Zong
|
* @author MingWei.Zong
|
||||||
* @Date 2024/9/28 16:52
|
* @Date 2024/9/28 16:52
|
||||||
|
|
|
@ -1,25 +1,18 @@
|
||||||
package com.muyu.enterprise.mapper;
|
package com.muyu.enterprise.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
||||||
import com.muyu.enterprise.domain.CarManage;
|
import com.muyu.enterprise.domain.CarManage;
|
||||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
|
||||||
import com.muyu.enterprise.domain.vo.CarVO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆管理--持久层
|
* 车辆管理--持久层
|
||||||
* @ClassName CarManageMapper
|
* @author chenruijia
|
||||||
* @Description 车辆管理 Mapper 层
|
* @Date 2024/10/9 15:08
|
||||||
* @author MingWei.Zong
|
* @Description CarManageMapper:车辆管理--持久层
|
||||||
* @Date 2024/9/28 16:52
|
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface CarManageMapper extends MPJBaseMapper<CarManage> {
|
public interface CarManageMapper extends MPJBaseMapper<CarManage> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,6 @@ import org.apache.ibatis.annotations.Param;
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface CarTypeMapper extends BaseMapper<CarType> {
|
public interface CarTypeMapper extends BaseMapper<CarType> {
|
||||||
CarType findById(@Param("catTypeId") Integer catTypeId);
|
CarType findById(@Param("catTypeId") Long catTypeId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.muyu.enterprise.mapper;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.muyu.enterprise.domain.FaultCondition;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则持久层
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.mapper
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FaultRuleMapper
|
||||||
|
* @Date:2024/9/19 22:11
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface FaultConditionMapper extends MPJBaseMapper<FaultCondition> {
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.muyu.enterprise.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.enterprise.domain.FaultLabel;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障项选择持久层
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.mapper
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FaultTypeMapper
|
||||||
|
* @Date:2024/9/18 20:59
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface FaultLabelMapper extends BaseMapper<FaultLabel> {
|
||||||
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
package com.muyu.enterprise.mapper;
|
package com.muyu.enterprise.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.enterprise.domain.FaultRule;
|
import com.muyu.enterprise.domain.CarFaultRule;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障规则持久层
|
* 故障规则检测持久层
|
||||||
* @Author: chenruijia
|
* @Author: chenruijia
|
||||||
* @Date 2024/9/28 12.17
|
* @Date 2024/9/28 12.17
|
||||||
* @Description FaultRuleMapper:故障规则持久层
|
* @Description FaultRuleMapper:故障规则检测持久层
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface FaultRuleMapper extends BaseMapper<FaultRule> {
|
public interface FaultRuleMapper extends BaseMapper<CarFaultRule> {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.enterprise.service;
|
package com.muyu.enterprise.service;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.muyu.enterprise.domain.CarManage;
|
import com.muyu.enterprise.domain.CarManage;
|
||||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
import com.muyu.enterprise.domain.dto.CarDTO;
|
||||||
import com.muyu.enterprise.domain.vo.CarVO;
|
import com.muyu.enterprise.domain.vo.CarVO;
|
||||||
|
@ -34,4 +36,6 @@ public interface CarManageService extends IService<CarManage> {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void insertCar(CarManage carVO);
|
void insertCar(CarManage carVO);
|
||||||
|
|
||||||
|
CarManage selectVin(String carVin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,6 @@ import com.muyu.enterprise.domain.CarType;
|
||||||
* @Date 2024/9/28 16:52
|
* @Date 2024/9/28 16:52
|
||||||
*/
|
*/
|
||||||
public interface CarTypeService extends IService<CarType> {
|
public interface CarTypeService extends IService<CarType> {
|
||||||
CarType findById(Integer catTypeId);
|
CarType findById(Long catTypeId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.muyu.enterprise.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.enterprise.domain.FaultCondition;
|
||||||
|
import com.muyu.enterprise.domain.req.FaultConditionAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.FaultConditionListReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.FaultConditionTotalListResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则业务层
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.service.impl
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FaultRuleService
|
||||||
|
* @Date:2024/9/19 22:10
|
||||||
|
*/
|
||||||
|
public interface FaultConditionService extends IService<FaultCondition> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则
|
||||||
|
* @param faultConditionListReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
FaultConditionTotalListResp getfaultrulelist(FaultConditionListReq faultConditionListReq);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则添加
|
||||||
|
* @param faultConditionAddReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<FaultCondition> selectBytypeAndlabel(FaultConditionAddReq faultConditionAddReq);
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.muyu.enterprise.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.enterprise.domain.FaultLabel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障项选择业务层
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.service
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FaultTypeService
|
||||||
|
* @Date:2024/9/18 20:59
|
||||||
|
*/
|
||||||
|
public interface FaultLabelService extends IService<FaultLabel> {
|
||||||
|
/**
|
||||||
|
* 故障名称
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<FaultLabel> select();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断故障名称是否存在
|
||||||
|
* @param messageTypeName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
FaultLabel selectfaultName(String messageTypeName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加故障项表
|
||||||
|
* @param faultLabel
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer insertfaultlabel(FaultLabel faultLabel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除对应的故障名称表信息
|
||||||
|
* @param messageTypeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer delfaultlabel(Integer messageTypeId);
|
||||||
|
|
||||||
|
List<FaultLabel> selectFaultCode(long messageTypeId);
|
||||||
|
}
|
|
@ -1,17 +1,16 @@
|
||||||
package com.muyu.enterprise.service;
|
package com.muyu.enterprise.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.enterprise.domain.FaultRule;
|
import com.muyu.enterprise.domain.CarFaultRule;
|
||||||
|
import com.muyu.enterprise.domain.Cheak;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
/**
|
/**
|
||||||
* 故障规则业务层
|
* 故障规则检测业务层
|
||||||
* @Author: chenruijia
|
* @Author: chenruijia
|
||||||
* @Date 2024/9/28 12.19
|
* @Date 2024/9/28 12.19
|
||||||
* @Description FaultrRuleService:故障规则业务层
|
* @Description FaultrRuleService:故障规则检测业务层
|
||||||
*/
|
*/
|
||||||
public interface FaultRuleService extends IService<FaultRule> {
|
public interface FaultRuleService extends IService<CarFaultRule> {
|
||||||
List<FaultRule> faultRuleList(FaultRule faultrRule);
|
List<Cheak> checkfault(CarFaultRule carFaultRule);
|
||||||
|
|
||||||
FaultRule byidRuleId(Long faultRuleId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,6 @@ import org.springframework.stereotype.Service;
|
||||||
* @author MingWei.Zong
|
* @author MingWei.Zong
|
||||||
* @Date 2024/9/28 16:52
|
* @Date 2024/9/28 16:52
|
||||||
*/
|
*/
|
||||||
/**
|
|
||||||
* 车辆企业--业务层
|
|
||||||
* @ClassName CarCompanyService
|
|
||||||
* @Description 车辆企业 Service 层
|
|
||||||
* @author MingWei.Zong
|
|
||||||
* @Date 2024/9/28 16:52
|
|
||||||
*/
|
|
||||||
@Service
|
@Service
|
||||||
public class CarCompanyServiceImpl extends ServiceImpl<CarCompanyMapper, CarCompany>
|
public class CarCompanyServiceImpl extends ServiceImpl<CarCompanyMapper, CarCompany>
|
||||||
implements CarCompanyService {
|
implements CarCompanyService {
|
||||||
|
|
|
@ -1,24 +1,12 @@
|
||||||
package com.muyu.enterprise.service.impl;
|
package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
||||||
import com.muyu.enterprise.domain.CarCompany;
|
|
||||||
import com.muyu.enterprise.domain.CarConfig;
|
import com.muyu.enterprise.domain.CarConfig;
|
||||||
import com.muyu.enterprise.domain.CarManage;
|
|
||||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
|
||||||
import com.muyu.enterprise.domain.vo.CarVO;
|
|
||||||
import com.muyu.enterprise.mapper.CarConfigMapper;
|
import com.muyu.enterprise.mapper.CarConfigMapper;
|
||||||
import com.muyu.enterprise.mapper.CarManageMapper;
|
|
||||||
import com.muyu.enterprise.service.CarCompanyService;
|
|
||||||
import com.muyu.enterprise.service.CarConfigService;
|
import com.muyu.enterprise.service.CarConfigService;
|
||||||
import com.muyu.enterprise.service.CarManageService;
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆配置--业务实现层
|
* 车辆配置--业务实现层
|
||||||
* @ClassName CarConfigServiceImpl
|
* @ClassName CarConfigServiceImpl
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
package com.muyu.enterprise.service.impl;
|
package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
|
||||||
import com.muyu.enterprise.cache.CarManageCacheService;
|
import com.muyu.enterprise.cache.CarManageCacheService;
|
||||||
import com.muyu.enterprise.controller.CarCompanyController;
|
|
||||||
import com.muyu.enterprise.domain.CarCompany;
|
import com.muyu.enterprise.domain.CarCompany;
|
||||||
import com.muyu.enterprise.domain.CarConfig;
|
import com.muyu.enterprise.domain.CarConfig;
|
||||||
import com.muyu.enterprise.domain.CarManage;
|
import com.muyu.enterprise.domain.CarManage;
|
||||||
|
@ -16,12 +14,10 @@ import com.muyu.enterprise.mapper.CarManageMapper;
|
||||||
import com.muyu.enterprise.service.CarCompanyService;
|
import com.muyu.enterprise.service.CarCompanyService;
|
||||||
import com.muyu.enterprise.service.CarConfigService;
|
import com.muyu.enterprise.service.CarConfigService;
|
||||||
import com.muyu.enterprise.service.CarManageService;
|
import com.muyu.enterprise.service.CarManageService;
|
||||||
import com.muyu.common.redis.service.RedisService;
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,9 +36,9 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
|
||||||
@Autowired
|
@Autowired
|
||||||
private CarConfigService carConfigService;
|
private CarConfigService carConfigService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CarManageCacheService carManageCacheService;
|
private CarManageCacheService CarManageCacheService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CarManageMapper carManageMapper;
|
private CarManageMapper CarManageService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆列表2
|
* 车辆列表2
|
||||||
|
@ -75,7 +71,7 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
|
||||||
CarCompany carCompany = carCompanyService.selectCompanyByCompanyId(carVO.getEnterpriseId());
|
CarCompany carCompany = carCompanyService.selectCompanyByCompanyId(carVO.getEnterpriseId());
|
||||||
carVO.setCompanyName(carCompany.getCompanyName());
|
carVO.setCompanyName(carCompany.getCompanyName());
|
||||||
// 存到 redis
|
// 存到 redis
|
||||||
carManageCacheService.put(carVO.getCarVin(),new CarManage());
|
CarManageCacheService.put(carVO.getCarVin(),new CarManage());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,7 +81,7 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
|
||||||
public List<CarVO> CarListShow(CarDTO carDTO) {
|
public List<CarVO> CarListShow(CarDTO carDTO) {
|
||||||
// 获取 企业
|
// 获取 企业
|
||||||
CarManage carManage = BeanUtil.copyProperties(carDTO, CarManage.class);
|
CarManage carManage = BeanUtil.copyProperties(carDTO, CarManage.class);
|
||||||
return carManageMapper.selectJoinList(CarVO.class, new MPJLambdaWrapper<CarManage>()
|
return CarManageService.selectJoinList(CarVO.class, new MPJLambdaWrapper<CarManage>()
|
||||||
.selectAll(CarManage.class) // 查询所有车辆表
|
.selectAll(CarManage.class) // 查询所有车辆表
|
||||||
.select(CarCompany::getCompanyName)
|
.select(CarCompany::getCompanyName)
|
||||||
.select(CarConfig::getConfigName)
|
.select(CarConfig::getConfigName)
|
||||||
|
@ -99,16 +95,19 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
|
||||||
.eq(carManage.getCarStatus() != null && carManage.getCarStatus() > 0, CarManage::getCarStatus, carManage.getCarStatus())
|
.eq(carManage.getCarStatus() != null && carManage.getCarStatus() > 0, CarManage::getCarStatus, carManage.getCarStatus())
|
||||||
.eq(carManage.getEnterpriseId() != null && carManage.getEnterpriseId() > 0, CarManage::getEnterpriseId, carManage.getEnterpriseId())
|
.eq(carManage.getEnterpriseId() != null && carManage.getEnterpriseId() > 0, CarManage::getEnterpriseId, carManage.getEnterpriseId())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertCar(CarManage carVO) {
|
public void insertCar(CarManage carVO) {
|
||||||
save(carVO);
|
save(carVO);
|
||||||
// 存到缓存中去
|
// 存到缓存中去
|
||||||
carManageCacheService.put(carVO.getCarVin(),new CarManage());
|
CarManageCacheService.put(carVO.getCarVin(),new CarManage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CarManage selectVin(String carVin) {
|
||||||
|
LambdaQueryWrapper<CarManage> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(CarManage::getCarVin,carVin);
|
||||||
|
return CarManageService.selectOne(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,8 @@ public class CarTypeTypeServiceImpl
|
||||||
private CarTypeMapper carTypeMapper;
|
private CarTypeMapper carTypeMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CarType findById(Integer catTypeId) {
|
public CarType findById(Long catTypeId) {
|
||||||
CarType carType= carTypeMapper.findById(catTypeId);
|
CarType carType = carTypeMapper.findById(catTypeId);
|
||||||
return carType;
|
return carType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
package com.muyu.enterprise.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.enterprise.domain.CarType;
|
||||||
|
import com.muyu.enterprise.domain.FaultCondition;
|
||||||
|
import com.muyu.enterprise.domain.FaultLabel;
|
||||||
|
import com.muyu.enterprise.domain.req.FaultConditionAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.FaultConditionListReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.FaultConditionListResp;
|
||||||
|
import com.muyu.enterprise.domain.resp.FaultConditionTotalListResp;
|
||||||
|
import com.muyu.enterprise.mapper.FaultConditionMapper;
|
||||||
|
import com.muyu.enterprise.service.FaultConditionService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则业务实现层
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.service.impl
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FaultRuleServiceImpl
|
||||||
|
* @Date:2024/9/19 22:10
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class FaultConditionServiceImpl extends ServiceImpl<FaultConditionMapper, FaultCondition> implements FaultConditionService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FaultConditionMapper faultConditionMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则
|
||||||
|
* @param faultConditionListReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public FaultConditionTotalListResp getfaultrulelist(FaultConditionListReq faultConditionListReq) {
|
||||||
|
LambdaQueryWrapper<FaultCondition> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
long count = this.count(queryWrapper);
|
||||||
|
MPJLambdaWrapper<FaultCondition> wrapper = new MPJLambdaWrapper<>();
|
||||||
|
wrapper.select(FaultCondition::getFaultConditionId,
|
||||||
|
FaultCondition::getCarTypeId,
|
||||||
|
FaultCondition::getMessageId,
|
||||||
|
FaultCondition::getFaultConditionIdentification,
|
||||||
|
FaultCondition::getFaultConditionParameter)
|
||||||
|
.select(CarType::getCarTypeName)
|
||||||
|
.select(FaultLabel::getMessageTypeName,
|
||||||
|
FaultLabel::getMessageTypeCode)
|
||||||
|
.leftJoin(CarType.class,CarType::getCarTypeId,FaultCondition::getCarTypeId)
|
||||||
|
.leftJoin(FaultLabel.class,FaultLabel::getMessageTypeId,FaultCondition::getMessageId);
|
||||||
|
if (faultConditionListReq.getCarTypeId()!=0){
|
||||||
|
wrapper.eq(CarType::getCarTypeId, faultConditionListReq.getCarTypeId());
|
||||||
|
}
|
||||||
|
if (faultConditionListReq.getMessageId()!=0){
|
||||||
|
wrapper.eq(FaultLabel::getMessageTypeId, faultConditionListReq.getMessageId());
|
||||||
|
}
|
||||||
|
wrapper.last("LIMIT "+ ((faultConditionListReq.getPageNum()-1)*faultConditionListReq.getPageSize())+", "+faultConditionListReq.getPageSize());
|
||||||
|
List<FaultConditionListResp> faultConditionListResps = faultConditionMapper.selectJoinList(FaultConditionListResp.class, wrapper);
|
||||||
|
return FaultConditionTotalListResp.faultConditionTotalListResp(faultConditionListResps,count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则添加 判断故障规则是否存在
|
||||||
|
* @param faultConditionAddReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<FaultCondition> selectBytypeAndlabel(FaultConditionAddReq faultConditionAddReq) {
|
||||||
|
|
||||||
|
LambdaQueryWrapper<FaultCondition> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(FaultCondition::getCarTypeId,faultConditionAddReq.getCarTypeId())
|
||||||
|
.eq(FaultCondition::getMessageId,faultConditionAddReq.getMessageId());
|
||||||
|
List<FaultCondition> list = this.list(queryWrapper);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
package com.muyu.enterprise.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.enterprise.domain.FaultLabel;
|
||||||
|
import com.muyu.enterprise.mapper.FaultLabelMapper;
|
||||||
|
import com.muyu.enterprise.service.FaultLabelService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障项选择业务实现层
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.service.impl
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FaultTypeServiceImpl
|
||||||
|
* @Date:2024/9/18 21:00
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FaultLabelServiceImpl extends ServiceImpl<FaultLabelMapper, FaultLabel> implements FaultLabelService {
|
||||||
|
@Autowired
|
||||||
|
private FaultLabelMapper faultLabelMapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障信息查询
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<FaultLabel> select() {
|
||||||
|
LambdaQueryWrapper<FaultLabel> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断故障名称是否存在
|
||||||
|
* @param messageTypeName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public FaultLabel selectfaultName(String messageTypeName) {
|
||||||
|
LambdaQueryWrapper<FaultLabel> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(StringUtils.isNotEmpty(messageTypeName),
|
||||||
|
FaultLabel::getMessageTypeName, messageTypeName);
|
||||||
|
List<FaultLabel> list = this.list(queryWrapper);
|
||||||
|
if (!list.isEmpty()){
|
||||||
|
return list.get(0);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加故障项表
|
||||||
|
* @param faultLabel
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Integer insertfaultlabel(FaultLabel faultLabel) {
|
||||||
|
return faultLabelMapper.insert(FaultLabel.addfaultLabel(faultLabel));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除对应的故障名称表信息
|
||||||
|
* @param messageTypeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Integer delfaultlabel(Integer messageTypeId) {
|
||||||
|
// 使用LambdaQueryWrapper来构建查询条件
|
||||||
|
LambdaQueryWrapper<FaultLabel> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
// 假设FaultCode实体类中有一个getMessageTypeId方法
|
||||||
|
queryWrapper.eq(FaultLabel::getMessageTypeId, messageTypeId);
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,40 +2,105 @@ package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.muyu.enterprise.domain.FaultRule;
|
import com.muyu.enterprise.domain.*;
|
||||||
|
import com.muyu.enterprise.domain.resp.FaultConditionResp;
|
||||||
|
import com.muyu.enterprise.mapper.CarManageMapper;
|
||||||
|
import com.muyu.enterprise.mapper.FaultConditionMapper;
|
||||||
import com.muyu.enterprise.mapper.FaultRuleMapper;
|
import com.muyu.enterprise.mapper.FaultRuleMapper;
|
||||||
import com.muyu.enterprise.service.FaultRuleService;
|
import com.muyu.enterprise.service.FaultRuleService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.Assert;
|
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障规则业务实现层
|
* 故障规则检测业务实现层
|
||||||
* @Author: chenruijia
|
* @Author: chenruijia
|
||||||
* @Date 2024/9/28 12.19
|
* @Date 2024/9/28 12.19
|
||||||
* @Description FaultrRuleServiceImpl:故障规则业务实现层
|
* @Description FaultrRuleServiceImpl:故障规则检测业务实现层
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class FaultRuleServiceImpl extends ServiceImpl<FaultRuleMapper, FaultRule> implements FaultRuleService {
|
@Slf4j
|
||||||
|
public class FaultRuleServiceImpl extends ServiceImpl<FaultRuleMapper, CarFaultRule> implements FaultRuleService {
|
||||||
|
@Autowired
|
||||||
|
private CarManageMapper carManageMapper;
|
||||||
|
@Autowired
|
||||||
|
private FaultConditionMapper faultConditionMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FaultRule> faultRuleList(FaultRule faultRule) {
|
public List<Cheak> checkfault(CarFaultRule carFaultRule) {
|
||||||
LambdaQueryWrapper<FaultRule> queryWrapper = new LambdaQueryWrapper<>();
|
List<Cheak> vehicles = new ArrayList<>();
|
||||||
if (StringUtils.isNotEmpty(faultRule.getFaultName())) {
|
// 根据车辆 VIN 判断它属于什么类型的车辆
|
||||||
queryWrapper.eq(FaultRule::getFaultName,faultRule.getFaultName());
|
List<CarManage> carInformationList = carManageMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<CarManage>()
|
||||||
|
.eq(CarManage::getCarVin, carFaultRule.getVin()));
|
||||||
|
// 根据车辆类型,查询表获取对应的类型的故障规则
|
||||||
|
Long carTypeId = null;
|
||||||
|
for (CarManage carManage : carInformationList) {
|
||||||
|
carTypeId = carManage.getCarTypeId();
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(faultRule.getRuleParameters())) {
|
if (carTypeId != null) {
|
||||||
queryWrapper.eq(FaultRule::getRuleParameters,faultRule.getRuleParameters());
|
List<FaultConditionResp> faultConditionResps = faultConditionMapper.selectJoinList(FaultConditionResp.class, new MPJLambdaWrapper<FaultCondition>()
|
||||||
|
.selectAll(FaultCondition.class)
|
||||||
|
.select(CarType::getCarTypeName)
|
||||||
|
.select(FaultLabel::getMessageTypeName)
|
||||||
|
.select(FaultLabel::getMessageTypeCode)
|
||||||
|
.leftJoin(CarType.class, CarType::getCarTypeId, FaultCondition::getCarTypeId)
|
||||||
|
.eq(FaultCondition::getCarTypeId, carTypeId));
|
||||||
|
// 获取当前类的所有字段,不包括继承的
|
||||||
|
Class<? extends CarFaultRule> carFaultRuleClass = carFaultRule.getClass();
|
||||||
|
Field[] declaredFields = carFaultRuleClass.getDeclaredFields();
|
||||||
|
for (Field declaredField : declaredFields) {
|
||||||
|
// 确保可以访问私有字段
|
||||||
|
declaredField.setAccessible(true);
|
||||||
|
try {
|
||||||
|
// 获取字段的值
|
||||||
|
Object value = declaredField.get(carFaultRule);
|
||||||
|
if (value != null) {
|
||||||
|
// 遍历 faultConditionResps,查找匹配的 FaultCondition
|
||||||
|
for (FaultConditionResp faultCondition : faultConditionResps) {
|
||||||
|
String faultconditionIdentification = faultCondition.getFaultConditionIdentification();
|
||||||
|
BigDecimal faultconditionParameter = faultCondition.getFaultConditionParameter();
|
||||||
|
// 尝试将值转换为 BigDecimal
|
||||||
|
BigDecimal bigDecimalValue = null;
|
||||||
|
if (value instanceof Number) {
|
||||||
|
Number numberValue = (Number) value;
|
||||||
|
bigDecimalValue = BigDecimal.valueOf(numberValue.doubleValue());
|
||||||
}
|
}
|
||||||
return this.list(queryWrapper);
|
// 判断条件选择
|
||||||
|
if (">".equals(faultconditionIdentification) || ">".equals(faultconditionIdentification)) {
|
||||||
|
if (bigDecimalValue.compareTo(faultconditionParameter) > 0) {
|
||||||
|
vehicles.add(new Cheak(carFaultRule.getVin(), declaredField.getName() + "超出规定范围"));
|
||||||
}
|
}
|
||||||
|
} else if ("<".equals(faultconditionIdentification) || "<".equals(faultconditionIdentification)) {
|
||||||
@Override
|
if (bigDecimalValue.compareTo(faultconditionParameter) < 0) {
|
||||||
public FaultRule byidRuleId(Long faultRuleId) {
|
vehicles.add(new Cheak(carFaultRule.getVin(), declaredField.getName() + "过低"));
|
||||||
LambdaQueryWrapper<FaultRule> queryWrapper = new LambdaQueryWrapper<>();
|
}
|
||||||
Assert.notNull(faultRuleId, "规则ID不可为空");
|
} else if (">=".equals(faultconditionIdentification) || ">=".equals(faultconditionIdentification)) {
|
||||||
queryWrapper.eq(FaultRule::getFaultRuleId, faultRuleId);
|
if (bigDecimalValue.compareTo(faultconditionParameter) >= 0) {
|
||||||
return this.getOne(queryWrapper);
|
vehicles.add(new Cheak(carFaultRule.getVin(), declaredField.getName() + "超出规定范围"));
|
||||||
|
}
|
||||||
|
} else if ("<=".equals(faultconditionIdentification) || "<=".equals(faultconditionIdentification)) {
|
||||||
|
if (bigDecimalValue.compareTo(faultconditionParameter) <= 0) {
|
||||||
|
vehicles.add(new Cheak(carFaultRule.getVin(), declaredField.getName() + "过低"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (bigDecimalValue.compareTo(faultconditionParameter) == 0) {
|
||||||
|
vehicles.add(new Cheak(carFaultRule.getVin(), declaredField.getName() + "已达到故障点"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return vehicles;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.muyu.enterprise.mapper.CarManageMapper">
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,34 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
|
|
||||||
<mapper namespace="com.muyu.enterprise.mapper.car.VehicleMapper">
|
|
||||||
|
|
||||||
<select id="findAll" resultType="com.muyu.enterprise.domain.resp.car.VehicleManageResp">
|
|
||||||
SELECT
|
|
||||||
v.vehicle_id,
|
|
||||||
v.licence_number,
|
|
||||||
v.vehicle_color,
|
|
||||||
v.vehicle_vin,
|
|
||||||
v.vehicle_brand,
|
|
||||||
v.vehicle_model,
|
|
||||||
v.vehicle_license_due_date,
|
|
||||||
v.vehicle_status,
|
|
||||||
t.vehicle_type_name
|
|
||||||
FROM
|
|
||||||
vehicle v
|
|
||||||
LEFT JOIN vehicle_type t ON v.vehicle_type_id = t.vehicle_type_id
|
|
||||||
<where>
|
|
||||||
<if test="null != licenceNumber and '' != licenceNumber">
|
|
||||||
and v.licence_number like '%${licenceNumber}%'
|
|
||||||
</if>
|
|
||||||
<if test="null != vehicleVin and '' != vehicleVin">
|
|
||||||
and v.vehicle_vin like '%${vehicleVin}%'
|
|
||||||
</if>
|
|
||||||
<if test="null != vehicleStatus and '' != vehicleStatus">
|
|
||||||
and v.vehicle_status = #{vehicleStatus}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
|
@ -1,26 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
|
|
||||||
<mapper namespace="com.muyu.enterprise.mapper.car.MessageValueMapper">
|
|
||||||
|
|
||||||
<select id="getTemplateId" resultType="java.lang.Long">
|
|
||||||
SELECT
|
|
||||||
t.message_template_id
|
|
||||||
FROM
|
|
||||||
vehicle v
|
|
||||||
LEFT JOIN vehicle_type t ON v.vehicle_type_id = t.vehicle_type_id
|
|
||||||
WHERE
|
|
||||||
v.vehicle_vin = #{vehicleVin}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getTemplateList" resultType="com.muyu.enterprise.domain.resp.car.MessageValueListResp">
|
|
||||||
SELECT
|
|
||||||
*
|
|
||||||
FROM
|
|
||||||
message_value m
|
|
||||||
WHERE
|
|
||||||
m.template_id = #{templateId}
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.muyu.enterprise.mapper.CarMessageMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.muyu.enterprise.mapper.CarTemplateMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,9 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
|
|
||||||
<mapper namespace="com.muyu.enterprise.mapper.CarTypeMapper">
|
|
||||||
|
|
||||||
<select id="findById" resultType="com.muyu.enterprise.domain.CarType">
|
|
||||||
select * from t_car_type where t_car_type.car_type_id = #{catTypeId}
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
|
@ -1,26 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
|
|
||||||
<mapper namespace="com.muyu.enterprise.mapper.WarnStrategyMapper">
|
|
||||||
|
|
||||||
<select id="strategyList" resultType="com.muyu.enterprise.domain.resp.WarnStrategy">
|
|
||||||
SELECT
|
|
||||||
s.id AS strategy_id,
|
|
||||||
s.msg_id,
|
|
||||||
s.car_type_id,
|
|
||||||
s.strategy_name,
|
|
||||||
r.id AS rule_id,
|
|
||||||
r.max_value,
|
|
||||||
r.min_value,
|
|
||||||
r.msg_type_id,
|
|
||||||
r.rule_name,
|
|
||||||
r.slide_frequency,
|
|
||||||
r.slide_time,
|
|
||||||
r.strategy_id,
|
|
||||||
t_message_type.message_name
|
|
||||||
FROM
|
|
||||||
warn_strategy s
|
|
||||||
LEFT JOIN warn_rule r ON s.id = r.strategy_id
|
|
||||||
LEFT JOIN t_message_type on r.msg_type_id = t_message_type.message_type_id
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
|
@ -10,7 +10,7 @@ public class CacheHandlerConstants {
|
||||||
/**
|
/**
|
||||||
* 车辆管理缓存标识
|
* 车辆管理缓存标识
|
||||||
*/
|
*/
|
||||||
public static final String CAR_MANAGE_KEY = "carManage";
|
public static final String CAR_MANAGE_KEY = "CarManage";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障规则缓存标识
|
* 故障规则缓存标识
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class GoOnlineConsumer {
|
||||||
/**
|
/**
|
||||||
* 车辆管理缓存服务
|
* 车辆管理缓存服务
|
||||||
*/
|
*/
|
||||||
private final CarManageCacheService carManageCacheService;
|
private final CarManageCacheService CarManageCacheService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆故障缓存服务
|
* 车辆故障缓存服务
|
||||||
|
@ -66,7 +66,7 @@ public class GoOnlineConsumer {
|
||||||
public void online(String vin) {
|
public void online(String vin) {
|
||||||
log.info("车辆vin码:{},该车辆已上线", vin);
|
log.info("车辆vin码:{},该车辆已上线", vin);
|
||||||
cacheUtil.put(vin, new HashMap<String, Object>() {{
|
cacheUtil.put(vin, new HashMap<String, Object>() {{
|
||||||
put(CacheHandlerConstants.CAR_MANAGE_KEY, carManageCacheService.get(vin));
|
put(CacheHandlerConstants.CAR_MANAGE_KEY, CarManageCacheService.get(vin));
|
||||||
put(CacheHandlerConstants.FAULT_RULE_KEY, carFaultCacheService.get(vin));
|
put(CacheHandlerConstants.FAULT_RULE_KEY, carFaultCacheService.get(vin));
|
||||||
put(CacheHandlerConstants.ELECTRONIC_FENCE_KEY, electronicFenceCacheService.get(vin));
|
put(CacheHandlerConstants.ELECTRONIC_FENCE_KEY, electronicFenceCacheService.get(vin));
|
||||||
put(CacheHandlerConstants.WARN_RULE_KEY, carWarnCacheService.get(vin));
|
put(CacheHandlerConstants.WARN_RULE_KEY, carWarnCacheService.get(vin));
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.muyu.event.process.listener;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.muyu.common.core.exception.ServiceException;
|
import com.muyu.common.core.exception.ServiceException;
|
||||||
import com.muyu.enterprise.domain.FaultRule;
|
import com.muyu.enterprise.domain.CarFaultRule;
|
||||||
import com.muyu.event.process.basic.BasicEvent;
|
import com.muyu.event.process.basic.BasicEvent;
|
||||||
import com.muyu.event.process.basic.BasicEventListener;
|
import com.muyu.event.process.basic.BasicEventListener;
|
||||||
import com.muyu.event.process.constant.CacheHandlerConstants;
|
import com.muyu.event.process.constant.CacheHandlerConstants;
|
||||||
|
@ -36,7 +36,7 @@ public class IdentifyingFailuresEventListener implements BasicEventListener<Stri
|
||||||
Optional<Map<String, Object>> optionalDataMap =
|
Optional<Map<String, Object>> optionalDataMap =
|
||||||
Optional.ofNullable((Map<String, Object>) cacheUtil.get((String) data.get("vin")));
|
Optional.ofNullable((Map<String, Object>) cacheUtil.get((String) data.get("vin")));
|
||||||
optionalDataMap
|
optionalDataMap
|
||||||
.map(dataMap -> (FaultRule) dataMap.get(CacheHandlerConstants.FAULT_RULE_KEY))
|
.map(dataMap -> (CarFaultRule) dataMap.get(CacheHandlerConstants.FAULT_RULE_KEY))
|
||||||
.orElseThrow(() -> new ServiceException("故障规则未找到"));
|
.orElseThrow(() -> new ServiceException("故障规则未找到"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue