Browse Source

bug修复

lmstack 3 years ago
parent
commit
f4f1f31c61

+ 1 - 1
src/main/java/cn/fastfun/controller/api/ApiAppDeviceController.java

@@ -169,7 +169,7 @@ public class ApiAppDeviceController {
         Page<AppDeviceLog> deviceLogPage = appDeviceLogService.findByParam(query);
         AppDeviceLog lastDeviceLogPage = new AppDeviceLog();
         if (!deviceLogPage.isEmpty()) {
-            deviceLogPage.getContent().get(0);
+            lastDeviceLogPage = deviceLogPage.getContent().get(0);
         }
 
 

+ 11 - 0
src/main/java/cn/fastfun/controller/api/ApiAppDeviceLogController.java

@@ -225,10 +225,21 @@ public class ApiAppDeviceLogController {
         if (!StringUtils.isEmpty(param)) {
             query.addParam(QueryParamExp.like("sn", "%".concat(param.getSn()).concat("%")));
         }
+        query.addParam(QueryParamExp.eq("status", 1));
         Page<AppDevice> devicePage = appDeviceService.findByParam(query);
 
         devicePage.getContent().forEach(p -> {
+            QueryParam finalQuery = new QueryParam();
+            finalQuery.addParam(QueryParamExp.desc("addTime"));
+            finalQuery.addParam(QueryParamExp.eq("sn", p.getSn()));
+            finalQuery.addParam(QueryParamExp.eq("type", 2));
+            Page<AppDeviceLog> deviceLogPage = deviceLogService.findByParam(query);
+            AppDeviceLog lastDeviceLogPage = new AppDeviceLog();
+            if (!deviceLogPage.isEmpty()) {
+                lastDeviceLogPage =  deviceLogPage.getContent().get(0);
+            }
             appDeviceService.addImeiTitle(p);
+            p.appendInfo(lastDeviceLogPage);
         });
         return new ApiPageDTO(null, devicePage);
     }

+ 13 - 0
src/main/java/cn/fastfun/service/entity/AppDevice.java

@@ -200,4 +200,17 @@ public class AppDevice extends DateEntity {
         setCheckStatus(0);
         return this;
     }
+
+    @ApiModelProperty(value = "用途", name = "tfUsed", required = true)
+    @Column(name = "tf_used")
+    private String tfUsed;
+
+
+    @ApiModelProperty(value = "描述", name = "tfDescribe", required = true)
+    @Column(name = "tf_describe")
+    private String tfDescribe;
+    public void appendInfo(AppDeviceLog deviceLog) {
+        setTfUsed(deviceLog.getTfUsed());
+        setTfDescribe(deviceLog.getTfDescribe());
+    }
 }