浏览代码

设备统计状态数量

李进 2 年之前
父节点
当前提交
2af8d54293

+ 1 - 1
device-api-service/src/main/java/com/xy/entity/DeviceNetRecord.java

@@ -53,7 +53,7 @@ public class DeviceNetRecord implements Serializable {
     private String simSignalType;
 
     @ApiModelProperty(value = "上位版本号")
-    private String appUpmVerion;
+    private String appUpmVersion;
 
     @ApiModelProperty(value = "创建时间")
     private LocalDateTime createTime;

+ 3 - 1
device-api-service/src/main/java/com/xy/service/DeviceNetRecordServiceImpl.java

@@ -18,6 +18,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 
+import java.time.LocalDateTime;
 import java.util.List;
 
 import static com.xy.utils.Beans.copy;
@@ -40,7 +41,8 @@ public class DeviceNetRecordServiceImpl extends ServiceImpl<DeviceNetRecordMappe
     @PostMapping("save")
     @ApiOperation("添加")
     public R save(@RequestBody @Validated DeviceNetRecordDto.Save save) {
-        DeviceNetRecord deviceNetRecord = copy(DeviceNetRecord.class, save);
+        DeviceNetRecord deviceNetRecord = copy(DeviceNetRecord.class, save)
+                .setCreateTime(LocalDateTime.now());
         save(deviceNetRecord);
         return R.ok();
     }

+ 1 - 0
device-api-service/src/main/resources/mapper/DeviceStatusMapper.xml

@@ -14,4 +14,5 @@
         (select count(*) temp_state from device_status where temp_state = 1) tempState
         from dual
     </select>
+
 </mapper>

+ 45 - 0
device-api/src/main/java/com/xy/dto/DeviceInfoDto.java

@@ -1,11 +1,13 @@
 package com.xy.dto;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.xy.utils.PageBean;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.experimental.Accessors;
 
 import javax.validation.constraints.NotNull;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 
 @Data
@@ -29,6 +31,49 @@ public class DeviceInfoDto {
         private Long deviceId;
     }
 
+    @Data
+    @Accessors(chain = true)
+    public static class Page extends Vo {
+
+        @ApiModelProperty(value = "分页对象", required = true)
+        private PageBean page;
+
+        @ApiModelProperty("机器/资产/sn/sim号")
+        private String no;
+
+        @ApiModelProperty("联网状态")
+        private Integer netState;
+
+        @ApiModelProperty("商户号或名称")
+        private String merc;
+
+        @ApiModelProperty("上位机版本号")
+        private String appUpmVersion;
+
+        @ApiModelProperty("下位机版本号")
+        private String appDownmVersion;
+
+        @ApiModelProperty("质量状态")
+        private Integer qualityState;
+
+        @JsonFormat(pattern = "yyyy-MM-dd")
+        @ApiModelProperty(value = "激活时间-起")
+        private LocalDate beginActiveTime;
+
+        @JsonFormat(pattern = "yyyy-MM-dd")
+        @ApiModelProperty(value = "激活时间-始")
+        private LocalDate endActiveTime;
+
+        public LocalDateTime getBeginActiveTime() {
+            return beginActiveTime == null ? null : beginActiveTime.atTime(0, 0, 0);
+        }
+
+        public LocalDateTime getEndActiveTime() {
+            return endActiveTime == null ? null : endActiveTime.atTime(23, 59, 59);
+        }
+
+    }
+
     @Data
     @Accessors(chain = true)
     public static class Vo {

+ 1 - 1
device-api/src/main/java/com/xy/dto/DeviceNetRecordDto.java

@@ -101,7 +101,7 @@ public class DeviceNetRecordDto {
         private String simSignalType;
 
         @ApiModelProperty(value = "上位版本号")
-        private String appUpmVerion;
+        private String appUpmVersion;
 
         @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
         @ApiModelProperty(value = "创建时间")