feat:()重构故障代码

dev.fault.change
sy200 2024-10-10 19:04:15 +08:00
parent 1565dd577c
commit e0962bcc53
20 changed files with 26 additions and 885 deletions

View File

@ -1,26 +0,0 @@
package com.muyu.enterprise.cache;
import com.muyu.common.cache.CacheAbsBacis;
import com.muyu.domain.FaultInfo;
import java.util.List;
/**
*
*/
public class AllFaultCacheService extends CacheAbsBacis<String, List<FaultInfo>> {
@Override
public void clear() {
}
@Override
public String keyPre() {
return "AllFault:info:";
}
@Override
public String decode(String key) {
return key.replace("AllFault:info:", "");
}
}

View File

@ -1,24 +0,0 @@
package com.muyu.enterprise.cache;
import com.muyu.common.cache.CacheAbsBacis;
import com.muyu.domain.FaultInfo;
/**
*
*/
public class FaultCacheService extends CacheAbsBacis<String, FaultInfo> {
@Override
public void clear() {
}
@Override
public String keyPre() {
return "fault:info:";
}
@Override
public String decode(String key) {
return key.replace("fault:info:", "");
}
}

View File

@ -1,4 +1,3 @@
com.muyu.enterprise.cache.AllFaultCacheService
com.muyu.enterprise.cache.AllFenceCahceService
com.muyu.enterprise.cache.AllFenceGroupCahceService
com.muyu.enterprise.cache.AllMessageValueCacheService
@ -7,7 +6,6 @@ com.muyu.enterprise.cache.AllVehicleTypeCacheService
com.muyu.enterprise.cache.AllWarnRuleCacheService
com.muyu.enterprise.cache.AllWarnStrategyAndVinCacheService
com.muyu.enterprise.cache.AllWarnStrategyCacheService
com.muyu.enterprise.cache.FaultCacheService
com.muyu.enterprise.cache.FenceCahceService
com.muyu.enterprise.cache.FenceGroupCahceService
com.muyu.enterprise.cache.MessageTemplateCacheService
@ -16,5 +14,3 @@ com.muyu.enterprise.cache.VehicleCacheService
com.muyu.enterprise.cache.VehicleTypeCacheService
com.muyu.enterprise.cache.WarnRuleCacheService
com.muyu.enterprise.cache.WarnStrategyCacheService

View File

@ -1,92 +1,49 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.annotation.Excel.ColumnType;
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.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @AuthorChenYan
* @Project2112-car-cloud-server
* @Packagecom.muyu.fault.domain
* @FilenameFault
* @Description TODO
* @Date2024/9/18 11:04
*
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "fault")
@Tag(name = "fault", description = "故障信息")
public class Fault extends BaseEntity {
/**
*
* id
*/
@Excel(name = "参数主键", cellType = ColumnType.NUMERIC)
@TableId( type = IdType.AUTO)
private Long id;
@TableId(value = "fault_id")
@Schema(description = "主键",type = "Integer")
private Long faultId;
/**
*
*
*/
@Excel(name = "车辆故障编码")
private String faultCode;
/**
*
*/
@Excel(name = "车辆故障名称")
private String faultName;
/**
*
*/
@Excel(name = "辆故障类型")
@Schema(description = "故障类别",type = "String")
private String faultType;
/**
* VIN
*
*/
@Excel(name = "故障VIN编码")
private String carVin;
@Schema(description = "故障规则(判定方式)",type = "String")
private String faultCustom;
/**
*
*
*/
@Excel(name = "车辆故障标签")
private String faultLabel;
/**
*
*/
@Excel(name = "车辆故障位")
private String faultBit;
/**
*
*/
@Excel(name = "车辆故障值")
private String faultValue;
/**
*
*/
@Excel(name = "故障级别")
private String faultWarn;
/**
* Y.N.
*/
@Excel(name = "报警状态Y.是N.否)")
private String warnStatus;
/**
*
*/
@Excel(name = "故障描述信息")
private String faultDesc;
/**
* (1. 2. 3. 4.)
*/
@Excel(name = "启用状态(1.待处理 2.处理中 3.已处理 4.忽略)")
private String state;
@Schema(description = "报文外键",type = "Integer")
private Integer messageId;
}

View File

@ -1,77 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @AuthorChenYan
* @Project2112-car-cloud-server
* @Packagecom.muyu.fault.domain.vo
* @FilenameFaultInfo
* @Description TODO
* @Date2024/9/16 20:23
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "fault_info", autoResultMap = true)
public class FaultInfo extends BaseEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
*
*/
@Excel(name = "故障码")
private String faultCode;
/**
*
*/
@Excel(name = "故障类型")
private String faultType;
/**
*
*/
@Excel(name = "故障组")
private String groupName;
/**
*
*/
@Excel(name = "故障位")
private Integer faultBit;
/**
*
*/
@Excel(name = "故障值")
private String faultValue;
/**
*
*/
@Excel(name = "故障标签")
private String faultTab;
/**
*
*/
@Excel(name = "是否警告")
private Long isWarning;
}

View File

@ -1,67 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @AuthorChenYan
* @Project2112-car-cloud-server
* @Packagecom.muyu.fault.domain
* @FilenameFaultLog
* @Description TODO
* @Date2024/9/16 20:11
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "fault_log", autoResultMap = true)
public class FaultLog{
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
*
*/
@Excel(name = "故障码")
private String faultCode;
/**
* VIN
*/
@Excel(name = "车辆VIN")
private String vin;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:dd:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "开始报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:dd:ss")
private Date warningTime;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:dd:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "结束报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:dd:ss")
private Date normalTime;
}

View File

@ -1,117 +0,0 @@
package com.muyu.enterprise.controller;
import com.muyu.enterprise.cache.AllFaultCacheService;
import com.muyu.enterprise.cache.FaultCacheService;
import com.muyu.enterprise.service.FaultInfoService;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.domain.FaultInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
/**
*
*/
@Log4j2
@RestController
@Tag(name = "故障管理列", description = "故障管理列")
@RequestMapping("/info")
public class FaultInfoController extends BaseController {
@Autowired
private FaultInfoService service;
@Autowired
private AllFaultCacheService allFaultCacheService;
/**
*
*/
@GetMapping("/list")
@RequiresPermissions("fault:fault:list")
@Operation(summary = "查询集合", description = "查询车辆故障管理列表")
public Result<TableDataInfo<FaultInfo>> list(FaultInfo faultInfo) {
startPage();
List<FaultInfo> list = service.pageQuery(faultInfo);
// allFaultCacheService.put(faultInfo.getFaultCode(),list);
return getDataTable(list);
}
/**
*
*/
@Log(title = "车辆故障管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@RequiresPermissions("fault:fault:export")
public void export(HttpServletResponse response, FaultInfo fault) {
List<FaultInfo> list = service.pageQuery(fault);
ExcelUtil<FaultInfo> util = new ExcelUtil<FaultInfo>(FaultInfo.class);
util.exportExcel(response, list, "车辆故障管理数据");
}
/**
*
*/
@GetMapping(value = "/{id}")
public Result<String> getConfigKey (@PathVariable("id") String id) {
return success(service.getById(id));
}
/**
*
*/
@Log(title = "车辆故障管理", businessType = BusinessType.INSERT)
@PostMapping
@RequiresPermissions("fault:info:add")
public Result add(@RequestBody FaultInfo faultInfo) {
service.save(faultInfo);
//添加的数据存进缓存
// faultCacheService.put(faultInfo.);
return Result.success(null, "成功");
}
/**
*
*/
@Log(title = "车辆故障管理", businessType = BusinessType.UPDATE)
@PutMapping
@RequiresPermissions("fault:info:edit")
public Result edit(@RequestBody FaultInfo fault) {
service.updateById(fault);
return Result.success(null, "成功");
}
/**
*
*/
@Log(title = "车辆故障管理删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
@RequiresPermissions("fault:info:remove")
public Result remove(@PathVariable("id") Long[] id) {
return Result.success(service.removeBatchByIds(Arrays.asList(id)), "成功");
}
}

View File

@ -1,121 +0,0 @@
package com.muyu.enterprise.controller;
import com.muyu.enterprise.service.FaultLogService;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.common.log.enums.BusinessType;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.domain.FaultLog;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.muyu.common.log.annotation.Log;
import java.util.Arrays;
import java.util.List;
/**
*
*/
@RestController
@RequestMapping("/log")
public class FaultLogController extends BaseController {
@Autowired
private FaultLogService faultLogService;
/**
*
*/
@GetMapping("/list")
@RequiresPermissions("fault:log:list")
@Operation(summary = "查询集合", description = "查询车辆故障管理列表")
public Result<TableDataInfo<FaultLog>> list(FaultLog fault) {
startPage();
List<FaultLog> list = faultLogService.pageQuery(fault);
return getDataTable(list);
}
/**
*
*/
@Log(title = "车辆故障管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@RequiresPermissions("fault:log:export")
public void export(HttpServletResponse response, FaultLog fault) {
List<FaultLog> list = faultLogService.pageQuery(fault);
ExcelUtil<FaultLog> util = new ExcelUtil<FaultLog>(FaultLog.class);
util.exportExcel(response, list, "车辆故障管理数据");
}
/**
*
*/
@GetMapping(value = "/{id}")
public Result<String> getConfigKey (@PathVariable("id") String id) {
return success(faultLogService.getById(id));
}
/**
*
*/
@Log(title = "车辆故障管理", businessType = BusinessType.INSERT)
@PostMapping
@RequiresPermissions("fault:log:add")
public Result add(@RequestBody FaultLog fault) {
faultLogService.save(fault);
return Result.success(null, "成功");
}
/**
*
*/
@Log(title = "车辆故障管理", businessType = BusinessType.UPDATE)
@PutMapping
@RequiresPermissions("fault:log:edit")
public Result edit(@RequestBody FaultLog fault) {
faultLogService.updateById(fault);
return Result.success(null, "成功");
}
/**
*
*/
@Log(title = "车辆故障管理删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
@RequiresPermissions("fault:log:remove")
public Result remove(@PathVariable("id") Long[] id) {
return Result.success(faultLogService.removeBatchByIds(Arrays.asList(id)), "成功");
}
/**
*
*/
@PostMapping("/addLog")
public Result addLog(@RequestBody FaultLog log){
faultLogService.insertFaultLog(log);
return Result.success();
}
/**
*
*/
@PostMapping("/updateLog")
public Result updateLog(@RequestBody FaultLog log){
faultLogService.updateFaultLogByStatus(log);
return Result.success();
}
}

View File

@ -1,24 +0,0 @@
package com.muyu.enterprise.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.domain.FaultInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* @AuthorChenYan
* @Project2112-car-cloud-server
* @Packagecom.muyu.fault.mapper
* @FilenameFaultInfoMapper
* @Description TODO
* @Date2024/9/19 22:19
*/
@Mapper
public interface FaultInfoMapper extends BaseMapper<FaultInfo> {
int insertFaultinfo(FaultInfo faultInfo);
int updateFaultinfo(FaultInfo faultInfo);
}

View File

@ -1,30 +0,0 @@
package com.muyu.enterprise.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.domain.FaultLog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.ArrayList;
import java.util.List;
/**
* @AuthorChenYan
* @Project2112-car-cloud-server
* @Packagecom.muyu.fault.mapper
* @FilenameFaultLogMapper
* @Description TODO
* @Date2024/9/16 21:15
*/
@Mapper
public interface FaultLogMapper extends BaseMapper<FaultLog> {
Long selectFaultId(FaultLog log);
int updateFaultLogByTime(FaultLog log);
void insertBatchFaultLog(@Param("logs") List<FaultLog> logs);
}

View File

@ -1,20 +0,0 @@
package com.muyu.enterprise.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.domain.Fault;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @AuthorChenYan
* @Project2112-car-cloud-server
* @Packagecom.muyu.fault.mapper
* @FilenameFaultMapper
* @Description TODO
* @Date2024/9/18 11:16
*/
@Mapper
public interface FaultMapper extends BaseMapper<Fault> {
}

View File

@ -1,28 +0,0 @@
package com.muyu.enterprise.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.domain.FaultInfo;
import java.util.List;
/**
* @AuthorChenYan
* @Project2112-car-cloud-server
* @Packagecom.muyu.fault.service
* @FilenameIFaultInfoService
* @Description TODO
* @Date2024/9/19 22:15
*/
public interface FaultInfoService extends IService<FaultInfo> {
/**
*
*
* @param faultInfo
* @return
*/
List<FaultInfo> pageQuery(FaultInfo faultInfo);
}

View File

@ -1,34 +0,0 @@
package com.muyu.enterprise.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.domain.FaultLog;
import java.util.List;
/**
* @AuthorChenYan
* @Project2112-car-cloud-server
* @Packagecom.muyu.fault.service
* @FilenameIFaultLogService
* @Description TODO
* @Date2024/9/16 20:26
*/
public interface FaultLogService extends IService<FaultLog> {
/**
*
* @param fault
* @return
*/
List<FaultLog> pageQuery(FaultLog fault);
public int insertFaultLog(FaultLog log);
public int updateFaultLogByStatus(FaultLog log);
}

View File

@ -1,28 +0,0 @@
package com.muyu.enterprise.service;
;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.domain.Fault;
import java.util.List;
/**
* @AuthorChenYan
* @Project2112-car-cloud-server
* @Packagecom.muyu.fault.service
* @FilenameIFaultService
* @Description TODO
* @Date2024/9/18 11:12
*/
public interface FaultService extends IService<Fault> {
/**
*
*
* @param fault
* @return
*/
List<Fault> pageQuery(Fault fault);
}

View File

@ -1,49 +0,0 @@
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.domain.FaultInfo;
import com.muyu.enterprise.mapper.FaultInfoMapper;
import com.muyu.enterprise.service.FaultInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* @AuthorChenYan
* @Project2112-car-cloud-server
* @Packagecom.muyu.fault.service.impl
* @FilenameIFaultInfoServiceImpl
* @Description TODO
* @Date2024/9/19 22:16
*/
@Service
public class FaultInfoServiceImpl extends ServiceImpl<FaultInfoMapper, FaultInfo> implements FaultInfoService {
@Autowired
private FaultInfoMapper faultInfoMapper;
/**
*
* @param faultInfo
* @return fault
*/
@Override
public List<FaultInfo> pageQuery(FaultInfo faultInfo) {
LambdaQueryWrapper<FaultInfo> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotEmpty(faultInfo.getFaultCode())) {
queryWrapper.like(FaultInfo::getFaultCode, faultInfo.getFaultCode());
}
if (StringUtils.isNotEmpty(faultInfo.getFaultType())) {
queryWrapper.like(FaultInfo::getFaultType, faultInfo.getFaultType());
}
if (StringUtils.isNotEmpty(faultInfo.getGroupName())) {
queryWrapper.like(FaultInfo::getGroupName, faultInfo.getGroupName());
}
return this.list(queryWrapper);
}
}

View File

@ -1,73 +0,0 @@
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.domain.FaultLog;
import com.muyu.enterprise.mapper.FaultLogMapper;
import com.muyu.enterprise.service.FaultLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @AuthorChenYan
* @Project2112-car-cloud-server
* @Packagecom.muyu.fault.service
* @FilenameIFaultLogServiceImpl
* @Description TODO
* @Date2024/9/16 20:37
*/
@Service
public class FaultLogServiceImpl extends ServiceImpl<FaultLogMapper, FaultLog> implements FaultLogService {
@Autowired
private FaultLogMapper faultLogMapper;
@Override
public List<FaultLog> pageQuery(FaultLog fault) {
LambdaQueryWrapper<FaultLog> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotEmpty(fault.getFaultCode())) {
queryWrapper.like(FaultLog::getFaultCode, fault.getFaultCode());
}
if (StringUtils.isNotEmpty(fault.getVin())) {
queryWrapper.like(FaultLog::getVin, fault.getVin());
}
// 时间区间查询
if (fault.getWarningTime() != null ) {
queryWrapper.gt(FaultLog::getWarningTime, fault.getWarningTime());
}
if (fault.getNormalTime() != null ) {
queryWrapper.lt(FaultLog::getNormalTime, fault.getNormalTime());
}
return this.list(queryWrapper);
}
/**
*
* @param log
*/
@Override
public int insertFaultLog(FaultLog log) {
return 0;
}
/**
*
* @param log
*/
@Override
public int updateFaultLogByStatus(FaultLog log) {
log.setId(faultLogMapper.selectFaultId(log));
return faultLogMapper.updateFaultLogByTime(log);
}
}

View File

@ -2,7 +2,6 @@ package com.muyu.enterprise.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.muyu.domain.Fault;
import com.muyu.domain.FaultRule;
import com.muyu.domain.MessageValue;
import com.muyu.domain.VehicleType;
@ -12,7 +11,6 @@ import com.muyu.enterprise.service.FaultRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
@Service

View File

@ -1,63 +0,0 @@
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.common.core.web.domain.BaseEntity;
import com.muyu.domain.Fault;
import com.muyu.enterprise.mapper.FaultMapper;
import com.muyu.enterprise.service.FaultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* @AuthorChenYan
* @Project2112-car-cloud-server
* @Packagecom.muyu.fault.service
* @FilenameIFaultServiceImpl
* @Description TODO
* @Date2024/9/18 11:14
*/
@Service
public class FaultServiceImpl extends ServiceImpl<FaultMapper, Fault> implements FaultService {
@Autowired
private FaultMapper faultMapper;
/**
*
* @param fault
* @return fault
*/
@Override
public List<Fault> pageQuery(Fault fault) {
LambdaQueryWrapper<Fault> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotEmpty(fault.getFaultCode())) {
queryWrapper.like(Fault::getFaultCode, fault.getFaultCode());
}
if (StringUtils.isNotEmpty(fault.getFaultType())) {
queryWrapper.like(Fault::getFaultType, fault.getFaultType());
}
if (StringUtils.isNotEmpty(fault.getFaultName())) {
queryWrapper.like(Fault::getFaultName, fault.getFaultName());
}
Object beginTime = fault.getParams().get("beginTime");
if (Objects.nonNull(beginTime) && beginTime instanceof Date beginDate) {
queryWrapper.gt(BaseEntity::getCreateTime, beginDate);
}
Object endTime = fault.getParams().get("endTime");
if (Objects.nonNull(endTime) && endTime instanceof Date endDate) {
queryWrapper.lt(BaseEntity::getCreateTime, endDate);
}
return this.list(queryWrapper);
}
}

View File

@ -1,29 +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.FaultLogMapper">
<insert id="insertBatchFaultLog">
insert into faultlog (fault_code, vin, warning_time)
values
<foreach collection="logs" item="temp" separator=",">
(#{temp.faultCode},#{temp.vin},#{temp.warningTime})
</foreach>
</insert>
<update id="updateFaultLogByTime">
update faultlog
set normal_time = #{normalTime}
where id = #{id}
</update>
<select id="selectFaultId" resultType="java.lang.Long">
select max(id)
from faultlog
where fault_code = #{faultCode}
and vin = #{vin}
</select>
</mapper>

View File

@ -47,8 +47,8 @@ public class OnLineMonitoringConsumer {
@Resource
private AllVehicleCacheService allVehicleCacheService;
@Resource
private FaultCacheService faultCacheService;
// @Resource
// private FaultCacheService faultCacheService;
@Resource
private FenceCahceService fenceCahceService;
@ -69,7 +69,7 @@ public class OnLineMonitoringConsumer {
log.info("添加本地缓存,车辆vin: {}", vin);
// 获取redis中的数据
Fence fence = fenceCahceService.get(vin);
Object breakdown = faultCacheService.get(vin);
// Object breakdown = faultCacheService.get(vin);
Vehicle vehicle = vehicleCacheService.get(vin);
WarnRule warnRule = warnRuleCacheService.get(vin);
WarnRuleResp warnRuleResp = warnStrategyCacheService.get(vin);
@ -77,7 +77,7 @@ public class OnLineMonitoringConsumer {
// 封装从redis中获得的数据
HashMap<String, Object> map = new HashMap<>();
map.put("fence",fence);
map.put("breakdown",breakdown);
// map.put("breakdown",breakdown);
map.put("vehicle",vehicle);
map.put("warnRule",warnRule);
map.put("warnRuleResp",warnRuleResp);