3 Commits 7e8bce3d8f ... 56b997710a

Autor SHA1 Mensagem Data
  liu 56b997710a Merge branch 'master' of https://mx.jqmoyan.com/ch-校园卡/backend_dormitory 2 meses atrás
  liu 736798370a 修改新生报到情况接口 2 meses atrás
  liu ea43ee4e01 修改学生总览接口接口 2 meses atrás

+ 78 - 17
src/main/java/com/template/controller/WelcomeStudentController.java

@@ -1780,21 +1780,30 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
         String nstartTime = null;
         String nendTime = null;
         boolean lastYear = TimeExchange.CompareDate(TimeExchange.getDate(), TimeExchange.getYear() + "-07-01", "yyyy-MM-dd");
+
+//        获取年份
+        String yearStr="";
+
         if (yearId == null) {
             Integer yearInt = Integer.valueOf(TimeExchange.getYear());
             //当前时间小于本年度的7月1日 说明要查去年的数据
             if (lastYear) {
+                yearStr=(yearInt - 1) +"级新生";
                 nstartTime = (yearInt - 1) + "-06-01";
                 nendTime = yearInt + "-06-01";
             } else {
+                yearStr=yearInt +"级新生";
                 nstartTime = yearInt + "-06-01";
                 nendTime = (yearInt + 1) + "-06-01";
             }
         } else {
+            yearStr=yearId +"级新生";
             nstartTime = yearId + "-06-01";
             nendTime = (yearId + 1) + "-06-01";
         }
 
+
+
         //获取学生总数
         int enrollmentTotal = welcomeStudentService.studentTotalCount(collegeId, nstartTime, nendTime);
         //录取总数
@@ -1802,28 +1811,54 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
         //queryWrapper.eq(WelcomeStudent::getIdenType,1);
         //int enrollmentTotal = 8085;//welcomeStudentService.count(queryWrapper);
 
-        //缴费人数
+        //全部缴费人数
         int payCount = welcomeStudentService.payCount(collegeId, nstartTime, nendTime);
-        //缴费率
+
+        //全部缴费率
         Double rate = enrollmentTotal <= 0 ? 0 : ((double) payCount / enrollmentTotal) * 100;
         String payRate = String.format("%.2f", rate);
 
+//        部分缴费人数,支付状态未缴费,并且实付金额大于0
+        int portionPayCount = welcomeStudentService.payPortionCount(collegeId, nstartTime, nendTime);
 
-        //已入住寝室数
-        LambdaQueryWrapper<WelcomeBed> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(WelcomeBed::getIsCheck, 1)
-                .eq(WelcomeBed::getRetentionState, 1)
-                .eq(ObjectUtils.isNotEmpty(collegeId), WelcomeBed::getCollegeId, collegeId);
-        wrapper.between(WelcomeBed::getCreateTime, nstartTime, nendTime);
-        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 result = enrollmentTotal <= 0 ? 0 : ((double) checkInBedTotal / enrollmentTotal) * 100;
+        //        部分缴费率
+        Double portionRate = enrollmentTotal <= 0 ? 0 : ((double) portionPayCount / enrollmentTotal) * 100;
+        String portionPayRate = String.format("%.2f", portionRate);
+
+//        总缴费人数(包括部分缴费人数)
+        int totalPayCount =payCount+portionPayCount;
+
+//      总缴费率(包括部分缴费)
+        Double totalRate=enrollmentTotal <= 0 ? 0 : ((double) totalPayCount / enrollmentTotal) * 100;
+        String totalPayRate = String.format("%.2f", totalRate);
+
+
+//        现场报到总人数
+        int registrationCount = welcomeStudentService.registrationCount(collegeId, nstartTime, nendTime);
+        Double result = enrollmentTotal <= 0 ? 0 : ((double) registrationCount / enrollmentTotal) * 100;
         String registrationRate = String.format("%.2f", result);
 
+//        未报道人数
+        int notRegistrationCount=enrollmentTotal-registrationCount;
+
+//        已缴费但未现场报到人数
+        int payNotRegistrationCount=welcomeStudentService.payNotRegistrationCount(collegeId, nstartTime, nendTime);
+
+//        已缴费但未现场报到比率
+        Double payNotReportCountRate = enrollmentTotal <= 0 ? 0 : ((double) payNotRegistrationCount / enrollmentTotal) * 100;
+        String payNotRegistrationRate = String.format("%.2f", payNotReportCountRate);
+
+        //已入住寝室数
+//        LambdaQueryWrapper<WelcomeBed> wrapper = new LambdaQueryWrapper<>();
+//        wrapper.eq(WelcomeBed::getIsCheck, 1)
+//                .eq(WelcomeBed::getRetentionState, 1)
+//                .eq(ObjectUtils.isNotEmpty(collegeId), WelcomeBed::getCollegeId, collegeId);
+//        wrapper.between(WelcomeBed::getCreateTime, nstartTime, nendTime);
+//        int checkInBedTotal = welcomeBedService.count(wrapper);
+
+//        Double result = enrollmentTotal <= 0 ? 0 : ((double) checkInBedTotal / enrollmentTotal) * 100;
+//        String registrationRate = String.format("%.2f", result);
+
 
         LocalDateTime start = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
         LocalDateTime end = start.plusDays(1);
@@ -1841,14 +1876,39 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
         Integer hCarTotal = wss != null && wss.size() > 0 ? (wss.get(0).getHjhCarNum() == null ? 0 : wss.get(0).getHjhCarNum()) : 0;
 
         StudentOverviewVo vo = new StudentOverviewVo();
+//        总人数
         vo.setEnrollmentTotal(enrollmentTotal);
+//        年份字段
+        vo.setYearStr(yearStr);
+//        现场报到人数
+        vo.setRegistrationCount(registrationCount);
+//        现场报到率
+        vo.setRegistrationRate(registrationRate);
+//        未报到人数
+        vo.setNotRegistrationCount(notRegistrationCount);
+//        总缴费人数(包括部分缴费)
+        vo.setTotalPayCount(totalPayCount);
+//        总缴费率(包括部分缴费)
+        vo.setTotalPayRate(totalPayRate);
+//        全部缴费人数
         vo.setPayCount(payCount);
+//        全部缴费率
         vo.setPayRate(payRate);
-        vo.setCheckInBedTotal(checkInBedTotal);
-        vo.setRegistrationRate(registrationRate);
+//        部分缴费人数
+        vo.setPortionPayCount(portionPayCount);
+//        部分缴费率
+        vo.setPortionPayRate(portionPayRate);
+//        已缴费未报到人数
+        vo.setPayNotRegistrationCount(payNotRegistrationCount);
+//        已缴费未报到率
+        vo.setPayNotRegistrationRate(payNotRegistrationRate);
+//        黄家湖当日剩余总数
         vo.setHCarTotal(hCarTotal - hVisitorTotal);
+//        黄家湖当日预定数
         vo.setHVisitorTotal(hVisitorTotal);
+//        墨轩湖当日剩余数
         vo.setMCarTotal(mCarTotal - mVisitorTotal);
+//        墨轩湖当日预定数
         vo.setMVisitorTotal(mVisitorTotal);
         return CommonResult.ok(vo);
     }
@@ -1884,6 +1944,7 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
         vo.setName("报到总数");
         vo.setCount(count);
         vo.setRate(rate);
+        vo.setTotalCount(enrollmentTotal);
         if (ObjectUtils.isNotEmpty(collegeId)) {
             List<StudentRegisterVo> vos = welcomeStudentService.studentMajorRegister(collegeId, nstartTime, nendTime);
             vos.add(vo);

+ 31 - 6
src/main/java/com/template/model/vo/StudentOverviewVo.java

@@ -7,17 +7,42 @@ public class StudentOverviewVo {
     //录取人数
     private Integer enrollmentTotal;
 
-    //已缴费人数
+//    年份
+    private String yearStr;
+
+//    现场报到人数
+    private Integer registrationCount;
+
+//    现场报到率
+    private String registrationRate;
+
+//    未报到人数
+    private Integer notRegistrationCount;
+
+
+//    总缴费人数(包括部分缴费)
+    private Integer totalPayCount;
+
+//    总缴费率(包括部分缴费)
+    private String totalPayRate;
+
+    //全部缴费人数
     private Integer payCount;
 
-    //缴费率
+    //全部缴费率
     private String payRate;
 
-    //入住床位总数
-    private Integer checkInBedTotal;
+//    部分缴费人
+    private Integer portionPayCount;
 
-    //报到率
-    private String registrationRate;
+//    部分缴费率
+    private  String portionPayRate;
+
+//    已缴费未报到人数
+    private Integer payNotRegistrationCount;
+
+//    已缴费未报到率
+    private String payNotRegistrationRate;
 
     //当天墨轩湖预定车牌数
     private Integer mVisitorTotal;

+ 1 - 1
src/main/java/com/template/model/vo/StudentRegisterVo.java

@@ -6,7 +6,7 @@ import lombok.Data;
 public class StudentRegisterVo {
 //    名称
     private String name;
-//    总数
+//    报到总数
     private Integer count;
 //    比例
     private String rate;

+ 6 - 0
src/main/java/com/template/services/WelcomeStudentService.java

@@ -88,4 +88,10 @@ public interface WelcomeStudentService extends IService<WelcomeStudent> {
     int updateStudents(List<Integer> ids);
 
     List<WelcomeStudent> queryStudents(List<Integer> ids);
+
+    int payPortionCount(Integer collegeId, String startTime, String endTime);
+
+    int registrationCount(Integer collegeId, String startTime, String endTime);
+
+    int payNotRegistrationCount(Integer collegeId, String startTime, String endTime);
 }

+ 40 - 1
src/main/java/com/template/services/impl/WelcomeStudentServiceImpl.java

@@ -155,7 +155,8 @@ public class WelcomeStudentServiceImpl extends ServiceImpl<WelcomeStudentMapper,
     public int payCount(Integer collegeId, String startTime, String endTime) {
         QueryWrapper<WelcomeStudent> wss = new QueryWrapper<>();
 //        wss.gt("pay_amount",0);//交了钱就算已交付
-        wss.eq("is_pay", 1)
+        wss.eq("iden_type", 1)
+                .eq("is_pay", 1)
                 .eq(ObjectUtils.isNotEmpty(collegeId), "college_id", collegeId);//
         wss.between("create_time", startTime, endTime);
         Integer count = welcomeStudentMapper.selectCount(wss);
@@ -279,4 +280,42 @@ public class WelcomeStudentServiceImpl extends ServiceImpl<WelcomeStudentMapper,
         List<WelcomeStudent> result = welcomeStudentMapper.selectList(queryWrapper);
         return result;
     }
+
+    @Override
+    public int payPortionCount(Integer collegeId, String startTime, String endTime) {
+        QueryWrapper<WelcomeStudent> wss = new QueryWrapper<>();
+//        未支付,但实缴金额>0
+        wss.eq("iden_type",1)
+                .eq("is_pay", 0)
+                .gt("pay_amount", 0)
+                .eq(ObjectUtils.isNotEmpty(collegeId), "college_id", collegeId);//
+        wss.between("create_time", startTime, endTime);
+        Integer count = welcomeStudentMapper.selectCount(wss);
+        return count;
+    }
+
+    @Override
+    public int registrationCount(Integer collegeId, String startTime, String endTime) {
+        QueryWrapper<WelcomeStudent> wss = new QueryWrapper<>();
+//        已报道人数
+        wss.eq("iden_type",1)
+                .eq("is_registered", 1)
+                .eq(ObjectUtils.isNotEmpty(collegeId), "college_id", collegeId);//
+        wss.between("create_time", startTime, endTime);
+        Integer count = welcomeStudentMapper.selectCount(wss);
+        return count;
+    }
+
+    @Override
+    public int payNotRegistrationCount(Integer collegeId, String startTime, String endTime) {
+        QueryWrapper<WelcomeStudent> wss = new QueryWrapper<>();
+//         已缴费,但未报到人数
+        wss.eq("iden_type",1)
+                .eq("is_pay", 1)
+                .and(wrapper -> wrapper.eq("is_registered", 2).or().isNull("is_registered"))
+                .eq(ObjectUtils.isNotEmpty(collegeId), "college_id", collegeId);//
+        wss.between("create_time", startTime, endTime);
+        Integer count = welcomeStudentMapper.selectCount(wss);
+        return count;
+    }
 }

+ 16 - 6
src/main/resources/mapper/template/WelcomeStudentMapper.xml

@@ -111,8 +111,14 @@
 
 
     <select id="studentRegister" resultType="com.template.model.vo.StudentRegisterVo">
-        SELECT count(ws.id) AS count,
-	           wo.`name`
+        SELECT
+            SUM(1) AS totalCount,
+            SUM(CASE WHEN ws.is_registered = 1 THEN 1 ELSE 0 END) AS count,
+            ROUND(
+                        SUM(CASE WHEN ws.is_registered = 1 THEN 1 ELSE 0 END) / SUM(1),
+                        2
+                ) AS rate,
+            wo.`name`
         FROM
             `welcome_student` ws
             LEFT JOIN welcome_org wo
@@ -120,7 +126,6 @@
         WHERE
             ws.deleted = 0
           AND ws.iden_type=1
-          AND ws.is_registered = 1
           AND ws.create_time between #{startTime} and #{endTime}
         GROUP BY
             college_id
@@ -202,8 +207,14 @@
         group by college,sex
     </select>
     <select id="studentMajorRegister" resultType="com.template.model.vo.StudentRegisterVo">
-        SELECT count(ws.id) AS count,
-	           wo.`name`
+        SELECT
+            SUM(1) AS totalCount,
+            SUM(CASE WHEN ws.is_registered = 1 THEN 1 ELSE 0 END) AS count,
+            ROUND(
+                        SUM(CASE WHEN ws.is_registered = 1 THEN 1 ELSE 0 END) / SUM(1),
+                        2
+                ) AS rate,
+            wo.`name`
         FROM
             `welcome_student` ws
             LEFT JOIN welcome_org wo
@@ -211,7 +222,6 @@
         WHERE
             ws.deleted = 0
           AND ws.iden_type=1
-          AND ws.is_registered = 1
           AND ws.college_id= #{collegeId}
           AND ws.create_time between #{startTime} and #{endTime}
         GROUP BY