diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/TbDevAttributeController.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/TbDevAttributeController.java index e434501..99300d1 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/TbDevAttributeController.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/TbDevAttributeController.java @@ -2,6 +2,7 @@ package com.bonus.base.controller; import com.alibaba.nacos.common.utils.CollectionUtils; import com.bonus.base.domain.TbDevAttribute; +import com.bonus.base.domain.TbDevDataRecord; import com.bonus.base.service.TbDevAttributeService; import com.bonus.base.vo.TbDevAttributeVo; import com.bonus.common.core.utils.poi.ExcelUtil; @@ -55,18 +56,6 @@ public class TbDevAttributeController extends BaseController { } - /** - * 编辑数据 - * - * @param record 实体 - * @return 编辑结果 - */ - @PutMapping - public AjaxResult edit(@RequestBody TbDevAttribute record) { - return toAjax(tbDevAttributeService.updateByPrimaryKeySelective(record)); - } - - /** * 删除数据 */ @@ -77,12 +66,12 @@ public class TbDevAttributeController extends BaseController { /** * 预警告警异常记录处理 - * @param handle + * @param tbDevDataRecord * @return */ @PostMapping("/handle") - public AjaxResult approve(@RequestBody TbDevAttribute handle) { - return tbDevAttributeService.handle(handle); + public AjaxResult approve(@RequestBody TbDevDataRecord tbDevDataRecord) { + return tbDevAttributeService.handle(tbDevDataRecord); } /** diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/TbDevDataRecord.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/TbDevDataRecord.java new file mode 100644 index 0000000..449ee19 --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/TbDevDataRecord.java @@ -0,0 +1,70 @@ +package com.bonus.base.domain; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 设备检测记录表(TbDevDataRecord)实体类 + * + * @author makejava + * @since 2024-09-29 09:57:11 + */ +@Data +public class TbDevDataRecord implements Serializable { + private static final long serialVersionUID = -77473094132432756L; + /** + * id + */ + private Long id; + /** + * 数据json + */ + private String devJson; + /** + * 设备id + */ + private Long devId; + /** + * 设备名称 + */ + private String devName; + /** + * 检测id + */ + private Long attributeId; + /** + * 检测名称 + */ + private String attributeName; + /** + * 检测值 + */ + private String attributeVal; + /** + * 合并项-同一批次 的此数据一致 + */ + private String mergerId; + /** + * 是否告警 + */ + private Integer isWarn; + /** + * 检测时间 + */ + private String createTime; + /** + * 设备类型 + */ + private String devType; + /** + * 0未处置 1已处置 + */ + private Integer isDispose; + /** + * 处置内容 + */ + private String remarks; + +} + diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/TbDevAttributeMapper.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/TbDevAttributeMapper.java index d9fd1c8..94926b8 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/TbDevAttributeMapper.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/TbDevAttributeMapper.java @@ -1,7 +1,7 @@ package com.bonus.base.mapper; +import com.bonus.base.domain.TbDevDataRecord; import com.bonus.base.vo.TbDevAttributeVo; import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; import com.bonus.base.domain.TbDevAttribute; import java.util.List; @@ -30,7 +30,7 @@ public interface TbDevAttributeMapper { /** * update record selective */ - int updateByPrimaryKeySelective(TbDevAttribute record); + int updateByPrimaryKeySelective(TbDevDataRecord tbDevDataRecord); /** * update record diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/TbDevAttributeService.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/TbDevAttributeService.java index 4a65f40..624ce49 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/TbDevAttributeService.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/TbDevAttributeService.java @@ -2,6 +2,7 @@ package com.bonus.base.service; import java.util.List; import com.bonus.base.domain.TbDevAttribute; +import com.bonus.base.domain.TbDevDataRecord; import com.bonus.base.vo.TbDevAttributeVo; import com.bonus.common.core.web.domain.AjaxResult; @@ -20,8 +21,6 @@ public interface TbDevAttributeService{ TbDevAttribute selectByPrimaryKey(Long id); - int updateByPrimaryKeySelective(TbDevAttribute record); - int updateByPrimaryKey(TbDevAttribute record); int updateBatch(List list); @@ -30,8 +29,8 @@ public interface TbDevAttributeService{ /** * 预警告警异常记录处理 - * @param handle + * @param tbDevDataRecord * @return */ - AjaxResult handle(TbDevAttribute handle); + AjaxResult handle(TbDevDataRecord tbDevDataRecord); } diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/impl/TbDevAttributeServiceImpl.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/impl/TbDevAttributeServiceImpl.java index 92509aa..d900dcb 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/impl/TbDevAttributeServiceImpl.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/impl/TbDevAttributeServiceImpl.java @@ -1,6 +1,7 @@ package com.bonus.base.service.impl; import com.alibaba.nacos.common.utils.CollectionUtils; +import com.bonus.base.domain.TbDevDataRecord; import com.bonus.base.vo.TbDevAttributeVo; import com.bonus.common.core.web.domain.AjaxResult; import org.springframework.stereotype.Service; @@ -49,11 +50,6 @@ public class TbDevAttributeServiceImpl implements TbDevAttributeService{ return tbDevAttributeMapper.selectByPrimaryKey(id); } - @Override - public int updateByPrimaryKeySelective(TbDevAttribute record) { - return tbDevAttributeMapper.updateByPrimaryKeySelective(record); - } - @Override public int updateByPrimaryKey(TbDevAttribute record) { return tbDevAttributeMapper.updateByPrimaryKey(record); @@ -69,10 +65,10 @@ public class TbDevAttributeServiceImpl implements TbDevAttributeService{ List list = tbDevAttributeMapper.queryAll(record); if (CollectionUtils.isNotEmpty(list)) { for (TbDevAttributeVo attribute : list) { - if (attribute.getIsWarn() == 1) { - attribute.setWarnName(attribute.getJcName() + "超过阈值"); + attribute.setWarnName(attribute.getDevName() + attribute.getJcName() + "检测异常"); + if ("0".equals(attribute.getStatus())) { attribute.setStatus("未处置"); - } else { + } else if ("1".equals(attribute.getStatus())) { attribute.setStatus("已处置"); } } @@ -82,12 +78,12 @@ public class TbDevAttributeServiceImpl implements TbDevAttributeService{ /** * 预警告警异常记录处理 - * @param handle + * @param tbDevDataRecord * @return */ @Override - public AjaxResult handle(TbDevAttribute handle) { - int result = tbDevAttributeMapper.updateByPrimaryKeySelective(handle); + public AjaxResult handle(TbDevDataRecord tbDevDataRecord) { + int result = tbDevAttributeMapper.updateByPrimaryKeySelective(tbDevDataRecord); return result > 0 ? AjaxResult.success("处理成功") : AjaxResult.error("处理失败"); } } diff --git a/bonus-modules/bonus-base/src/main/resources/mapper/base/TbDevAttributeMapper.xml b/bonus-modules/bonus-base/src/main/resources/mapper/base/TbDevAttributeMapper.xml index 038c929..5424f91 100644 --- a/bonus-modules/bonus-base/src/main/resources/mapper/base/TbDevAttributeMapper.xml +++ b/bonus-modules/bonus-base/src/main/resources/mapper/base/TbDevAttributeMapper.xml @@ -28,33 +28,33 @@ @@ -143,39 +143,18 @@ - + - update tb_dev_attribute + update tb_dev_data_record dev_id = #{devId,jdbcType=BIGINT}, - - jc_name = #{jcName,jdbcType=VARCHAR}, - - - jc_value = #{jcValue,jdbcType=VARCHAR}, - - - jc_unit = #{jcUnit,jdbcType=VARCHAR}, - - - logo_url = #{logoUrl,jdbcType=VARCHAR}, - - - del_flag = #{delFlag,jdbcType=INTEGER}, - - - rel_code = #{relCode,jdbcType=VARCHAR}, - - - is_warn = #{isWarn,jdbcType=INTEGER}, - - - jc_time = #{jcTime,jdbcType=VARCHAR}, + + is_dispose = #{isDispose,jdbcType=INTEGER}, - remarks = #{remarks}, + remark = #{remarks}, where id = #{id,jdbcType=BIGINT}