Ver código fonte

realTimeDate类修改

liu 2 anos atrás
pai
commit
f701d88527

+ 2 - 2
src/main/java/com/studenthotel/controller/RealTimeDataController.java

@@ -47,9 +47,9 @@ public class RealTimeDataController {
         String dataType = realTimeDataService.typeConvert(type);
         LambdaQueryWrapper<RealTimeData> wrapper = new LambdaQueryWrapper<>();
 
-        wrapper.select(RealTimeData::getDataId,RealTimeData::getDataType,RealTimeData::getDataAdd,RealTimeData::getDataNumber,RealTimeData::getDataInfo,RealTimeData::getForewarning)
+        wrapper
         .eq(RealTimeData::getDataType,dataType)
-        .orderByDesc(RealTimeData::getDataCreateTime);
+        .orderByDesc(RealTimeData::getDateTime);
 
         IPage<RealTimeData> page1 = realTimeDataService.page(new Page<>(page, size), wrapper);
         return CommonResult.ok(page1);

+ 27 - 8
src/main/java/com/studenthotel/model/pojo/RealTimeData.java

@@ -1,7 +1,6 @@
 package com.studenthotel.model.pojo;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.*;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -9,6 +8,7 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
 import java.io.Serializable;
+import java.util.Date;
 
 /**
  * <p>
@@ -34,6 +34,10 @@ public class RealTimeData implements Serializable {
     @ApiModelProperty(value = "'数据类型:防摔跤、打架、人流密度、抽烟、高空抛物、学情睡觉、学情玩手机、学情抬头、其它'")
     private String dataType;
 
+
+    @ApiModelProperty(value = "'时间'")
+    private String dateTime;
+
     @ApiModelProperty(value = "'数据地址'")
     private String dataAdd;
 
@@ -43,16 +47,31 @@ public class RealTimeData implements Serializable {
     @ApiModelProperty(value = "数据数量")
     private String dataNumber;
 
-    @ApiModelProperty(value = "创建时间")
-    private String dataCreateTime;
-
-    @ApiModelProperty(value = "数据更新时间")
-    private String dataUpdateTime;
-
     @ApiModelProperty(value = "预警信息")
     private String forewarning;
 
     @ApiModelProperty(value = "备注")
     private String remake;
 
+
+    @TableField(fill = FieldFill.INSERT)
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+
+    @TableField(fill = FieldFill.INSERT)
+    @ApiModelProperty(value = "创建人员")
+    private Long createUser;
+
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    @ApiModelProperty(value = "更新人员")
+    private Long updateUser;
+
+    @ApiModelProperty(value = "逻辑删除标记")
+    @TableLogic
+    private Long deleted;
+
 }

+ 15 - 14
src/main/java/com/studenthotel/services/impl/RealTimeDataServiceImpl.java

@@ -50,27 +50,28 @@ public class RealTimeDataServiceImpl extends ServiceImpl<RealTimeDataMapper, Rea
         String dataType = typeConvert(type);
         List sleepList = new ArrayList();
         List playList = new ArrayList();
-        List lookList = new ArrayList();
+//        List lookList = new ArrayList();
         // 查询类型分类,1防摔跤2打架3抽烟4高空抛物5学情睡觉6学情玩手机7学情抬头8其它9查学情
         if (type.equals("9"))
         {
             // 9查学情可分为5学情睡觉6学情玩手机7学情抬头三种情况
             LambdaQueryWrapper<RealTimeData> wrapper = new LambdaQueryWrapper<>();
-            wrapper.eq(RealTimeData::getDataType, typeConvert("5")).orderByDesc(RealTimeData::getDataCreateTime);
+            wrapper.eq(RealTimeData::getDataType, typeConvert("5")).orderByDesc(RealTimeData::getDateTime);
             sleepList = this.list(wrapper);
 
             wrapper = new LambdaQueryWrapper<>();
             wrapper.eq(RealTimeData::getDataType, typeConvert("6"));
             playList = this.list(wrapper);
 
-            wrapper = new LambdaQueryWrapper<>();
-            wrapper.eq(RealTimeData::getDataType, typeConvert("7")).orderByDesc(RealTimeData::getDataCreateTime);
-            lookList = this.list(wrapper);
+//            wrapper = new LambdaQueryWrapper<>();
+//            wrapper.eq(RealTimeData::getDataType, typeConvert("7")).orderByDesc(RealTimeData::getCreateTime);
+//            lookList = this.list(wrapper);
 
-            int count = sleepList.size() + playList.size() + lookList.size();
+//            int count = sleepList.size() + playList.size() + lookList.size();
+            int count = sleepList.size() + playList.size() ;
             map.put(typeConvert("5"),sleepList.size());
             map.put(typeConvert("6"),playList.size());
-            map.put(typeConvert("7"),lookList.size());
+//            map.put(typeConvert("7"),lookList.size());
 
             if (count != 0)
             {
@@ -78,12 +79,12 @@ public class RealTimeDataServiceImpl extends ServiceImpl<RealTimeDataMapper, Rea
                 String sleepPercent = rateStr+"%";
                 rateStr = (new BigDecimal((float) playList.size() / count).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue()) * 100;
                 String playPercent = rateStr+"%";
-                rateStr = (new BigDecimal((float) lookList.size() / count).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue()) * 100;
-                String lookPercent = rateStr+"%";
+//                rateStr = (new BigDecimal((float) lookList.size() / count).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue()) * 100;
+//                String lookPercent = rateStr+"%";
 
                 map.put(typeConvert("5")+ "百分比" ,sleepPercent);
                 map.put(typeConvert("6")+ "百分比",playList);
-                map.put(typeConvert("7")+ "百分比",lookPercent);
+//                map.put(typeConvert("7")+ "百分比",lookPercent);
             }
 
             return map;
@@ -92,7 +93,7 @@ public class RealTimeDataServiceImpl extends ServiceImpl<RealTimeDataMapper, Rea
 
         LambdaQueryWrapper<RealTimeData> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(RealTimeData::getDataType,dataType);
-        wrapper.orderByDesc(RealTimeData::getDataCreateTime);
+        wrapper.orderByDesc(RealTimeData::getDateTime);
         List<RealTimeData> list = this.list(wrapper);
         if (list.size() >= 0){
             map.put(type,list);
@@ -114,7 +115,7 @@ public class RealTimeDataServiceImpl extends ServiceImpl<RealTimeDataMapper, Rea
             return "防摔跤";
         }
         if (type.equals("1")) {
-            return "摔跤";
+            return "摔跤";
         }else if (type.equals("2")) {
             return "打架";
         }else if (type.equals("3")) {
@@ -122,9 +123,9 @@ public class RealTimeDataServiceImpl extends ServiceImpl<RealTimeDataMapper, Rea
         }else if (type.equals("4")) {
             return "高空抛物";
         }else if (type.equals("5")) {
-            return "学情睡觉";
+            return "睡觉";
         }else if (type.equals("6")) {
-            return "学情玩手机";
+            return "玩手机";
         }else if (type.equals("7")) {
             return "学情抬头";
         }else if (type.equals("8")) {

+ 2 - 4
src/main/resources/application-dev.yml

@@ -9,10 +9,8 @@ spring:
   #\u6570\u636E\u5E93\u914D\u7F6E\u94FE\u63A5
   datasource:
     username: root
-    password: HuaWei@2022
-    #password: chuanghai_2023.
-    url: jdbc:mysql://localhost:3306/studenthotel_houtai?characterEncoding=UTF-8&share_videosuseSSL=false&useUnicode=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
-   # url: jdbc:mysql://139.199.2.142:3306/share_videos?characterEncoding=UTF-8&share_videosuseSSL=false&useUnicode=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+    password: chuanghai_2023.
+    url: jdbc:mysql://172.16.20.72:3306/studenthotel_houtai?characterEncoding=UTF-8&share_videosuseSSL=false&useUnicode=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
     driver-class-name: com.mysql.jdbc.Driver
     cache:
       type: redis

+ 3 - 3
src/main/resources/application.yml

@@ -9,9 +9,9 @@ spring:
   #\u6570\u636E\u5E93\u914D\u7F6E\u94FE\u63A5
   datasource:
     username: root
-    password: HuaWei@2022
-#    url: jdbc:mysql://localhost:3306/studenthotel_houtai?characterEncoding=UTF-8&share_videosuseSSL=false&useUnicode=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
-    url: jdbc:mysql://172.16.20.72:3306/studenthotel_houtai?characterEncoding=UTF-8&share_videosuseSSL=false&useUnicode=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+    password: root
+    url: jdbc:mysql://localhost:3306/studenthotel_houtai?characterEncoding=UTF-8&share_videosuseSSL=false&useUnicode=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+ #   url: jdbc:mysql://172.16.20.72:3306/studenthotel_houtai?characterEncoding=UTF-8&share_videosuseSSL=false&useUnicode=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
     driver-class-name: com.mysql.cj.jdbc.Driver
     cache:
       type: redis

+ 2 - 4
target/classes/application-dev.yml

@@ -9,10 +9,8 @@ spring:
   #\u6570\u636E\u5E93\u914D\u7F6E\u94FE\u63A5
   datasource:
     username: root
-    password: HuaWei@2022
-    #password: chuanghai_2023.
-    url: jdbc:mysql://localhost:3306/studenthotel_houtai?characterEncoding=UTF-8&share_videosuseSSL=false&useUnicode=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
-   # url: jdbc:mysql://139.199.2.142:3306/share_videos?characterEncoding=UTF-8&share_videosuseSSL=false&useUnicode=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+    password: chuanghai_2023.
+    url: jdbc:mysql://172.16.20.72:3306/studenthotel_houtai?characterEncoding=UTF-8&share_videosuseSSL=false&useUnicode=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
     driver-class-name: com.mysql.jdbc.Driver
     cache:
       type: redis

+ 3 - 3
target/classes/application.yml

@@ -9,9 +9,9 @@ spring:
   #\u6570\u636E\u5E93\u914D\u7F6E\u94FE\u63A5
   datasource:
     username: root
-    password: HuaWei@2022
-#    url: jdbc:mysql://localhost:3306/studenthotel_houtai?characterEncoding=UTF-8&share_videosuseSSL=false&useUnicode=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
-    url: jdbc:mysql://172.16.20.72:3306/studenthotel_houtai?characterEncoding=UTF-8&share_videosuseSSL=false&useUnicode=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+    password: root
+    url: jdbc:mysql://localhost:3306/studenthotel_houtai?characterEncoding=UTF-8&share_videosuseSSL=false&useUnicode=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+ #   url: jdbc:mysql://172.16.20.72:3306/studenthotel_houtai?characterEncoding=UTF-8&share_videosuseSSL=false&useUnicode=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
     driver-class-name: com.mysql.cj.jdbc.Driver
     cache:
       type: redis

BIN
target/classes/com/studenthotel/controller/RealTimeDataController.class


BIN
target/classes/com/studenthotel/model/pojo/RealTimeData.class


BIN
target/classes/com/studenthotel/services/impl/RealTimeDataServiceImpl.class