15928045575 2 年之前
父節點
當前提交
0ef8ac392f

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

@@ -35,6 +35,11 @@ public class DeviceModelVo implements Serializable {
      */
     private String deviceType;
 
+    /**
+     * 设备类型名称
+     */
+    private String deviceTypeName;
+
     /**
      * 型号名称
      */

+ 8 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/BackTrackService.java

@@ -103,6 +103,14 @@ public class BackTrackService {
     }
 
     public HttpResult getDeviceChart(String devicesId,String snCode, String parts, String dateStart,String dateEnd,Integer original) {
+        //先查询设备
+        KwsDevice deviceHas = deviceMapper.selectOne(new LambdaQueryWrapper<KwsDevice>()
+                .eq(KwsDevice::getSnCode, snCode));
+        if(!DeviceEnum.ALREADY_REFERRED_TO.getStatus().equals(deviceHas.getStatus())){//已基准
+            List<SlopeData> selectedData = slopeDataMapper.selectLineList(snCode, parts, dateStart, dateEnd);
+            return HttpResult.ok(selectedData);
+        }
+
         Map<String, Object> returnData = new HashMap<>();
         //在获取设备的要素
         List<KwsDeviceReference> references = deviceReferenceMapper.selectList(new LambdaQueryWrapper<KwsDeviceReference>()

+ 12 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/DeviceModelService.java

@@ -158,6 +158,18 @@ public class DeviceModelService {
         for(SystemDict value : dictList.values()){
             systemDict.add((value));
         }
+        //获取设备型号名称
+        Map<String, SystemDict> deviceTypeList = commonService.getDictList(null, new HashMap<String, String>() {{
+            put("code", DictEnum.DEVICE_TYPE.getCodeType());
+            put("type", "1");
+        }});
+
+
+        for(SystemDict value : deviceTypeList.values()) {
+            if (vo.getDeviceType().equals(value.getValue())) {
+                vo.setDeviceTypeName(value.getLabel());
+            }
+        }
         vo.setPart(partData);
         vo.setIntegration(dataList);
         vo.setSystemDict(systemDict);

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

@@ -624,7 +624,8 @@ public class DeviceService {
                 kwsDeviceReference.setOriginalValue(reference.getOriginalValue());//原始基准不变
                 //调整经纬度
                 if(type.equals(NumberConstant.ONE)){
-                    kwsDeviceReference.setOffset(zero);//当前位置-上一次的位置的距离的距离
+                    BigDecimal offset = commonService.computeOffset(value.toString(), obj.get("item").toString(), reference);
+                    kwsDeviceReference.setOffset(offset);//当前位置-上一次的位置的距离的距离
                     kwsDeviceReference.setCurrentValue(value);
                     kwsDeviceReference.setValue(reference.getCurrentValue());
 

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

@@ -57,7 +57,7 @@
       WHERE d.del_flag = 0
         and m.del_flag = 0
           <if test="deviceQuery.deviceName != null and deviceQuery.deviceName != ''">
-              and deviceName like concat('%', #{deviceQuery.deviceName}
+              and d.name like concat('%', #{deviceQuery.deviceName}
                    , '%')
           </if>
           <if test="deviceQuery.id != null and deviceQuery.id != ''">

+ 1 - 1
slope-modules/slope-detection/src/main/resources/mapper/tdengine/SlopeDataMapper.xml

@@ -42,7 +42,7 @@
         SELECT
         <include refid="Base_List">
         </include>
-        FROM devicev2.device_#{snCode}
+        FROM devicesv2.device_#{snCode}
         where line = #{item}
         order by ts desc limit 1
     </select>