15928045575 %!s(int64=2) %!d(string=hai) anos
pai
achega
3883e40890
Modificáronse 16 ficheiros con 536 adicións e 22 borrados
  1. 35 0
      slope-common/slope-common-core/src/main/java/com/sckw/core/model/enums/AlarmTypeEnum.java
  2. 8 0
      slope-common/slope-common-core/src/main/java/com/sckw/core/model/enums/DeviceEnum.java
  3. 33 4
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/DeviceController.java
  4. 8 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/dao/mysql/KwsAlarmMapper.java
  5. 4 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/dao/mysql/KwsDeviceMapper.java
  6. 12 6
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dos/mysql/KwsDevice.java
  7. 1 4
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dos/mysql/KwsDeviceModel.java
  8. 81 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/param/DeviceAdd.java
  9. 4 4
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/param/DeviceQuery.java
  10. 151 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/DeviceVo.java
  11. 5 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/ProjectVo.java
  12. 107 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/DeviceService.java
  13. 51 0
      slope-modules/slope-detection/src/main/resources/bootstrap-sky.yml
  14. 1 1
      slope-modules/slope-detection/src/main/resources/bootstrap.yml
  15. 15 0
      slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsAlarmMapper.xml
  16. 20 3
      slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsDeviceMapper.xml

+ 35 - 0
slope-common/slope-common-core/src/main/java/com/sckw/core/model/enums/AlarmTypeEnum.java

@@ -0,0 +1,35 @@
+package com.sckw.core.model.enums;
+
+import lombok.Getter;
+
+/**
+ * @author czh
+ * @desc 告警类型
+ * @date 2023/6/15
+ */
+@Getter
+public enum AlarmTypeEnum {
+
+    //自主入驻
+    ALARM_ONE(1, "数据告警"),
+    //平台接入
+    ALARM_TWO(2, "设备告警");
+
+    private final int code;
+
+    private final String name;
+
+    AlarmTypeEnum(int code, String name){
+        this.code = code;
+        this.name = name;
+    }
+
+    public static AlarmTypeEnum getName(int code) {
+        for (AlarmTypeEnum entryTypeEnum : values()) {
+            if (entryTypeEnum.getCode() == code) {
+                return entryTypeEnum;
+            }
+        }
+        return null;
+    }
+}

+ 8 - 0
slope-common/slope-common-core/src/main/java/com/sckw/core/model/enums/DeviceEnum.java

@@ -51,4 +51,12 @@ public enum DeviceEnum {
         this.status = status;
         this.status = status;
         this.destination = destination;
         this.destination = destination;
     }
     }
+    public static String getName(Integer code) {
+        for (DeviceEnum deviceEnum : DeviceEnum.values()) {
+            if (deviceEnum.getCode().equals(code)) {
+                return deviceEnum.getDestination();
+            }
+        }
+        return null;
+    }
 }
 }

+ 33 - 4
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/DeviceController.java

@@ -3,14 +3,19 @@ package com.sckw.slope.detection.controller;
 import com.sckw.core.annotation.Log;
 import com.sckw.core.annotation.Log;
 import com.sckw.core.annotation.RepeatSubmit;
 import com.sckw.core.annotation.RepeatSubmit;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.core.web.response.HttpResult;
+import com.sckw.slope.detection.model.param.DeviceAdd;
+import com.sckw.slope.detection.model.param.DeviceQuery;
 import com.sckw.slope.detection.service.DeviceService;
 import com.sckw.slope.detection.service.DeviceService;
+import jakarta.servlet.http.HttpServletRequest;
 import jakarta.validation.constraints.NotBlank;
 import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+import com.alibaba.fastjson2.JSONObject;
+import jakarta.validation.Valid;
+import org.apache.http.HttpResponse;
+
 
 
 /**
 /**
  * @author lfdc
  * @author lfdc
@@ -40,4 +45,28 @@ public class DeviceController {
         log.info("所属设备查询 deviceAll param :{}",projectId);
         log.info("所属设备查询 deviceAll param :{}",projectId);
         return deviceService.deviceAll(projectId);
         return deviceService.deviceAll(projectId);
     }
     }
+
+    @Log(description = "设备查询-分页")
+    @RepeatSubmit(interval = 3000, message = "两次请求间隔未超过3秒")
+    @RequestMapping(name = "设备查询-分页", value = "/select", method = RequestMethod.POST)
+    public HttpResult select(@Valid @RequestBody DeviceQuery deviceQuery, HttpResponse response) {
+        log.info("设备查询 select param:{}", JSONObject.toJSONString(deviceQuery));
+        return HttpResult.ok(deviceService.select(deviceQuery, response));
+    }
+
+    @Log(description = "设备新增")
+    @RepeatSubmit(interval = 3000, message = "两次请求间隔未超过3秒")
+    @RequestMapping(name = "设备新增", value = "/add", method = RequestMethod.POST)
+    public HttpResult add(@Valid @RequestBody DeviceAdd deviceAdd, HttpServletRequest response) {
+        log.info("设备新增 add param:{}", JSONObject.toJSONString(deviceAdd));
+        return deviceService.add(deviceAdd, response);
+    }
+
+    @Log(description = "设备详情")
+    @RepeatSubmit(interval = 3000, message = "两次请求间隔未超过3秒")
+    @RequestMapping(name = "设备详情", value = "/detail", method = RequestMethod.GET)
+    public HttpResult detail(@RequestParam("id") @NotNull(message = "数据id不能为空") long id, HttpServletRequest response) {
+        log.info("设备 detail param:{}", id);
+        return deviceService.detail(id, response);
+    }
 }
 }

+ 8 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/dao/mysql/KwsAlarmMapper.java

@@ -3,7 +3,13 @@ package com.sckw.slope.detection.dao.mysql;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.slope.detection.model.dos.mysql.KwsAlarm;
 import com.sckw.slope.detection.model.dos.mysql.KwsAlarm;
+import com.sckw.slope.detection.model.param.DeviceQuery;
+import com.sckw.slope.detection.model.vo.DeviceVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
 
 
 @Mapper
 @Mapper
 @DS("mysql")
 @DS("mysql")
@@ -19,4 +25,6 @@ public interface KwsAlarmMapper extends BaseMapper<KwsAlarm> {
     int updateByPrimaryKeySelective(KwsAlarm record);
     int updateByPrimaryKeySelective(KwsAlarm record);
 
 
     int updateByPrimaryKey(KwsAlarm record);
     int updateByPrimaryKey(KwsAlarm record);
+
+    List<Map<String,Long>> selectByDevicesId(@Param("devicesId") List<Long> devicesId);
 }
 }

+ 4 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/dao/mysql/KwsDeviceMapper.java

@@ -6,6 +6,8 @@ import com.sckw.slope.detection.model.dos.mysql.KwsDevice;
 import com.sckw.slope.detection.model.dto.DeviceDataDTO;
 import com.sckw.slope.detection.model.dto.DeviceDataDTO;
 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 com.sckw.slope.detection.model.vo.DeviceVo;
+import com.sckw.slope.detection.model.param.DeviceQuery;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -26,4 +28,6 @@ public interface KwsDeviceMapper extends BaseMapper<KwsDevice> {
 
 
     List<DeviceDataDTO> selectDeviceAllNotDeviceRelation(@Param("projectId") String projectId);
     List<DeviceDataDTO> selectDeviceAllNotDeviceRelation(@Param("projectId") String projectId);
 
 
+    List<DeviceVo> selectByDeviceParam(@Param("deviceQuery") DeviceQuery deviceQuery);
+
 }
 }

+ 12 - 6
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dos/mysql/KwsDevice.java

@@ -2,6 +2,7 @@ package com.sckw.slope.detection.model.dos.mysql;
 
 
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
+import jakarta.validation.constraints.NotNull;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
@@ -23,11 +24,6 @@ public class KwsDevice implements Serializable {
      */
      */
     private Integer attribute;
     private Integer attribute;
 
 
-    /**
-     * 企业id
-     */
-    private String companyId;
-
     /**
     /**
      * 设备名
      * 设备名
      */
      */
@@ -71,7 +67,7 @@ public class KwsDevice implements Serializable {
     /**
     /**
      * 状态
      * 状态
      */
      */
-    private Byte status;
+    private Integer status;
 
 
     /**
     /**
      * 创建人
      * 创建人
@@ -114,6 +110,16 @@ public class KwsDevice implements Serializable {
      */
      */
     private String logicAlt;
     private String logicAlt;
 
 
+    /**
+     * 矿山id
+     */
+    private String mountainId;
+
+    /**
+     * 是否关联设备
+     */
+    private Integer related;
+
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
 }
 }

+ 1 - 4
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dos/mysql/KwsDeviceModel.java

@@ -21,10 +21,7 @@ public class KwsDeviceModel implements Serializable {
      */
      */
     private String identifyCode;
     private String identifyCode;
 
 
-    /**
-     * 企业id
-     */
-    private String companyId;
+
 
 
     /**
     /**
      * 设备类型(字典表value)
      * 设备类型(字典表value)

+ 81 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/param/DeviceAdd.java

@@ -0,0 +1,81 @@
+package com.sckw.slope.detection.model.param;
+
+import cn.hutool.core.date.DateTime;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+/**
+ * @author sky
+ * @description 设备新增
+ * @date 2023-10-31 15:10:14
+ */
+@Data
+public class DeviceAdd {
+
+    /**
+     * 矿山id
+     */
+    private String mountainId;
+
+    /**
+     * 视频设备、监测设备等
+     */
+    @NotNull(message = "类型不能为空")
+    private Integer attribute;
+
+    /**
+     * 设备名称
+     */
+    @NotBlank(message = "设备名称不能为空")
+    private String name;
+
+    /**
+     * 设备名称(别名)
+     */
+    private String alias;
+
+    /**
+     * SN码
+     */
+    @NotBlank(message = "SN码不能为空")
+    private String snCode;
+
+    /**
+     * 产品类型
+     */
+    @NotNull(message = "产品类型不能为空")
+    private Long modelId;
+
+
+    /**
+     * 质保日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private DateTime validTime;
+
+    /**
+     * 秘钥
+     */
+    private String secretKey;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 是否关联设备
+     */
+    @NotNull(message = "是否关联设备不能为空")
+    private Integer related;
+
+    /**
+     * 接口
+     */
+    private String interFace;
+
+}

+ 4 - 4
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/param/DeviceQuery.java

@@ -11,11 +11,11 @@ import lombok.Data;
 @Data
 @Data
 public class DeviceQuery {
 public class DeviceQuery {
 
 
+
     /**
     /**
-     * 项目名称
+     * id
      */
      */
-    @NotBlank(message = "项目id不能为空")
-    private String projectId;
+    private Long id;
 
 
     /**
     /**
      * 项目名称
      * 项目名称
@@ -30,7 +30,7 @@ public class DeviceQuery {
     /**
     /**
      * 设备名称
      * 设备名称
      */
      */
-    private String name;
+    private String deviceName;
 
 
     /**
     /**
      * 设备类型
      * 设备类型

+ 151 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/DeviceVo.java

@@ -0,0 +1,151 @@
+package com.sckw.slope.detection.model.vo;
+
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+/**
+ * @author lfdc
+ * @description vo
+ * @date 2023-10-30 13:10:38
+ */
+@Data
+public class DeviceVo implements Serializable {
+    private Long id;
+
+    /**
+     * 视频设备、监测设备等
+     */
+    private Integer attribute;
+
+    /**
+     * 设备名
+     */
+    private String name;
+
+    /**
+     * 别名(单元名称)
+     */
+    private String alias;
+
+    /**
+     * sn码
+     */
+    private String snCode;
+
+    /**
+     * 设备型号id
+     */
+    private Long modelId;
+
+    /**
+     * 质保日期
+     */
+    private Date validTime;
+
+    /**
+     * 秘钥
+     */
+    private String secretKey;
+
+    /**
+     * 接口地址
+     */
+    private String interFace;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 状态
+     */
+    private Integer status;
+
+    /**
+     * 状态
+     */
+    private String statusText;
+
+    /**
+     * 创建人
+     */
+    private Long createBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 修改人
+     */
+    private Long updateBy;
+
+    /**
+     * 修改时间
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 删除标识
+     */
+    @TableLogic(value = "0")
+    private int delFlag;
+
+    /**
+     * 逻辑经度(测点布设的值)
+     */
+    private String logicLng;
+
+    /**
+     * 逻辑纬度(测点布设的值)
+     */
+    private String logicLat;
+
+    /**
+     * 逻辑海拔(测点布设的值)
+     */
+    private String logicAlt;
+
+    /**
+     * 厂商
+     */
+    private String manufacturer;
+
+    /**
+     * 厂商联系人
+     */
+    private String manufacturer_contacts;
+
+    /**
+     * 厂商联系人电话
+     */
+    private String manufacturer_phone;
+
+    /**
+     * 型号名称
+     */
+    private String m_name;
+
+    /**
+     * 数据告警次数
+     */
+    private Long dataErrorCount;
+
+    /**
+     * 设备告警次数
+     */
+    private Long deviceErrorCount;
+
+    /**
+     * 项目名称
+     */
+    private String projectName;
+
+    private static final long serialVersionUID = 1L;
+}

+ 5 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/ProjectVo.java

@@ -105,6 +105,11 @@ public class ProjectVo implements Serializable {
      */
      */
     private LocalDateTime updateTime;
     private LocalDateTime updateTime;
 
 
+    /**
+     * 项目名称
+     */
+    private String projectName;
+
     /**
     /**
      * 删除标识
      * 删除标识
      */
      */

+ 107 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/DeviceService.java

@@ -1,18 +1,43 @@
 package com.sckw.slope.detection.service;
 package com.sckw.slope.detection.service;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.sckw.core.common.enums.NumberConstant;
 import com.sckw.core.exception.BusinessException;
 import com.sckw.core.exception.BusinessException;
+import com.sckw.core.model.page.PageRes;
+import com.sckw.core.utils.IdWorker;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.core.utils.StringUtils;
+import com.sckw.core.model.enums.AlarmTypeEnum;
+import com.sckw.core.model.enums.DeviceEnum;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.slope.detection.dao.mysql.KwsDeviceMapper;
 import com.sckw.slope.detection.dao.mysql.KwsDeviceMapper;
+import com.sckw.slope.detection.dao.mysql.KwsAlarmMapper;
+import com.sckw.slope.detection.dao.mysql.KwsDeviceModelMapper;
+import com.sckw.slope.detection.model.dos.mysql.KwsAlarm;
 import com.sckw.slope.detection.model.dos.mysql.KwsDevice;
 import com.sckw.slope.detection.model.dos.mysql.KwsDevice;
+import com.sckw.slope.detection.model.dos.mysql.KwsDeviceModel;
+import com.sckw.slope.detection.model.dos.mysql.KwsProject;
 import com.sckw.slope.detection.model.dto.DeviceDataDTO;
 import com.sckw.slope.detection.model.dto.DeviceDataDTO;
+import com.sckw.slope.detection.model.dto.HeaderData;
+import com.sckw.slope.detection.model.dto.ProjectAddDTO;
+import com.sckw.slope.detection.model.param.DeviceAdd;
+import com.sckw.slope.detection.model.param.DeviceQuery;
+import com.sckw.slope.detection.model.vo.ProjectVo;
+import jakarta.servlet.http.HttpServletRequest;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
 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 org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
+import org.apache.http.HttpResponse;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.sckw.slope.detection.model.vo.DeviceVo;
+import org.springframework.util.CollectionUtils;
 
 
+import java.time.LocalDateTime;
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * @author lfdc
  * @author lfdc
@@ -26,6 +51,15 @@ public class DeviceService {
     @Autowired
     @Autowired
     KwsDeviceMapper deviceMapper;
     KwsDeviceMapper deviceMapper;
 
 
+    @Autowired
+    KwsAlarmMapper alarmMapper;
+
+    @Autowired
+    KwsDeviceModelMapper deviceModelMapper;
+
+    @Autowired
+    CommonService commonService;
+
     @Transactional
     @Transactional
     public HttpResult dels(String ids) {
     public HttpResult dels(String ids) {
         List<Long> list = StringUtils.splitStrToList(ids, Long.class);
         List<Long> list = StringUtils.splitStrToList(ids, Long.class);
@@ -43,4 +77,77 @@ public class DeviceService {
         List<DeviceDataDTO> list = deviceMapper.selectDeviceAllNotDeviceRelation(projectId);
         List<DeviceDataDTO> list = deviceMapper.selectDeviceAllNotDeviceRelation(projectId);
         return HttpResult.ok(list);
         return HttpResult.ok(list);
     }
     }
+
+    /**
+     * 项目管理分页查询
+     *
+     * @param deviceQuery 请求分页
+     * @param response        http流
+     * @return 返回值
+     */
+    public PageRes select(DeviceQuery deviceQuery, HttpResponse response) {
+        PageHelper.startPage(deviceQuery.getPage(), deviceQuery.getPageSize());
+        List<DeviceVo> list = deviceMapper.selectByDeviceParam(deviceQuery);
+        PageInfo<DeviceVo> pageInfo = new PageInfo<>(list);
+        if (CollectionUtils.isEmpty(list)) {
+            return PageRes.build(pageInfo, list);
+        }
+        List<Long> devicesId = list.stream().map(DeviceVo::getId).toList();
+        List<Map<String,Long>> alarmData = alarmMapper.selectByDevicesId(devicesId);
+        for (DeviceVo vo : list) {
+            vo.setStatusText(DeviceEnum.getName(vo.getStatus()));
+            if(!CollectionUtils.isEmpty(alarmData)){
+                for(int i=0;i<alarmData.size();i++){
+                    Map<String,Long> map = alarmData.get(i);
+                    if(map.get("pid").toString().equals(vo.getId().toString())){
+                        vo.setDataErrorCount(map.get("count"));
+                        vo.setDeviceErrorCount(map.get("count"));
+                    }
+                    /*if(map.get("pid").toString().equals(vo.getId().toString()) && map.get("type").toString().equals(AlarmTypeEnum.ALARM_TWO.getCode())){
+                        vo.setDeviceErrorCount(map.get("count"));
+                    }*/
+                }
+            }
+        }
+        return PageRes.build(pageInfo, list);
+    }
+
+    /**
+     * 新增设备
+     *
+     * @param deviceAdd 请求参数
+     * @param request       http流
+     * @return 返回值
+     */
+    @Transactional
+    public HttpResult add(DeviceAdd deviceAdd, HttpServletRequest request) {
+        HeaderData headerData = commonService.getHeaderData(request);
+        KwsDevice device = new KwsDevice();
+        BeanUtils.copyProperties(deviceAdd, device);
+        LocalDateTime now = LocalDateTime.now();
+        device.setCreateBy(Long.parseLong(headerData.getCreateBy()));
+        device.setCreateTime(now);
+        device.setStatus(DeviceEnum.IDENTIFYING.getCode());
+        device.setUpdateBy(Long.parseLong(headerData.getUpdateBy()));
+        device.setUpdateTime(now);
+        device.setMountainId(headerData.getCompanyId());
+        deviceMapper.insert(device);
+        return HttpResult.ok();
+    }
+
+    public HttpResult detail(Long id, HttpServletRequest response) {
+        KwsDevice device = deviceMapper.selectOne(new LambdaQueryWrapper<KwsDevice>()
+                .eq(KwsDevice::getId, id));
+        DeviceVo vo = new DeviceVo();
+        BeanUtils.copyProperties(device, vo);
+
+        KwsDeviceModel deviceModel = deviceModelMapper.selectOne(new LambdaQueryWrapper<KwsDeviceModel>()
+                .eq(KwsDeviceModel::getId, vo.getModelId()));
+        vo.setManufacturer(deviceModel.getManufacturer());
+        vo.setManufacturer_contacts(deviceModel.getManufacturerContacts());
+        vo.setManufacturer_phone(deviceModel.getManufacturerPhone());
+        return HttpResult.ok(vo);
+    }
+
+
 }
 }

+ 51 - 0
slope-modules/slope-detection/src/main/resources/bootstrap-sky.yml

@@ -0,0 +1,51 @@
+spring:
+  application:
+    name: slope-detection
+  cloud:
+    nacos:
+      discovery:
+        # 服务注册地址
+        server-addr: 10.10.10.230:8848
+        # 命名空间
+        namespace: slope-manage-service-sky
+        # 共享配置
+        group: slope-manage-service
+      config:
+        # 配置中心地址
+        server-addr: 10.10.10.230:8848
+        # 配置文件格式
+        file-extension: yaml
+        # 命名空间
+        namespace: slope-manage-service-sky
+        # 共享配置
+        group: slope-manage-service
+        #可以读多个配置文件  需要在同一个命名空间下面可以是不同的组
+        extension-configs:
+          - dataId: slope-common.yml
+            group: slope-manage-service
+            refresh: true
+## MQTT##
+mqtt:
+  send:
+    #完成超时时间
+    completionTimeout: 3000
+    #通过mqtt发送消息验证所需用户名
+    username: test
+    #通过mqtt发送消息验证所需密码
+    password: test
+    #连接的mqtt地址
+    url: tcp://10.10.10.225:1883
+    #客户端id
+    clientId: mqttx_12411c5cec
+    #推送主题  后面跟着#是监控下面所有的话题
+    topic: slope
+    #topic: my-test
+    # 会话心跳时间
+    keepAliveInterval: 20
+    # 设置连接超时时间
+    connectionTimeout: 3000
+    timeout: 10
+    keepalive: 20
+  # 要消费的topic配置
+  receive:
+    topic: slopePush/slopePull/test/out,test,slope,sharjeck/ai/test/out

+ 1 - 1
slope-modules/slope-detection/src/main/resources/bootstrap.yml

@@ -6,7 +6,7 @@ spring:
     name: slope-detection
     name: slope-detection
 #    name: slope-detection
 #    name: slope-detection
   profiles:
   profiles:
-    active: lfdc
+    active: sky
   main:
   main:
     allow-bean-definition-overriding: true
     allow-bean-definition-overriding: true
     allow-circular-references: true
     allow-circular-references: true

+ 15 - 0
slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsAlarmMapper.xml

@@ -31,6 +31,21 @@
     from kws_alarm
     from kws_alarm
     where id = #{id,jdbcType=BIGINT}
     where id = #{id,jdbcType=BIGINT}
   </select>
   </select>
+
+  <select id="selectByDevicesId" parameterType="java.lang.String" resultType="java.util.Map">
+    <!--@mbg.generated-->
+    select count(id) as count,pid,type
+    from kws_alarm
+    where 1 = 1
+    <if test="devicesId != null and devicesId.size()>0">
+      AND pid IN
+      <foreach collection="devicesId" open="(" close=")" item="item" separator=",">
+        #{item}
+      </foreach>
+    </if>
+ group by pid,type
+  </select>
+
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     <!--@mbg.generated-->
     <!--@mbg.generated-->
     delete from kws_alarm
     delete from kws_alarm

+ 20 - 3
slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsDeviceMapper.xml

@@ -34,6 +34,23 @@
     from kws_device
     from kws_device
     where id = #{id,jdbcType=BIGINT}
     where id = #{id,jdbcType=BIGINT}
   </select>
   </select>
+  <select id="selectByDeviceParam" resultType="com.sckw.slope.detection.model.vo.DeviceVo">
+    select
+    d.id, d.name,manufacturer,device_type,m.name as m_name,d.remark,d.update_by,d.update_time,p.`name` as project_name,d.status
+    from kws_device as d
+        inner join kws_device_model as m on d.model_id=m.id
+        left join kws_project_device as pd on d.id=pd.device_id
+        left join kws_project as p on pd.project_id=p.id
+    WHERE d.del_flag = 0 and m.del_flag = 0
+    <where>
+      <if test="deviceQuery.deviceName != null and deviceQuery.deviceName != ''">
+        and name like concat('%', #{deviceQuery.deviceName}, '%')
+      </if>
+      <if test="deviceQuery.id != null and deviceQuery.id != ''">
+        and id = #{id,jdbcType=BIGINT}
+      </if>
+    </where>
+  </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     <!--@mbg.generated-->
     <!--@mbg.generated-->
     delete from kws_device
     delete from kws_device
@@ -43,16 +60,16 @@
     <!--@mbg.generated-->
     <!--@mbg.generated-->
     insert into kws_device (id, `attribute`, `name`, 
     insert into kws_device (id, `attribute`, `name`, 
       `alias`, sn_code, model_id, 
       `alias`, sn_code, model_id, 
-      valid_time, secret_key, interface, 
+      valid_time, secret_key, inter_face,
       remark, `status`, create_by, 
       remark, `status`, create_by, 
       create_time, update_by, update_time, 
       create_time, update_by, update_time, 
-      del_flag)
+      del_flag,related)
     values (#{id,jdbcType=BIGINT}, #{attribute,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, 
     values (#{id,jdbcType=BIGINT}, #{attribute,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, 
       #{alias,jdbcType=VARCHAR}, #{snCode,jdbcType=VARCHAR}, #{modelId,jdbcType=BIGINT}, 
       #{alias,jdbcType=VARCHAR}, #{snCode,jdbcType=VARCHAR}, #{modelId,jdbcType=BIGINT}, 
       #{validTime,jdbcType=TIMESTAMP}, #{secretKey,jdbcType=VARCHAR}, #{interFace,jdbcType=VARCHAR},
       #{validTime,jdbcType=TIMESTAMP}, #{secretKey,jdbcType=VARCHAR}, #{interFace,jdbcType=VARCHAR},
       #{remark,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}, #{createBy,jdbcType=BIGINT}, 
       #{remark,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}, #{createBy,jdbcType=BIGINT}, 
       #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, 
       #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, 
-      #{delFlag,jdbcType=TINYINT})
+      #{delFlag,jdbcType=TINYINT},#{related,jdbcType=BIGINT})
   </insert>
   </insert>
   <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsDevice">
   <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsDevice">
     <!--@mbg.generated-->
     <!--@mbg.generated-->