Parcourir la source

修改设备异常表为消息表

李进 il y a 1 an
Parent
commit
2d433d3bf0

+ 2 - 2
device-api-cloud/src/main/java/com/xy/feign/DeviceErrorsRecordFeign.java → device-api-cloud/src/main/java/com/xy/feign/DeviceEventMsgFeign.java

@@ -2,7 +2,7 @@ package com.xy.feign;
 
 
 import com.xy.FeignInterceptor;
 import com.xy.FeignInterceptor;
 import com.xy.consts.ServiceConsts;
 import com.xy.consts.ServiceConsts;
-import com.xy.service.DeviceErrorsRecordService;
+import com.xy.service.DeviceEventMsgService;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.cloud.openfeign.FeignClient;
 
 
 /**
 /**
@@ -14,5 +14,5 @@ import org.springframework.cloud.openfeign.FeignClient;
  * @since 2023/3/3
  * @since 2023/3/3
  */
  */
 @FeignClient(value = ServiceConsts.SERVICE_NAME, configuration = FeignInterceptor.class)
 @FeignClient(value = ServiceConsts.SERVICE_NAME, configuration = FeignInterceptor.class)
-public interface DeviceErrorsRecordFeign extends DeviceErrorsRecordService {
+public interface DeviceEventMsgFeign extends DeviceEventMsgService {
 }
 }

+ 7 - 7
device-api-service-merc-mini/src/main/java/com/xy/controller/MercMiniDeviceRecordsController.java

@@ -2,7 +2,7 @@ package com.xy.controller;
 
 
 import com.xy.annotate.RestMappingController;
 import com.xy.annotate.RestMappingController;
 import com.xy.dto.*;
 import com.xy.dto.*;
-import com.xy.service.DeviceErrorsRecordService;
+import com.xy.service.DeviceEventMsgService;
 import com.xy.service.DeviceNetRecordService;
 import com.xy.service.DeviceNetRecordService;
 import com.xy.service.DeviceRecordsService;
 import com.xy.service.DeviceRecordsService;
 import com.xy.service.DeviceTempRecordsService;
 import com.xy.service.DeviceTempRecordsService;
@@ -39,7 +39,7 @@ public class MercMiniDeviceRecordsController {
 
 
     private final DeviceNetRecordService deviceNetRecordService;
     private final DeviceNetRecordService deviceNetRecordService;
 
 
-    private final DeviceErrorsRecordService deviceErrorsRecordService;
+    private final DeviceEventMsgService deviceEventMsgService;
 
 
     private final DeviceTempRecordsService deviceTempRecordsService;
     private final DeviceTempRecordsService deviceTempRecordsService;
 
 
@@ -81,19 +81,19 @@ public class MercMiniDeviceRecordsController {
 
 
     @ApiOperation("故障记录分页")
     @ApiOperation("故障记录分页")
     @PostMapping("deviceErrorPage")
     @PostMapping("deviceErrorPage")
-    public R<PageBean<DeviceErrorsRecordDto.Vo>> deviceErrorPage(@RequestBody DeviceErrorsRecordDto.Page page) {
-        return deviceErrorsRecordService.page(page);
+    public R<PageBean<DeviceEventMsgDto.Vo>> deviceErrorPage(@RequestBody DeviceEventMsgDto.Page page) {
+        return deviceEventMsgService.page(page);
     }
     }
 
 
     @ApiOperation("设备详情首页-故障记录")
     @ApiOperation("设备详情首页-故障记录")
     @PostMapping("indexDeviceError")
     @PostMapping("indexDeviceError")
-    public R<List<DeviceErrorsRecordDto.Vo>> indexDeviceError(@RequestBody @Validated MiniDeviceRecordsDto.DeviceErrorPageDto dto) {
-        DeviceErrorsRecordDto.Page page = (DeviceErrorsRecordDto.Page) new DeviceErrorsRecordDto.Page()
+    public R<List<DeviceEventMsgDto.Vo>> indexDeviceError(@RequestBody @Validated MiniDeviceRecordsDto.DeviceErrorPageDto dto) {
+        DeviceEventMsgDto.Page page = (DeviceEventMsgDto.Page) new DeviceEventMsgDto.Page()
                 .setMercId(MercAuthUtils.getMercId())
                 .setMercId(MercAuthUtils.getMercId())
                 .setDeviceId(dto.getDeviceId())
                 .setDeviceId(dto.getDeviceId())
                 .setCode(dto.getCode());
                 .setCode(dto.getCode());
         page.setPage(getPageBean(INDEX_RECORDS_COUNT));
         page.setPage(getPageBean(INDEX_RECORDS_COUNT));
-        List<DeviceErrorsRecordDto.Vo> recordsList = deviceErrorPage(page).getData().getRecords();
+        List<DeviceEventMsgDto.Vo> recordsList = deviceErrorPage(page).getData().getRecords();
         return R.ok(recordsList);
         return R.ok(recordsList);
     }
     }
 
 

+ 6 - 6
device-api-service/src/main/java/com/xy/entity/DeviceErrorsRecord.java → device-api-service/src/main/java/com/xy/entity/DeviceEventMsg.java

@@ -13,7 +13,7 @@ import java.time.LocalDateTime;
 
 
 /**
 /**
  * <p>
  * <p>
- * 机器-故障
+ * 机器-消息
  * </p>
  * </p>
  *
  *
  * @author lijin
  * @author lijin
@@ -22,8 +22,8 @@ import java.time.LocalDateTime;
 @Data
 @Data
 @EqualsAndHashCode(callSuper = false)
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @Accessors(chain = true)
-@ApiModel(value = "DeviceErrorsRecord对象", description = "机器-故障表")
-public class DeviceErrorsRecord implements Serializable {
+@ApiModel(value = "DeviceEventMsg对象", description = "机器-消息表")
+public class DeviceEventMsg implements Serializable {
 
 
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
@@ -37,11 +37,11 @@ public class DeviceErrorsRecord implements Serializable {
     @ApiModelProperty(value = "设备编号")
     @ApiModelProperty(value = "设备编号")
     private Long deviceId;
     private Long deviceId;
 
 
-    @ApiModelProperty(value = "故障编码")
+    @ApiModelProperty(value = "消息编码")
     private String code;
     private String code;
 
 
-    @ApiModelProperty(value = "故障内容")
-    private String errorMsg;
+    @ApiModelProperty(value = "消息内容")
+    private String msg;
 
 
     @ApiModelProperty(value = "创建时间")
     @ApiModelProperty(value = "创建时间")
     private LocalDateTime createTime;
     private LocalDateTime createTime;

+ 11 - 11
device-api-service/src/main/java/com/xy/job/DeviceErrorsRecordJob.java → device-api-service/src/main/java/com/xy/job/DeviceEventMsgJob.java

@@ -3,9 +3,9 @@ package com.xy.job;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.core.handler.annotation.XxlJob;
-import com.xy.entity.DeviceErrorsRecord;
+import com.xy.entity.DeviceEventMsg;
 import com.xy.entity.SysDictRedis;
 import com.xy.entity.SysDictRedis;
-import com.xy.mapper.DeviceErrorsRecordMapper;
+import com.xy.mapper.DeviceEventMsgMapper;
 import com.xy.utils.DataTime;
 import com.xy.utils.DataTime;
 import com.xy.utils.JobUtils;
 import com.xy.utils.JobUtils;
 import com.xy.utils.SysDictUtils;
 import com.xy.utils.SysDictUtils;
@@ -16,7 +16,7 @@ import org.springframework.stereotype.Component;
 
 
 /**
 /**
  * <p>
  * <p>
- * 机器-故障表job
+ * 机器-消息表job
  * </p>
  * </p>
  *
  *
  * @author lijin
  * @author lijin
@@ -25,28 +25,28 @@ import org.springframework.stereotype.Component;
 @Slf4j
 @Slf4j
 @Component
 @Component
 @AllArgsConstructor
 @AllArgsConstructor
-public class DeviceErrorsRecordJob {
+public class DeviceEventMsgJob {
 
 
-    private DeviceErrorsRecordMapper deviceErrorsRecordMapper;
+    private DeviceEventMsgMapper deviceEventMsgMapper;
 
 
     /**
     /**
      * 数据清除
      * 数据清除
      *
      *
      * @return
      * @return
      */
      */
-    @XxlJob("DeviceErrorsRecord")
-    public ReturnT<String> delDeviceErrorsRecord() {
+    @XxlJob("delDeviceEventMsgRecord")
+    public ReturnT<String> delDeviceEventMsgRecord() {
         //数据保留的天数
         //数据保留的天数
         SysDictRedis sysDictRedis = SysDictUtils.get(DictEnum.DATA_CLEAR_SIZE.getKey(), "device_errors_record_day");
         SysDictRedis sysDictRedis = SysDictUtils.get(DictEnum.DATA_CLEAR_SIZE.getKey(), "device_errors_record_day");
         Integer jobParam = JobUtils.getPrams().gtInt();
         Integer jobParam = JobUtils.getPrams().gtInt();
         Integer saveDay = jobParam != null ? jobParam
         Integer saveDay = jobParam != null ? jobParam
                 : sysDictRedis != null ? Integer.valueOf(sysDictRedis.getValue())
                 : sysDictRedis != null ? Integer.valueOf(sysDictRedis.getValue())
                 : 365;
                 : 365;
-        LambdaQueryWrapper<DeviceErrorsRecord> lambdaQueryWrapper = new LambdaQueryWrapper<DeviceErrorsRecord>()
-                .le(DeviceErrorsRecord::getCreateTime, DataTime.getStringAround(0, 0, (~(saveDay - 1)), 0, 0, 0));
-        int delete = deviceErrorsRecordMapper.delete(lambdaQueryWrapper);
+        LambdaQueryWrapper<DeviceEventMsg> lambdaQueryWrapper = new LambdaQueryWrapper<DeviceEventMsg>()
+                .le(DeviceEventMsg::getCreateTime, DataTime.getStringAround(0, 0, (~(saveDay - 1)), 0, 0, 0));
+        int delete = deviceEventMsgMapper.delete(lambdaQueryWrapper);
         if (delete > 0) {
         if (delete > 0) {
-            log.info("机器故障数据清除完成,共{}条", delete);
+            log.info("机器消息数据清除完成,共{}条", delete);
         }
         }
         return ReturnT.SUCCESS;
         return ReturnT.SUCCESS;
     }
     }

+ 0 - 16
device-api-service/src/main/java/com/xy/mapper/DeviceErrorsRecordMapper.java

@@ -1,16 +0,0 @@
-package com.xy.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xy.entity.DeviceErrorsRecord;
-
-/**
- * <p>
- * 机器-故障表 Mapper 接口
- * </p>
- *
- * @author lijin
- * @since 2023-01-09
- */
-public interface DeviceErrorsRecordMapper extends BaseMapper<DeviceErrorsRecord> {
-
-}

+ 16 - 0
device-api-service/src/main/java/com/xy/mapper/DeviceEventMsgMapper.java

@@ -0,0 +1,16 @@
+package com.xy.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xy.entity.DeviceEventMsg;
+
+/**
+ * <p>
+ * 机器-消息表 Mapper 接口
+ * </p>
+ *
+ * @author lijin
+ * @since 2023-01-09
+ */
+public interface DeviceEventMsgMapper extends BaseMapper<DeviceEventMsg> {
+
+}

+ 52 - 31
device-api-service/src/main/java/com/xy/service/DeviceErrorsRecordServiceImpl.java → device-api-service/src/main/java/com/xy/service/DeviceEventMsgServiceImpl.java

@@ -3,12 +3,12 @@ package com.xy.service;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xy.dto.DeviceErrorsRecordDto;
+import com.xy.dto.DeviceEventMsgDto;
 import com.xy.dto.DeviceInfoDto;
 import com.xy.dto.DeviceInfoDto;
-import com.xy.entity.DeviceErrorsRecord;
+import com.xy.entity.DeviceEventMsg;
 import com.xy.entity.DeviceInfo;
 import com.xy.entity.DeviceInfo;
 import com.xy.entity.SysCodeConfigureRedis;
 import com.xy.entity.SysCodeConfigureRedis;
-import com.xy.mapper.DeviceErrorsRecordMapper;
+import com.xy.mapper.DeviceEventMsgMapper;
 import com.xy.utils.*;
 import com.xy.utils.*;
 import com.xy.utils.enums.SysCodeConfigureEnum;
 import com.xy.utils.enums.SysCodeConfigureEnum;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
 
 
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
@@ -30,56 +31,62 @@ import static com.xy.utils.PlusBeans.toPageBean;
 
 
 /**
 /**
  * <p>
  * <p>
- * 机器-故障表 服务实现类
+ * 机器-消息表 服务实现类
  * </p>
  * </p>
  *
  *
  * @author lijin
  * @author lijin
  * @since 2023-01-09
  * @since 2023-01-09
  */
  */
 @Service
 @Service
-@Api(tags = "机器-故障表")
+@Api(tags = "机器-消息表")
 @AllArgsConstructor(onConstructor_ = @Lazy)
 @AllArgsConstructor(onConstructor_ = @Lazy)
-public class DeviceErrorsRecordServiceImpl extends ServiceImpl<DeviceErrorsRecordMapper, DeviceErrorsRecord> implements DeviceErrorsRecordService {
+public class DeviceEventMsgServiceImpl extends ServiceImpl<DeviceEventMsgMapper, DeviceEventMsg> implements DeviceEventMsgService {
 
 
     private DeviceInfoServiceImpl deviceInfoService;
     private DeviceInfoServiceImpl deviceInfoService;
 
 
     @Override
     @Override
     @ApiOperation("添加")
     @ApiOperation("添加")
-    public R save(DeviceErrorsRecordDto.Save save) {
+    public R save(DeviceEventMsgDto.Save save) {
         DeviceInfoDto.Vo deviceInfo = deviceInfoService.obj(new DeviceInfoDto.Obj().setDeviceId(save.getDeviceId()).setIsSysinfo(true)).getData();
         DeviceInfoDto.Vo deviceInfo = deviceInfoService.obj(new DeviceInfoDto.Obj().setDeviceId(save.getDeviceId()).setIsSysinfo(true)).getData();
         if (deviceInfo == null) {
         if (deviceInfo == null) {
             return R.fail("设备不存在");
             return R.fail("设备不存在");
         }
         }
-        //添加故障记录
+        //查询消息编码信息
+        String paterCode = save.getCode().substring(0, save.getCode().length() - 1);
+        SysCodeConfigureRedis sysCodeConfigureRedis = SysCodeConfigureUtils.get(paterCode, save.getCode());
+        //添加消息记录
         save.setMercId(deviceInfo.getMercId());
         save.setMercId(deviceInfo.getMercId());
-        DeviceErrorsRecord deviceErrorsRecord = copy(DeviceErrorsRecord.class, save)
+        DeviceEventMsg deviceEventMsg = copy(DeviceEventMsg.class, save)
                 .setCreateTime(LocalDateTime.now());
                 .setCreateTime(LocalDateTime.now());
-        save(deviceErrorsRecord);
-        SysCodeConfigureRedis sysCodeConfigureRedis = SysCodeConfigureUtils.get(SysCodeConfigureEnum.D01.getCode(), save.getCode());
-        //修改设备当前故障等级
-        if (Emptys.check(sysCodeConfigureRedis.getExpand())) {
-            DeviceInfo updateDeviceInfo = new DeviceInfo()
-                    .setDeviceId(deviceInfo.getDeviceId())
-                    .setFaultLevel(Integer.valueOf(sysCodeConfigureRedis.getExpand()));
-            deviceInfoService.updateById(updateDeviceInfo);
+        save(deviceEventMsg);
+        //异常消息,修改设备当前故障等级
+        if (paterCode.equals(SysCodeConfigureEnum.D01.getCode())) {
+            if (Emptys.check(sysCodeConfigureRedis.getExpand())) {
+                DeviceInfo updateDeviceInfo = new DeviceInfo()
+                        .setDeviceId(deviceInfo.getDeviceId())
+                        .setFaultLevel(Integer.valueOf(sysCodeConfigureRedis.getExpand()));
+                deviceInfoService.updateById(updateDeviceInfo);
+            }
         }
         }
         return R.ok();
         return R.ok();
     }
     }
 
 
     @Override
     @Override
     @ApiOperation("分页查询")
     @ApiOperation("分页查询")
-    public R<PageBean<DeviceErrorsRecordDto.Vo>> page(@RequestBody DeviceErrorsRecordDto.Page page) {
+    public R<PageBean<DeviceEventMsgDto.Vo>> page(@RequestBody DeviceEventMsgDto.Page page) {
+        List<String> codes = getCodes(page.getCode());
         PageBean pageBean = page.getPage();
         PageBean pageBean = page.getPage();
-        LambdaQueryWrapper<DeviceErrorsRecord> lambdaQueryWrapper = new MybatisPlusQuery().eqWrapper(page, DeviceErrorsRecord.class)
-                .ge(DeviceErrorsRecord::getCreateTime, page.getBeginCreateTime())
-                .le(DeviceErrorsRecord::getCreateTime, page.getEndCreateTime())
+        LambdaQueryWrapper<DeviceEventMsg> lambdaQueryWrapper = new MybatisPlusQuery().eqWrapper(page, DeviceEventMsg.class)
+                .ge(DeviceEventMsg::getCreateTime, page.getBeginCreateTime())
+                .le(DeviceEventMsg::getCreateTime, page.getEndCreateTime())
+                .in(DeviceEventMsg::getCode, codes)
                 .build()
                 .build()
-                .orderByDesc(!Emptys.check(pageBean.getOrders()), DeviceErrorsRecord::getId);
-        IPage<DeviceErrorsRecord> iPage = page(toIPage(pageBean), lambdaQueryWrapper);
-        PageBean<DeviceErrorsRecordDto.Vo> voPageBean = toPageBean(DeviceErrorsRecordDto.Vo.class, iPage);
+                .orderByDesc(!Emptys.check(pageBean.getOrders()), DeviceEventMsg::getId);
+        IPage<DeviceEventMsg> iPage = page(toIPage(pageBean), lambdaQueryWrapper);
+        PageBean<DeviceEventMsgDto.Vo> voPageBean = toPageBean(DeviceEventMsgDto.Vo.class, iPage);
         //反显设备名称
         //反显设备名称
         if (Emptys.check(voPageBean.getRecords())) {
         if (Emptys.check(voPageBean.getRecords())) {
-            List<Long> deviceIdList = voPageBean.getRecords().stream().map(DeviceErrorsRecordDto.Vo::getDeviceId).collect(Collectors.toList());
+            List<Long> deviceIdList = voPageBean.getRecords().stream().map(DeviceEventMsgDto.Vo::getDeviceId).collect(Collectors.toList());
             Map<Long, String> deviceMap = deviceInfoService.getDeviceNameList(new DeviceInfoDto.DeviceIdDto().setDeviceId(deviceIdList)).getData();
             Map<Long, String> deviceMap = deviceInfoService.getDeviceNameList(new DeviceInfoDto.DeviceIdDto().setDeviceId(deviceIdList)).getData();
             Map<String, SysCodeConfigureRedis> stringSysCodeConfigureRedisMap = SysCodeConfigureUtils.get(SysCodeConfigureEnum.D01.getCode());
             Map<String, SysCodeConfigureRedis> stringSysCodeConfigureRedisMap = SysCodeConfigureUtils.get(SysCodeConfigureEnum.D01.getCode());
             voPageBean.getRecords().forEach(i -> {
             voPageBean.getRecords().forEach(i -> {
@@ -95,14 +102,16 @@ public class DeviceErrorsRecordServiceImpl extends ServiceImpl<DeviceErrorsRecor
 
 
     @PostMapping("list")
     @PostMapping("list")
     @ApiOperation("集合查询")
     @ApiOperation("集合查询")
-    public R<List<DeviceErrorsRecordDto.Vo>> list(@RequestBody DeviceErrorsRecordDto.SelectList selectList) {
-        LambdaQueryWrapper<DeviceErrorsRecord> lambdaQueryWrapper = new MybatisPlusQuery().eqWrapper(selectList, DeviceErrorsRecord.class)
-                .in(DeviceErrorsRecord::getId, selectList.getIds())
-                .in(DeviceErrorsRecord::getDeviceId, selectList.getDeviceIds())
+    public R<List<DeviceEventMsgDto.Vo>> list(@RequestBody DeviceEventMsgDto.SelectList selectList) {
+        List<String> codes = getCodes(selectList.getCode());
+        LambdaQueryWrapper<DeviceEventMsg> lambdaQueryWrapper = new MybatisPlusQuery().eqWrapper(selectList, DeviceEventMsg.class)
+                .in(DeviceEventMsg::getId, selectList.getIds())
+                .in(DeviceEventMsg::getDeviceId, selectList.getDeviceIds())
+                .in(DeviceEventMsg::getCode, codes)
                 .build();
                 .build();
-        List<DeviceErrorsRecord> list = list(lambdaQueryWrapper);
+        List<DeviceEventMsg> list = list(lambdaQueryWrapper);
         Map<String, SysCodeConfigureRedis> stringSysCodeConfigureRedisMap = SysCodeConfigureUtils.get(SysCodeConfigureEnum.D01.getCode());
         Map<String, SysCodeConfigureRedis> stringSysCodeConfigureRedisMap = SysCodeConfigureUtils.get(SysCodeConfigureEnum.D01.getCode());
-        List<DeviceErrorsRecordDto.Vo> vos = copy(DeviceErrorsRecordDto.Vo.class, list);
+        List<DeviceEventMsgDto.Vo> vos = copy(DeviceEventMsgDto.Vo.class, list);
         vos.forEach(vo -> {
         vos.forEach(vo -> {
             SysCodeConfigureRedis sysCodeConfigureRedis = stringSysCodeConfigureRedisMap.get(vo.getCode());
             SysCodeConfigureRedis sysCodeConfigureRedis = stringSysCodeConfigureRedisMap.get(vo.getCode());
             if (sysCodeConfigureRedis != null) {
             if (sysCodeConfigureRedis != null) {
@@ -112,4 +121,16 @@ public class DeviceErrorsRecordServiceImpl extends ServiceImpl<DeviceErrorsRecor
         return R.ok(vos);
         return R.ok(vos);
     }
     }
 
 
+    private List<String> getCodes(String code) {
+        List<String> codes = new ArrayList<>();
+        if (Emptys.check(code)) {
+            Map<String, SysCodeConfigureRedis> stringSysCodeConfigureRedisMap = SysCodeConfigureUtils.get(code);
+            if (Emptys.check(stringSysCodeConfigureRedisMap)) {
+                stringSysCodeConfigureRedisMap.forEach((code2, sysCodeConfigureRedis) -> codes.add(code2));
+            } else {
+                codes.add(code);
+            }
+        }
+        return codes;
+    }
 }
 }

+ 5 - 5
device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

@@ -69,7 +69,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
 
 
     private final DeviceRegisterServiceImpl deviceRegisterService;
     private final DeviceRegisterServiceImpl deviceRegisterService;
 
 
-    private final DeviceErrorsRecordServiceImpl deviceErrorsRecordService;
+    private final DeviceEventMsgServiceImpl deviceEventMsgService;
 
 
     private final DeviceDataServiceImpl deviceDataService;
     private final DeviceDataServiceImpl deviceDataService;
 
 
@@ -685,10 +685,10 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
         }
         }
         if (BooleanUtil.isTrue(fault)) {
         if (BooleanUtil.isTrue(fault)) {
             //查询故障设备
             //查询故障设备
-            List<DeviceErrorsRecord> deviceErrorsRecords = deviceErrorsRecordService.list(Wrappers.<DeviceErrorsRecord>lambdaQuery()
-                    .eq(mercId != null, DeviceErrorsRecord::getMercId, page.getMercId())
-                    .in(DeviceErrorsRecord::getDeviceId, myDeviceIds));
-            List<Long> deviceIdList = deviceErrorsRecords.stream().map(DeviceErrorsRecord::getDeviceId).collect(Collectors.toList());
+            List<DeviceEventMsg> deviceEventMsgs = deviceEventMsgService.list(Wrappers.<DeviceEventMsg>lambdaQuery()
+                    .eq(mercId != null, DeviceEventMsg::getMercId, page.getMercId())
+                    .in(DeviceEventMsg::getDeviceId, myDeviceIds));
+            List<Long> deviceIdList = deviceEventMsgs.stream().map(DeviceEventMsg::getDeviceId).collect(Collectors.toList());
             if (CollUtil.isEmpty(deviceIdList)) {
             if (CollUtil.isEmpty(deviceIdList)) {
                 return R.ok(new PageBean<>());
                 return R.ok(new PageBean<>());
             }
             }

+ 13 - 12
device-api/src/main/java/com/xy/dto/DeviceErrorsRecordDto.java → device-api/src/main/java/com/xy/dto/DeviceEventMsgDto.java

@@ -14,13 +14,13 @@ import java.util.List;
 
 
 /**
 /**
  * <p>
  * <p>
- * 机器-故障
+ * 机器-消息
  * </p>
  * </p>
  *
  *
  * @author lijin
  * @author lijin
  * @since 2023-01-09
  * @since 2023-01-09
  */
  */
-public class DeviceErrorsRecordDto {
+public class DeviceEventMsgDto {
 
 
     @Data
     @Data
     @Accessors(chain = true)
     @Accessors(chain = true)
@@ -74,27 +74,28 @@ public class DeviceErrorsRecordDto {
         @ApiModelProperty(value = "id")
         @ApiModelProperty(value = "id")
         private Integer id;
         private Integer id;
 
 
-        @ApiModelProperty(value = "设备编号")
-        private Long deviceId;
-
-        @ApiModelProperty(value = "设备名称")
-        private String deviceName;
-
         @ApiModelProperty(value = "商户ID")
         @ApiModelProperty(value = "商户ID")
         private Long mercId;
         private Long mercId;
 
 
-        @ApiModelProperty(value = "故障编码")
+        @ApiModelProperty(value = "设备编号")
+        private Long deviceId;
+
+        @ApiModelProperty(value = "消息编码")
         private String code;
         private String code;
 
 
-        @ApiModelProperty(value = "故障内容")
-        private String errorMsg;
+        @ApiModelProperty(value = "消息内容")
+        private String msg;
 
 
         @ApiModelProperty(value = "创建时间")
         @ApiModelProperty(value = "创建时间")
         @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
         @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
         private LocalDateTime createTime;
         private LocalDateTime createTime;
 
 
-        @ApiModelProperty(value = "故障详情")
+        @ApiModelProperty(value = "设备名称")
+        private String deviceName;
+
+        @ApiModelProperty(value = "消息编码详情")
         private SysCodeConfigureRedis sysCodeConfigureRedis;
         private SysCodeConfigureRedis sysCodeConfigureRedis;
+
     }
     }
 
 
 }
 }

+ 6 - 6
device-api/src/main/java/com/xy/service/DeviceErrorsRecordService.java → device-api/src/main/java/com/xy/service/DeviceEventMsgService.java

@@ -1,7 +1,7 @@
 package com.xy.service;
 package com.xy.service;
 
 
 import com.xy.annotate.RestMappingController;
 import com.xy.annotate.RestMappingController;
-import com.xy.dto.DeviceErrorsRecordDto;
+import com.xy.dto.DeviceEventMsgDto;
 import com.xy.utils.PageBean;
 import com.xy.utils.PageBean;
 import com.xy.utils.R;
 import com.xy.utils.R;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.validation.annotation.Validated;
@@ -10,14 +10,14 @@ import org.springframework.web.bind.annotation.RequestBody;
 
 
 /**
 /**
  * <p>
  * <p>
- * 机器-故障表 服务类
+ * 机器-消息表 服务类
  * </p>
  * </p>
  *
  *
  * @author lijin
  * @author lijin
  * @since 2023-01-09
  * @since 2023-01-09
  */
  */
-@RestMappingController("/device-errors-record")
-public interface DeviceErrorsRecordService {
+@RestMappingController("/device-event-msg")
+public interface DeviceEventMsgService {
 
 
     /**
     /**
      * 分页查询
      * 分页查询
@@ -26,7 +26,7 @@ public interface DeviceErrorsRecordService {
      * @return
      * @return
      */
      */
     @PostMapping("page")
     @PostMapping("page")
-    R<PageBean<DeviceErrorsRecordDto.Vo>> page(@RequestBody DeviceErrorsRecordDto.Page page);
+    R<PageBean<DeviceEventMsgDto.Vo>> page(@RequestBody DeviceEventMsgDto.Page page);
 
 
     /**
     /**
      * 添加
      * 添加
@@ -35,5 +35,5 @@ public interface DeviceErrorsRecordService {
      * @return
      * @return
      */
      */
     @PostMapping("save")
     @PostMapping("save")
-    R save(@RequestBody @Validated DeviceErrorsRecordDto.Save save);
+    R save(@RequestBody @Validated DeviceEventMsgDto.Save save);
 }
 }