Browse Source

fix:添加批量升级创建时间

荭琪枫 2 years ago
parent
commit
991319f4ce

+ 5 - 1
iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/ota/DeviceOtaInfo.java

@@ -23,7 +23,11 @@ public class DeviceOtaInfo implements Id<Long> {
 
     private String module;
 
-    private Integer counts;
+    private Integer total;
+
+    private Integer success;
+
+    private Integer fail;
 
     private String productKey;
 

+ 5 - 1
iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbDeviceOtaInfo.java

@@ -32,7 +32,11 @@ public class TbDeviceOtaInfo {
 
     private String module;
 
-    private Integer counts;
+    private Integer total;
+
+    private Integer success;
+
+    private Integer fail;
 
     private String productKey;
 

+ 5 - 1
iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/vo/ota/DeviceOtaInfoVo.java

@@ -27,7 +27,11 @@ public class DeviceOtaInfoVo implements Serializable {
 
     private String module;
 
-    private Integer counts;
+    private Integer total;
+
+    private Integer success;
+
+    private Integer fail;
 
     private String productKey;
 

+ 6 - 3
iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/OtaService.java

@@ -147,7 +147,7 @@ public class OtaService {
             throw new BizException(ErrCode.DATA_NOT_EXIST);
         }
         DeviceOtaInfo deviceOtaInfo = deviceOtaInfoData.save(DeviceOtaInfo.builder()
-                .counts(deviceIds.size())
+                .total(deviceIds.size())
                 .productKey(otaPackage.getProductKey())
                 .module(otaPackage.getModule())
                 .desc(otaPackage.getDesc())
@@ -173,12 +173,15 @@ public class OtaService {
                         .build());
                 success.getAndSet(success.get() + 1);
             } catch (Exception ex) {
-                log.error("add device upgrade error: ",ex);
+                log.error("add device upgrade error: ", ex);
                 fail.getAndSet(success.get() + 1);
             }
         });
         deviceOtaDetailData.batchSave(deviceOtaDetails);
-        return "发起升级【" + success + "】条,失败【" + fail + "】条";
+        deviceOtaInfo.setSuccess(success.get());
+        deviceOtaInfo.setFail(fail.get());
+        deviceOtaInfoData.save(deviceOtaInfo);
+        return "发起升级【" + success.get() + "】条,失败【" + fail.get() + "】条";
     }
 
     public Paging<DeviceOtaDetailVo> otaDeviceDetail(PageRequest<DeviceOtaDetailBo> request) {