15928045575 2 anni fa
parent
commit
944a325d90

+ 1 - 0
slope-common/slope-common-core/src/main/java/com/sckw/core/model/enums/DictEnum.java

@@ -15,6 +15,7 @@ public enum DictEnum {
     ALARM_TYPE("alarm_type", "告警类型"),
     ALARM_DETAIL_TYPE("alarm_detail_type", "告警明细类型"),
     REPORT_TEMPLATE_TYPE("report_template_type", "报表模板"),
+    INTEGRATION_UNIT("integration_unit", "集成要素单位"),
     COMPANY("company", "厂商"),
     ;
     private final String codeType;

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

@@ -198,7 +198,7 @@ public class BackTrackService {
         double angleInRadians = 0;
         for (KwsDeviceReference element : references) {
             if (DictItemEnum.LATITUDE_Y.getValue().equals(element.getItem())) {
-                if (!Objects.isNull(element.getValue())) {
+                if (!Objects.isNull(element.getCurrentValue())) {
                     angleInRadians = element.getCurrentValue().doubleValue();
                 }
 
@@ -241,8 +241,8 @@ public class BackTrackService {
                     String key = format.format(message.getRawId());
                     BigDecimal subtract = new BigDecimal(val1).subtract(currentValue);
                     if (DictItemEnum.LONGITUDE_X.getValue().equals(element.getItem())) {//如果是X轴
-                        double cosValue = Math.cos(angleInRadians);
-                        double doubleValue = subtract.divide(new BigDecimal("360"), 9, BigDecimal.ROUND_HALF_UP).doubleValue();
+                        double cosValue = Math.cos(Math.toRadians(angleInRadians));
+                        double doubleValue = subtract.divide(new BigDecimal("360"), 11, BigDecimal.ROUND_HALF_UP).doubleValue();
                         offsetValue = new BigDecimal(equatorial_circumference).multiply(new BigDecimal(cosValue)).multiply(new BigDecimal(doubleValue));
                     } else if (DictItemEnum.LATITUDE_Y.getValue().equals(element.getItem())) {//如果是Y轴
                         offsetValue = new BigDecimal(LATITUDE_REFERENCE).multiply(subtract);

+ 5 - 5
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/CommonService.java

@@ -180,7 +180,7 @@ public class CommonService {
             if (deviceReference != null) {
                 angleInRadians = deviceReference.getCurrentValue().doubleValue();
             }
-            double cosValue = Math.cos(angleInRadians);
+            double cosValue = Math.cos(Math.toRadians(angleInRadians));;
             double doubleValue = subtract.divide(new BigDecimal("360"), 9, BigDecimal.ROUND_HALF_UP).doubleValue();
             offsetValue = new BigDecimal(equatorial_circumference).multiply(new BigDecimal(cosValue)).multiply(new BigDecimal(doubleValue));
         }
@@ -215,7 +215,7 @@ public class CommonService {
             if (deviceReference != null) {
                 angleInRadians = deviceReference.getOriginalValue().doubleValue();
             }
-            double cosValue = Math.cos(angleInRadians);
+            double cosValue = Math.cos(Math.toRadians(angleInRadians));
             double doubleValue = subtract.divide(new BigDecimal("360"), 9, BigDecimal.ROUND_HALF_UP).doubleValue();
             offsetValue = new BigDecimal(equatorial_circumference).multiply(new BigDecimal(cosValue)).multiply(new BigDecimal(doubleValue));
         }
@@ -251,7 +251,7 @@ public class CommonService {
             if (deviceReference != null) {
                 angleInRadians = deviceReference.getCurrentValue().doubleValue();
             }
-            double cosValue = Math.cos(angleInRadians);
+            double cosValue = Math.cos(Math.toRadians(angleInRadians));
             BigDecimal doubleValue = new BigDecimal(value).multiply(new BigDecimal(360));//offset*360
             BigDecimal offsetValue1 = new BigDecimal(equatorial_circumference).multiply(new BigDecimal(cosValue));// L*cos(A)
             BigDecimal xTmp = doubleValue.divide(offsetValue1, 9, BigDecimal.ROUND_HALF_UP);//除法
@@ -285,7 +285,7 @@ public class CommonService {
         if (DictItemEnum.LONGITUDE_X.getValue().equals(inter.getPartNames())) {
             List<SlopeData> y = slopeDataMapper.selectListByTwoLine(snCode, DictItemEnum.LATITUDE_Y.getValue());
             double angleInRadians = Double.parseDouble(y.get(1).getVal());
-            double cosValue = Math.cos(angleInRadians);
+            double cosValue =Math.cos(Math.toRadians(angleInRadians));
 
             double doubleValue = subtract.divide(new BigDecimal("360"), 9, BigDecimal.ROUND_HALF_UP).doubleValue();
             offsetValue = new BigDecimal(equatorial_circumference).multiply(new BigDecimal(cosValue)).multiply(new BigDecimal(doubleValue));
@@ -352,7 +352,7 @@ public class CommonService {
                 List<SlopeData> y = slopeDataMapper.selectListLineByMsgId(snCode, DictItemEnum.LATITUDE_Y.getValue(), selectedData.get(i).getMsgId());
                 if (y.size() > 0) {
                     double angleInRadians = Double.parseDouble(y.get(0).getVal());
-                    double cosValue = Math.cos(angleInRadians);
+                    double cosValue = Math.cos(Math.toRadians(angleInRadians));
                     double doubleValue = subtract.divide(new BigDecimal("360"), 9, BigDecimal.ROUND_HALF_UP).doubleValue();
                     offsetValue = new BigDecimal(equatorial_circumference).multiply(new BigDecimal(cosValue)).multiply(new BigDecimal(doubleValue));
                 }

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

@@ -359,6 +359,11 @@ public class DeviceService {
             }
             vo.setPart(partData);
         }
+        //获取集成要素单位
+        Map<String, SystemDict> deviceType = commonService.getDictList(null, new HashMap<>() {{
+            put("code", DictEnum.INTEGRATION_UNIT.getCodeType());
+            put("type", "1");
+        }});
 
         //获取集成要素
         List<DeviceIntegrationVo> intergData = new ArrayList<>();
@@ -371,6 +376,11 @@ public class DeviceService {
                     double data = commonService.returnIntegrationData(snCode,slopeData,inter);
                     inter.setCurrentData(String.valueOf(data));
                 }
+                for (SystemDict value : deviceType.values()) {
+                    if (inter.getUnit().toString().equals(value.getValue())) {
+                        inter.setUnit(value.getDescription());
+                    }
+                }
                 references.forEach(re -> {
                     if (inter.getIntegrationName().equals(re.getItem())) {