15928045575 před 2 roky
rodič
revize
562879f375

+ 8 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dos/mysql/KwsDeviceReference.java

@@ -1,5 +1,7 @@
 package com.sckw.slope.detection.model.dos.mysql;
 
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
@@ -88,6 +90,12 @@ public class KwsDeviceReference implements Serializable {
 //    @TableLogic(value = "0")
     private int delFlag;
 
+    /**
+     * 单位
+     */
+    @TableField(exist = false)
+    private String  unit;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 0 - 2
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dto/ProjectAddDTO.java

@@ -48,13 +48,11 @@ public class ProjectAddDTO implements Serializable {
     /**
      * 省级平台名
      */
-    @NotBlank(message = "省级平台名不能为空")
     private String platformName;
 
     /**
      * 省级平台地址(url)
      */
-    @NotBlank(message = "省级平台地址不能为空")
     private String platformAddress;
 
     /**

+ 9 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/DeviceReferenceVo.java

@@ -89,6 +89,15 @@ public class DeviceReferenceVo implements Serializable {
      */
     private String referceData;
 
+    /**
+     * 基准值
+     */
+    private BigDecimal value;
+
+    /**
+     * 单位
+     */
+    private String  unit;
 
 
     private static final long serialVersionUID = 1L;

+ 23 - 1
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/BackTrackService.java

@@ -24,6 +24,7 @@ import com.sckw.slope.detection.model.dto.HeaderData;
 import com.sckw.slope.detection.model.dto.SystemDict;
 import com.sckw.slope.detection.model.param.IntegrationQuery;
 import com.sckw.slope.detection.model.vo.DeviceIntegrationVo;
+import com.sckw.slope.detection.model.vo.DeviceReferenceVo;
 import com.sckw.slope.detection.model.vo.IntegrationVo;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.extern.slf4j.Slf4j;
@@ -97,8 +98,14 @@ public class BackTrackService {
             put("code", DictEnum.MODEL_PART.getCodeType());
             put("type", "1");
         }});
+        List<DeviceReferenceVo> vo = new ArrayList<>();
+        //BeanUtils.copyProperties(references, vo);
         for (KwsDeviceReference re : references) {
-
+            for (SystemDict value : dictList.values()) {
+                if (re.getItem().equals(value.getValue())) {
+                    re.setUnit(value.getUrl());
+                }
+            }
         }
         return HttpResult.ok(references);
     }
@@ -394,8 +401,23 @@ public class BackTrackService {
         List<KwsDeviceReference> references = deviceReferenceMapper.selectList(new LambdaQueryWrapper<KwsDeviceReference>()
                 .in(KwsDeviceReference::getDeviceId, list)
                 .eq(KwsDeviceReference::getDelFlag, NumberConstant.ZERO)
+                .groupBy(KwsDeviceReference::getItem)
         );
 
+        Map<String, SystemDict> dictList = commonService.getDictList(null, new HashMap<>() {{
+            put("code", DictEnum.MODEL_PART.getCodeType());
+            put("type", "1");
+        }});
+        List<DeviceReferenceVo> vo = new ArrayList<>();
+        //BeanUtils.copyProperties(references, vo);
+        for (KwsDeviceReference re : references) {
+            for (SystemDict value : dictList.values()) {
+                if (re.getItem().equals(value.getValue())) {
+                    re.setUnit(value.getUrl());
+                }
+            }
+        }
+
         return HttpResult.ok(references);
     }
 }

+ 3 - 1
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/DeviceService.java

@@ -330,6 +330,8 @@ public class DeviceService {
             KwsProjectDevice projectDevice = projectDeviceMapper.selectOne(new LambdaQueryWrapper<KwsProjectDevice>()
                     .eq(KwsProjectDevice::getDeviceId, vo.getId())
                     .eq(KwsProjectDevice::getDelFlag, NumberConstant.ZERO)
+                    .orderByDesc(KwsProjectDevice::getCreateTime)
+                    .last("LIMIT 1")
             );
             if (!Objects.isNull(projectDevice)) {
                 vo.setProjectId(projectDevice.getProjectId().toString());
@@ -448,7 +450,7 @@ public class DeviceService {
             //新增到数据表kws_device_Integration
             KwsDeviceIntegration deIntergration = new KwsDeviceIntegration();
             String[] temp;//接收分割后的数组
-            if (!deviceAdd.getIntegrationId().isEmpty()) {
+            if (Objects.nonNull(deviceAdd.getIntegrationId())) {
                 temp = deviceAdd.getIntegrationId().split(Global.COMMA);
 
                 for (int i = 0; i < temp.length; i++) {