Browse Source

设备模板

lin 3 years ago
parent
commit
babfa76c65

+ 17 - 0
zoniot-common/zoniot-core-utils/src/main/java/com/zcxk/core/utils/NumberDistri.java

@@ -1,5 +1,7 @@
 package com.zcxk.core.utils;
 
+import cn.hutool.core.util.NumberUtil;
+
 import java.math.BigDecimal;
 
 /**
@@ -237,4 +239,19 @@ public class NumberDistri {
         return b.setScale(places, BigDecimal.ROUND_HALF_UP).doubleValue();
     }
 
+    /*
+     * @description 比较Integer是否相等
+     * @param num1
+     * @param num2
+     * @return
+     **/
+    public static boolean integerEquals(Integer num1, Integer num2){
+        if(num1 == null && num2 == null)return true;
+        if(num1 != null  && num2 != null){
+            return NumberUtil.equals(num1,num2);
+        }else {
+            return false;
+        }
+    }
+
 }

+ 0 - 3
zoniot-common/zoniot-core-utils/src/main/java/com/zcxk/core/utils/export/EasyExcelUtil.java

@@ -89,9 +89,6 @@ public  class EasyExcelUtil {
         response.addHeader("Cache-Control", "max-age=0");
 
 
-
-
-
         List<List<String>> headList = new ArrayList<>();
         head.forEach(h -> headList.add(Collections.singletonList(h)));
 

+ 18 - 6
zoniot-rmcp/zoniot-rmcp-api/src/main/java/com/zcxk/rmcp/api/dto/readmeter/WaterMeterDto.java

@@ -3,6 +3,7 @@ package com.zcxk.rmcp.api.dto.readmeter;
 import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.StrUtil;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.zcxk.core.utils.NumberDistri;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.apache.commons.lang3.StringUtils;
@@ -106,11 +107,22 @@ public class WaterMeterDto implements Comparable<WaterMeterDto> {
 
     @Override
     public int compareTo(WaterMeterDto dto) {
-        if(!StrUtil.equals(tenantId,dto.tenantId))return 0;
-        if(!NumberUtil.equals(categoryId,dto.categoryId))return 0;
-        if(!NumberUtil.equals(companyOrgId,dto.companyOrgId))return 0;
-        if(!NumberUtil.equals(deptOrgId,dto.deptOrgId))return 0;
-
-        return 1;
+        if(!StrUtil.equals(tenantId,dto.tenantId))return -1;
+        if(!NumberDistri.integerEquals(categoryId,dto.categoryId))return -1;
+        if(!NumberDistri.integerEquals(companyOrgId,dto.companyOrgId))return -1;
+        if(!StrUtil.equals(companyName,dto.companyName))return -1;
+        if(!NumberDistri.integerEquals(deptOrgId,dto.deptOrgId))return -1;
+        if(!StrUtil.equals(deptName,dto.deptName))return -1;
+        if(!NumberDistri.integerEquals(communityId,dto.communityId))return -1;
+        if(!StrUtil.equals(communityName,dto.communityName))return -1;
+        if(!StrUtil.equals(deviceNo,dto.deviceNo))return -1;
+        if(!StrUtil.equals(meterNo,dto.meterNo))return -1;
+        if(!StrUtil.equals(fileNo,dto.fileNo))return -1;
+        if(!StrUtil.equals(address,dto.address))return -1;
+        if(!NumberDistri.integerEquals(productId,dto.productId))return -1;
+        if(!StrUtil.equals(productName,dto.productName))return -1;
+        if(!StrUtil.equals(productModel,dto.productModel))return -1;
+        if(!StrUtil.equals(manufacturerName,dto.manufacturerName))return -1;
+        return 0;
     }
 }

+ 1 - 0
zoniot-rmcp/zoniot-rmcp-web/pom.xml

@@ -89,6 +89,7 @@
                     <include>**/*.yml</include>
                     <include>**/*.xml</include>
                     <include>**/*.tld</include>
+                    <include>**/*.xlsx</include>
                 </includes>
                 <filtering>false</filtering>
             </resource>

BIN
zoniot-rmcp/zoniot-rmcp-web/src/main/resources/excel/deviceTemplate_V2.1.xlsx