ソースを参照

Merge branch 'master' of https://e.coding.net/chuanghaikeji/smarCampus/backend_dormitory

夏文涛 1 年間 前
コミット
4550a4c92f

+ 1 - 1
src/main/java/com/template/api/WelcomeVisitorControllerAPI.java

@@ -62,5 +62,5 @@ public interface WelcomeVisitorControllerAPI {
 
 
     @GetMapping("admin/export")
     @GetMapping("admin/export")
     @ApiOperation(value = "导出访客记录")
     @ApiOperation(value = "导出访客记录")
-    void export();
+    void export(WelcomeVisitorQuery visitorQuery);
 }
 }

+ 34 - 20
src/main/java/com/template/controller/WelcomeStudentController.java

@@ -47,6 +47,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStream;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.math.BigInteger;
+import java.math.RoundingMode;
 import java.text.ParseException;
 import java.text.ParseException;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatter;
@@ -1469,36 +1470,49 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
     @Override
     @Override
     public CommonResult studentOverview() {
     public CommonResult studentOverview() {
 
 
-        QueryWrapper<WelcomeStudent> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("iden_type", 1);
-        queryWrapper.eq("fill_status", "已填报");
-//        报到总数
-        int studentTotal = welcomeStudentService.count(queryWrapper);
-//        寝室总数
-        int dormitoryTotal = welcomeDormitoryService.count(new QueryWrapper<>());
+//        录取总数
+        LambdaQueryWrapper<WelcomeStudent> queryWrapper=new LambdaQueryWrapper<>();
+        queryWrapper.eq(WelcomeStudent::getIdenType,1);
+        int enrollmentTotal = welcomeStudentService.count(queryWrapper);
 
 
+//        缴费人数
         int payCount = welcomeStudentService.payCount();
         int payCount = welcomeStudentService.payCount();
+
+
 //        已入住寝室数
 //        已入住寝室数
-        LambdaQueryWrapper<WelcomeDormitory> wrapper = new LambdaQueryWrapper<>();
-        wrapper.ne(WelcomeDormitory::getStatus, 2);
-        int count = welcomeDormitoryService.count(wrapper);
+        LambdaQueryWrapper<WelcomeBed> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(WelcomeBed::getIsCheck, 1)
+                .eq(WelcomeBed::getRetentionState,1);
+        int checkInBedTotal = welcomeBedService.count(wrapper);
+
+//        报到率
+        BigDecimal total = new BigDecimal(enrollmentTotal);
+        BigDecimal bedTotal = new BigDecimal(checkInBedTotal);
+        BigDecimal bigDecimal= bedTotal.divide(total).setScale(4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
+        double registrationRate = bigDecimal.doubleValue();
+
 
 
         LocalDateTime start = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
         LocalDateTime start = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
         LocalDateTime end = start.plusDays(1);
         LocalDateTime end = start.plusDays(1);
-        DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        Integer visitorTotal = welcomeVisitorService.countTotal(start, end);
+        Integer mVisitorTotal = welcomeVisitorService.countTotal(start, end,1);
+        Integer hVisitorTotal = welcomeVisitorService.countTotal(start, end,2);
+
+
         List<WelcomeSetting> wss = welcomeSettingService.list(null);
         List<WelcomeSetting> wss = welcomeSettingService.list(null);
-        Integer carTotal = wss != null && wss.size() > 0 ? (wss.get(0).getMxhCarNum() == null ? 0 : wss.get(0).getMxhCarNum()) : 0;
+//        墨轩湖总车辆数
+        Integer mCarTotal = wss != null && wss.size() > 0 ? (wss.get(0).getMxhCarNum() == null ? 0 : wss.get(0).getMxhCarNum()) : 0;
+//        黄家湖总车辆数
+        Integer hCarTotal = wss != null && wss.size() > 0 ? (wss.get(0).getHjhCarNum() == null ? 0 : wss.get(0).getHjhCarNum()) : 0;
 
 
         StudentOverviewVo vo = new StudentOverviewVo();
         StudentOverviewVo vo = new StudentOverviewVo();
-        vo.setEnrollmentTotal(6532);
-        vo.setStudentTotal(studentTotal);
+        vo.setEnrollmentTotal(enrollmentTotal);
         vo.setPayCount(payCount);
         vo.setPayCount(payCount);
-        vo.setDormitoryTotal(dormitoryTotal);
-        vo.setCheckInTotal(count);
-        vo.setVisitorTotal(visitorTotal);
-        vo.setCarTotal(carTotal);
-
+        vo.setCheckInBedTotal(checkInBedTotal);
+        vo.setRegistrationRate(registrationRate);
+        vo.setHCarTotal(hCarTotal-hVisitorTotal);
+        vo.setHVisitorTotal(hVisitorTotal);
+        vo.setMCarTotal(mCarTotal-mVisitorTotal);
+        vo.setMVisitorTotal(mVisitorTotal);
         return CommonResult.ok(vo);
         return CommonResult.ok(vo);
     }
     }
 
 

+ 2 - 2
src/main/java/com/template/controller/WelcomeVisitorController.java

@@ -86,7 +86,7 @@ public class WelcomeVisitorController implements WelcomeVisitorControllerAPI {
     }
     }
 
 
     @Override
     @Override
-    public void export() {
-        welcomeVisitorService.export();
+    public void export(WelcomeVisitorQuery visitorQuery) {
+        welcomeVisitorService.export(visitorQuery);
     }
     }
 }
 }

+ 3 - 0
src/main/java/com/template/model/query/WelcomeVisitorQuery.java

@@ -18,4 +18,7 @@ public class WelcomeVisitorQuery extends PageQuery {
 
 
     @ApiModelProperty(value = "访客姓名,模糊搜索")
     @ApiModelProperty(value = "访客姓名,模糊搜索")
     private String name;
     private String name;
+
+    @ApiModelProperty(value = "校区名称")
+    private String school;
 }
 }

+ 15 - 13
src/main/java/com/template/model/vo/StudentOverviewVo.java

@@ -5,25 +5,27 @@ import lombok.Data;
 @Data
 @Data
 public class StudentOverviewVo {
 public class StudentOverviewVo {
     //录取人数
     //录取人数
-    private Integer EnrollmentTotal;
+    private Integer enrollmentTotal;
 
 
-    //预学生报到
-    private Integer studentTotal;
+    //已缴费人
+    private Integer payCount;
 
 
-    //寝室总数
-    private Integer dormitoryTotal;
+    //入住床位总数
+    private Integer checkInBedTotal;
 
 
-    //已交付
-    private Integer payCount;
+    //报到率
+    private Double registrationRate;
 
 
-    //入住总
-    private Integer checkInTotal;
+    //当天墨轩湖预定车牌
+    private Integer mVisitorTotal;
 
 
-    //当天车牌数
-    private Integer visitorTotal;
+    //当天墨轩湖剩余总车牌数
+    private Integer mCarTotal;
 
 
-    //当天车牌数
-    private Integer carTotal;
+    //当天黄家湖预定车牌数
+    private Integer hVisitorTotal;
 
 
+    //当天黄家湖剩余总车牌数
+    private Integer hCarTotal;
 
 
 }
 }

+ 0 - 8
src/main/java/com/template/model/vo/WelcomeVisitorVO.java

@@ -27,18 +27,10 @@ public class WelcomeVisitorVO implements Serializable {
     @ExcelProperty("访客姓名")
     @ExcelProperty("访客姓名")
     private String name;
     private String name;
 
 
-    @ApiModelProperty(value = "司机姓名")
-    @ExcelProperty("司机姓名")
-    private String driverName;
-
     @ApiModelProperty(value = "访客手机号")
     @ApiModelProperty(value = "访客手机号")
     @ExcelProperty("访客手机号")
     @ExcelProperty("访客手机号")
     private String phone;
     private String phone;
 
 
-    @ApiModelProperty(value = "证件号")
-    @ExcelProperty("证件号")
-    private String cardId;
-
     @ApiModelProperty(value = "校区id")
     @ApiModelProperty(value = "校区id")
     @ExcelIgnore
     @ExcelIgnore
     private String schoolId;
     private String schoolId;

+ 2 - 2
src/main/java/com/template/services/WelcomeVisitorService.java

@@ -65,9 +65,9 @@ public interface WelcomeVisitorService extends IService<WelcomeVisitor> {
     /**
     /**
      * 导出访客记录
      * 导出访客记录
      */
      */
-    void export();
+    void export(WelcomeVisitorQuery visitorQuery);
 
 
-    Integer countTotal(LocalDateTime start, LocalDateTime end);
+    Integer countTotal(LocalDateTime start, LocalDateTime end,Integer schoolId);
 
 
     Integer carTotal();
     Integer carTotal();
 
 

+ 6 - 5
src/main/java/com/template/services/impl/WelcomeVisitorServiceImpl.java

@@ -3,7 +3,6 @@ package com.template.services.impl;
 import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.date.format.DatePrinter;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.URLUtil;
 import cn.hutool.core.util.URLUtil;
@@ -224,9 +223,10 @@ public class WelcomeVisitorServiceImpl extends ServiceImpl<WelcomeVisitorMapper,
     }
     }
 
 
     @Override
     @Override
-    public void export() {
+    public void export(WelcomeVisitorQuery visitorQuery) {
         LambdaQueryWrapper<WelcomeVisitor> wrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<WelcomeVisitor> wrapper = new LambdaQueryWrapper<>();
         wrapper.orderByDesc(WelcomeVisitor::getId);
         wrapper.orderByDesc(WelcomeVisitor::getId);
+        wrapper.eq(StrUtil.isNotBlank(visitorQuery.getSchool()), WelcomeVisitor::getSchool, visitorQuery.getSchool());
         List<WelcomeVisitor> welcomeVisitors = list(wrapper);
         List<WelcomeVisitor> welcomeVisitors = list(wrapper);
 
 
         List<WelcomeVisitorVO> welcomeVisitorVOS = BeanUtil.copyListProperties(welcomeVisitors, WelcomeVisitorVO::new);
         List<WelcomeVisitorVO> welcomeVisitorVOS = BeanUtil.copyListProperties(welcomeVisitors, WelcomeVisitorVO::new);
@@ -254,10 +254,11 @@ public class WelcomeVisitorServiceImpl extends ServiceImpl<WelcomeVisitorMapper,
     }
     }
 
 
     @Override
     @Override
-    public Integer countTotal(LocalDateTime start, LocalDateTime end) {
+    public Integer countTotal(LocalDateTime start, LocalDateTime end,Integer schoolId) {
         LambdaQueryWrapper<WelcomeVisitor> queryWrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<WelcomeVisitor> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.ge(WelcomeVisitor::getStartTime, start)
-                        .le(WelcomeVisitor::getEndTime,end);
+        queryWrapper.le(WelcomeVisitor::getStartTime, start)
+                        .ge(WelcomeVisitor::getEndTime,end)
+                .eq(WelcomeVisitor::getSchoolId,schoolId);
         int count = this.count(queryWrapper);
         int count = this.count(queryWrapper);
         return count;
         return count;
     }
     }