Merge branch 'master' into xxy
commit
057ad3ded5
|
@ -5,13 +5,11 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.domain.req.CarInformationAddReq;
|
||||
import com.muyu.domain.req.CarInformationUpdReq;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
@ -46,7 +44,7 @@ public class CarInformation {
|
|||
*/
|
||||
// @TableName(value = "car_information_VIN")
|
||||
@TableField(value = "car_information_VIN")
|
||||
private String carInformationVIN;
|
||||
private String carInformationVin;
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
|
@ -135,7 +133,7 @@ public class CarInformation {
|
|||
|
||||
public static CarInformation carInformationAddBuilder(CarInformationAddReq carInformation) {
|
||||
return CarInformation.builder()
|
||||
.carInformationVIN(carInformation.getCarInformationVin())
|
||||
.carInformationVin(carInformation.getCarInformationVin())
|
||||
.carInformationLicensePlate(carInformation.getCarInformationLicensePlate())
|
||||
.carInformationBrand(carInformation.getCarInformationBrand())
|
||||
.carInformationColor(carInformation.getCarInformationColor())
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.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.domain.req.FaultCodeAddReq;
|
||||
|
@ -63,18 +64,22 @@ public class FaultCode {
|
|||
/**
|
||||
*故障类型名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String faulttypeName;
|
||||
/**
|
||||
* 故障名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String messageTypeName;
|
||||
/**
|
||||
* 报文编码
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String messageTypeCode;
|
||||
/**
|
||||
*报文所属类别
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String messageTypeBelongs;
|
||||
|
||||
|
||||
|
@ -103,10 +108,15 @@ public class FaultCode {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static FaultCode faultCodeBuilder(FaultCode faultCode) {
|
||||
return FaultCode.builder()
|
||||
.faultcodeId(faultCode.getFaultcodeId())
|
||||
.messageTypeId(faultCode.getMessageTypeId())
|
||||
.faultcodeNumber(faultCode.getFaultcodeNumber())
|
||||
.faultGroup(faultCode.faultGroup)
|
||||
.faultBit(faultCode.faultBit)
|
||||
.faultValue(faultCode.faultValue)
|
||||
.isWarning(faultCode.isWarning)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.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.domain.req.FaultConditionAddReq;
|
||||
|
@ -54,14 +55,17 @@ public class FaultCondition {
|
|||
/**
|
||||
* 车辆类型名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String carTypeName;
|
||||
/**
|
||||
* 故障名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String messageTypeName;
|
||||
/**
|
||||
* 报文编码
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String messageTypeCode;
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ public class FenceGroupReq {
|
|||
/**
|
||||
* 车辆
|
||||
*/
|
||||
|
||||
private List<CarFence> carFences;
|
||||
/**
|
||||
* 围栏组
|
||||
|
|
|
@ -8,10 +8,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
|||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
@ -45,8 +42,8 @@ public class CarMessageController {
|
|||
@PostMapping("/insertCarMessage")
|
||||
@Operation(summary = "添加报文信息")
|
||||
public Result<Integer> insertCarMessage(@Validated @RequestBody CarMessage carMessage){
|
||||
boolean inserted = carMessageService.insertCarMessage(carMessage);
|
||||
if (inserted){
|
||||
int inserted = carMessageService.insertCarMessage(carMessage);
|
||||
if (inserted>0){
|
||||
return Result.success(200,"添加成功");
|
||||
}
|
||||
return Result.error(402,"添加失败");
|
||||
|
@ -58,9 +55,9 @@ public class CarMessageController {
|
|||
*/
|
||||
@PostMapping("/delectByCarMessageId")
|
||||
@Operation(summary = "删除报文信息")
|
||||
public Result<Integer> delectByCarMessageId(Integer carMessageId){
|
||||
boolean deleteByCarMessageId = carMessageService.delectByCarMessageId(carMessageId);
|
||||
if (deleteByCarMessageId){
|
||||
public Result<Integer> delectByCarMessageId(@RequestParam(name = "carMessageId") Integer carMessageId){
|
||||
int deleteByCarMessageId = carMessageService.delectByCarMessageId(carMessageId);
|
||||
if (deleteByCarMessageId>0){
|
||||
return Result.success(200,"删除成功");
|
||||
}
|
||||
return Result.error(402,"删除失败");
|
||||
|
@ -72,8 +69,8 @@ public class CarMessageController {
|
|||
@PostMapping("/updateCarMessage")
|
||||
@Operation(summary = "修改报文信息")
|
||||
public Result<Integer> updateCarMessage(@Validated @RequestBody CarMessage carMessage){
|
||||
boolean updateCarMessage = carMessageService.updateCarMessage(carMessage);
|
||||
if(updateCarMessage)
|
||||
int updateCarMessage = carMessageService.updateCarMessage(carMessage);
|
||||
if(updateCarMessage>0)
|
||||
{
|
||||
return Result.success(200,"修改成功");
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 报文模板展示列表持久层
|
||||
* @author 17353
|
||||
*/
|
||||
@Mapper
|
||||
public interface CarMessageMapper extends MPJBaseMapper<CarMessage> {
|
||||
|
||||
}
|
||||
|
|
|
@ -24,19 +24,19 @@ public interface CarMessageService extends IService<CarMessage> {
|
|||
/**
|
||||
* 添加车辆报文规则
|
||||
*/
|
||||
boolean insertCarMessage(CarMessage carMessage);
|
||||
int insertCarMessage(CarMessage carMessage);
|
||||
|
||||
|
||||
/**
|
||||
* 删除车辆报文规则
|
||||
*/
|
||||
boolean delectByCarMessageId(Integer carMessageId);
|
||||
int delectByCarMessageId(Integer carMessageId);
|
||||
|
||||
|
||||
/**
|
||||
* 修改车辆报文规则
|
||||
*/
|
||||
boolean updateCarMessage(CarMessage carMessage);
|
||||
int updateCarMessage(CarMessage carMessage);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
package com.muyu.server.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.domain.CarFence;
|
||||
import com.muyu.domain.CarInformation;
|
||||
|
@ -69,7 +65,7 @@ public class CarInformationServiceImpl
|
|||
.leftJoin(CarType.class, CarType::getCarTypeId, CarInformation::getCarInformationType)
|
||||
|
||||
.eq(StringUtils.isNotEmpty(carInformationListReq.getCarInformationVIN())
|
||||
,CarInformation::getCarInformationVIN
|
||||
,CarInformation::getCarInformationVin
|
||||
, carInformationListReq.getCarInformationVIN())
|
||||
.eq(StringUtils.isNotNull(carInformationListReq.getCarTypeId())
|
||||
,CarType::getCarTypeId, carInformationListReq.getCarTypeId())
|
||||
|
@ -80,7 +76,7 @@ public class CarInformationServiceImpl
|
|||
,CarInformation::getCarInformationState
|
||||
, carInformationListReq.getCarInformationState())
|
||||
.like(StringUtils.isNotEmpty(carInformationListReq.getCarInformationVIN())
|
||||
,CarInformation::getCarInformationVIN
|
||||
,CarInformation::getCarInformationVin
|
||||
, carInformationListReq.getCarInformationVIN())
|
||||
.eq(StringUtils.isNotEmpty( carInformationListReq.getCarInformationMotorModel())
|
||||
,CarInformation::getCarInformationMotorModel
|
||||
|
|
|
@ -67,24 +67,24 @@ public class CarMessageServiceImpl
|
|||
* 添加车辆报文规则
|
||||
*/
|
||||
@Override
|
||||
public boolean insertCarMessage(CarMessage carMessage) {
|
||||
return this.save(CarMessage.carMessageAddBuilder(carMessage));
|
||||
public int insertCarMessage(CarMessage carMessage) {
|
||||
return carMessageMapper.insert(CarMessage.carMessageAddBuilder(carMessage));
|
||||
}
|
||||
/**
|
||||
* 删除车辆报文规则
|
||||
*/
|
||||
@Override
|
||||
public boolean delectByCarMessageId(Integer carMessageId) {
|
||||
return this.removeById(carMessageId);
|
||||
public int delectByCarMessageId(Integer carMessageId) {
|
||||
return carMessageMapper.deleteById(carMessageId);
|
||||
|
||||
}
|
||||
/**
|
||||
* 修改车辆报文规则
|
||||
*/
|
||||
@Override
|
||||
public boolean updateCarMessage(CarMessage carMessage) {
|
||||
public int updateCarMessage(CarMessage carMessage) {
|
||||
// Integer integer = carMessageMapper.updateCarMessage(carMessage);
|
||||
return this.updateById(CarMessage.carMessageUpdBuilder(carMessage, carMessage::getMessageTypeId));
|
||||
return carMessageMapper.updateById(CarMessage.carMessageUpdBuilder(carMessage, carMessage::getMessageTypeId));
|
||||
}
|
||||
/**
|
||||
* 查询
|
||||
|
|
|
@ -85,7 +85,7 @@ public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode
|
|||
LambdaQueryWrapper<FaultCode> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotEmpty(faultcodeNumber),
|
||||
FaultCode::getFaultcodeNumber, faultcodeNumber);
|
||||
List<FaultCode> list = this.list(queryWrapper);
|
||||
List<FaultCode> list = this.list(queryWrapper).stream().map(FaultCode::faultCodeBuilder).toList();
|
||||
FaultCode faultCode=null;
|
||||
if (!list.isEmpty()){
|
||||
faultCode=list.get(0);
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package com.muyu.server.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.domain.CarInformation;
|
||||
import com.muyu.domain.FaultCode;
|
||||
import com.muyu.domain.FaultCondition;
|
||||
import com.muyu.domain.FaultLog;
|
||||
import com.muyu.domain.req.FaultLogListReq;
|
||||
import com.muyu.domain.resp.FaultLogListResp;
|
||||
|
@ -49,7 +47,7 @@ public class FaultLogServiceImpl extends ServiceImpl<FaultLogMapper, FaultLog> i
|
|||
FaultLog::getStartwarningTime,
|
||||
FaultLog::getEndwarningTime)
|
||||
.select(FaultCode::getFaultcodeNumber)
|
||||
.select(CarInformation::getCarInformationVIN)
|
||||
.select(CarInformation::getCarInformationVin)
|
||||
.leftJoin(FaultCode.class,FaultCode::getFaultcodeId,FaultLog::getFaultcodeId)
|
||||
.leftJoin(CarInformation.class,CarInformation::getCarInformationId,FaultLog::getCarInformationId)
|
||||
.eq(StringUtils.isNotEmpty(faultLogListReq.getCarVin()),
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package com.muyu.server.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.query.MPJLambdaQueryWrapper;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.domain.*;
|
||||
import com.muyu.domain.resp.FaultConditionResp;
|
||||
import com.muyu.server.mapper.CarFenceMapper;
|
||||
|
@ -15,6 +18,7 @@ import org.springframework.stereotype.Service;
|
|||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -43,9 +47,15 @@ public class FaultRuleServiceImpl extends ServiceImpl<FaultRuleMapper, CarFaultR
|
|||
public List<Vehicle> checkfault(CarFaultRule carFaultRule) {
|
||||
List<Vehicle> vehicles = new ArrayList<>();
|
||||
//根据车辆VIN判断它属于什么类型的车辆
|
||||
CarInformation carInformation = carInformationMapper.selectById(carFaultRule.getVin());
|
||||
Integer carInformationType = carInformation.getCarInformationType();
|
||||
List<CarInformation> carInformationList = carInformationMapper.selectList(
|
||||
new LambdaQueryWrapper<CarInformation>()
|
||||
.eq(CarInformation::getCarInformationVin, carFaultRule.getVin()));
|
||||
//根据车辆类型,查询表获取对应的类型的故障规则
|
||||
Integer carInformationType = null;
|
||||
for (CarInformation carInformation : carInformationList) {
|
||||
carInformationType= carInformation.getCarInformationType();
|
||||
}
|
||||
|
||||
|
||||
List<FaultConditionResp> faultConditionResps = faultConditionMapper.selectJoinList(FaultConditionResp.class, new MPJLambdaWrapper<FaultCondition>()
|
||||
.selectAll(FaultCondition.class)
|
||||
|
@ -53,7 +63,8 @@ public class FaultRuleServiceImpl extends ServiceImpl<FaultRuleMapper, CarFaultR
|
|||
.select(FaultLabel::getMessageTypeName)
|
||||
.select(FaultLabel::getMessageTypeCode)
|
||||
.leftJoin(CarType.class, CarType::getCarTypeId, FaultCondition::getCarTypeId)
|
||||
.leftJoin(FaultLabel.class, FaultLabel::getMessageTypeId, FaultCondition::getMessageTypeId));
|
||||
.leftJoin(FaultLabel.class, FaultLabel::getMessageTypeId, FaultCondition::getMessageTypeId)
|
||||
.eq(FaultCondition::getCarTypeId,carInformationType));
|
||||
//获取当前类的所有字段,不包括继承的
|
||||
Class<? extends CarFaultRule> carFaultRuleClass = carFaultRule.getClass();
|
||||
Field[] declaredFields = carFaultRuleClass.getDeclaredFields();
|
||||
|
|
Loading…
Reference in New Issue