Преглед на файлове

数据看板-全校师生预览

dzx преди 7 месеца
родител
ревизия
8c6501cd82

+ 99 - 0
src/main/java/com/xjrsoft/module/databoard/controller/DataboardController.java

@@ -2,6 +2,9 @@ package com.xjrsoft.module.databoard.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.xjrsoft.common.enums.DeleteMark;
+import com.xjrsoft.common.enums.GenderDictionaryEnum;
+import com.xjrsoft.common.enums.StudyStatusEnum;
 import com.xjrsoft.common.enums.WorkflowIsRecycleType;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
@@ -10,7 +13,14 @@ import com.xjrsoft.module.courseTable.service.ICourseTableService;
 import com.xjrsoft.module.databoard.dto.StatisticsDto;
 import com.xjrsoft.module.databoard.vo.CourseStatisticsVo;
 import com.xjrsoft.module.databoard.vo.MeetingStatisticsVo;
+import com.xjrsoft.module.databoard.vo.PersonStatisticsVo;
 import com.xjrsoft.module.databoard.vo.ProcessStatisticsVo;
+import com.xjrsoft.module.databoard.vo.VisitorStatisticsVo;
+import com.xjrsoft.module.outint.entity.VisitorOutInRecord;
+import com.xjrsoft.module.outint.service.IVisitorOutInRecordService;
+import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
+import com.xjrsoft.module.student.service.IBaseStudentService;
+import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
 import com.xjrsoft.module.workflow.constant.WorkflowConstant;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -22,9 +32,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.time.LocalDate;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
 * @title: 数据看板代码
@@ -39,6 +52,8 @@ public class DataboardController {
 
     private final HistoryService historyService;
     private final ICourseTableService courseTableService;
+    private final IVisitorOutInRecordService visitorService;
+    private final IBaseStudentService studentService;
 
     @GetMapping(value = "/process-statistics")
     @ApiOperation(value="流程统计")
@@ -106,4 +121,88 @@ public class DataboardController {
         return RT.ok(result);
     }
 
+    @GetMapping(value = "/visitor-statistics")
+    @ApiOperation(value="访客统计")
+    @SaCheckPermission("databoard:detail")
+    public RT<VisitorStatisticsVo> visitorStatistics(@Valid StatisticsDto dto){
+        List<VisitorOutInRecord> list = visitorService.list(
+                new QueryWrapper<VisitorOutInRecord>().lambda()
+                        .eq(VisitorOutInRecord::getDeleteMark, DeleteMark.DELETED.getCode())
+        );
+        VisitorStatisticsVo result = new VisitorStatisticsVo();
+        result.setAllCount(list.size());
+        LocalDate today = LocalDate.now();
+        int todayCount = 0;
+        for (VisitorOutInRecord record : list) {
+            if(today.equals(record.getRecordTime().toLocalDate())){
+                todayCount ++;
+            }
+        }
+        result.setTodayCount(todayCount);
+        return RT.ok(result);
+    }
+
+    @GetMapping(value = "/person-statistics")
+    @ApiOperation(value="访客统计")
+    @SaCheckPermission("databoard:detail")
+    public RT<PersonStatisticsVo> personStatistics(@Valid StatisticsDto dto){
+
+        List<BaseStudentUserPageVo> studentList = studentService.getStudentList(new BaseStudentUserPageDto());
+
+        PersonStatisticsVo result = new PersonStatisticsVo();
+        result.setStudentCount(studentList.size());
+
+        Set<String> studentMaleSet = studentList.stream()
+                .filter(x -> (x.getGenderCn() != null && x.getGenderCn().equals(GenderDictionaryEnum.MALE.getCode())))
+                .map(BaseStudentUserPageVo::getId).collect(Collectors.toSet());
+        result.setStudentMaleCount(studentMaleSet.size());
+
+        Set<String> studentFemaleSet = studentList.stream()
+                .filter(x -> (x.getGenderCn() != null && x.getGenderCn().equals(GenderDictionaryEnum.FEMALE.getCode())))
+                .map(BaseStudentUserPageVo::getId).collect(Collectors.toSet());
+        result.setStudentFemaleCount(studentFemaleSet.size());
+
+        Set<String> studentStayMaleSet = studentList.stream()
+                .filter(x -> (
+                        x.getGenderCn() != null
+                        && x.getGenderCn().equals(GenderDictionaryEnum.MALE.getCode())
+                        && x.getStduyStatusCn() != null
+                        && x.getStduyStatusCn().equals(StudyStatusEnum.InResidence.getCode())
+                ))
+                .map(BaseStudentUserPageVo::getId).collect(Collectors.toSet());
+        result.setStudentStayMaleCount(studentStayMaleSet.size());
+
+        Set<String> studentNotStayMaleSet = studentList.stream()
+                .filter(x -> (
+                        x.getGenderCn() != null
+                                && x.getGenderCn().equals(GenderDictionaryEnum.MALE.getCode())
+                                && x.getStduyStatusCn() != null
+                                && x.getStduyStatusCn().equals(StudyStatusEnum.AttendDaySchool.getCode())
+                ))
+                .map(BaseStudentUserPageVo::getId).collect(Collectors.toSet());
+        result.setStudentNotStayMaleCount(studentNotStayMaleSet.size());
+
+        Set<String> studentStayFemaleSet = studentList.stream()
+                .filter(x -> (
+                        x.getGenderCn() != null
+                                && x.getGenderCn().equals(GenderDictionaryEnum.FEMALE.getCode())
+                                && x.getStduyStatusCn() != null
+                                && x.getStduyStatusCn().equals(StudyStatusEnum.InResidence.getCode())
+                ))
+                .map(BaseStudentUserPageVo::getId).collect(Collectors.toSet());
+        result.setStudentStayFemaleCount(studentStayFemaleSet.size());
+
+        Set<String> studentNotStayFemaleSet = studentList.stream()
+                .filter(x -> (
+                        x.getGenderCn() != null
+                                && x.getGenderCn().equals(GenderDictionaryEnum.FEMALE.getCode())
+                                && x.getStduyStatusCn() != null
+                                && x.getStduyStatusCn().equals(StudyStatusEnum.AttendDaySchool.getCode())
+                ))
+                .map(BaseStudentUserPageVo::getId).collect(Collectors.toSet());
+        result.setStudentNotStayFemaleCount(studentNotStayFemaleSet.size());
+
+        return RT.ok(result);
+    }
+
 }

+ 47 - 0
src/main/java/com/xjrsoft/module/databoard/vo/PersonStatisticsVo.java

@@ -0,0 +1,47 @@
+package com.xjrsoft.module.databoard.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @title: 数据看板-课程统计出参
+* @Author dzx
+* @Date: 2024年8月2日
+* @Version 1.0
+*/
+@Data
+public class PersonStatisticsVo {
+
+
+    @ApiModelProperty("教师总人数")
+    private Integer teacherCount;
+
+    @ApiModelProperty("男教师总人数")
+    private Integer teacherMaleCount;
+
+    @ApiModelProperty("女教师总人数")
+    private Integer teacherFemaleCount;
+
+
+    @ApiModelProperty("学生总人数")
+    private Integer studentCount;
+
+    @ApiModelProperty("男学生总人数")
+    private Integer studentMaleCount;
+
+    @ApiModelProperty("女学生总人数")
+    private Integer studentFemaleCount;
+
+    @ApiModelProperty("住校男学生总人数")
+    private Integer studentStayMaleCount;
+
+    @ApiModelProperty("住校女学生总人数")
+    private Integer studentStayFemaleCount;
+
+    @ApiModelProperty("走读男学生总人数")
+    private Integer studentNotStayMaleCount;
+
+    @ApiModelProperty("走读女学生总人数")
+    private Integer studentNotStayFemaleCount;
+
+}

+ 22 - 0
src/main/java/com/xjrsoft/module/databoard/vo/VisitorStatisticsVo.java

@@ -0,0 +1,22 @@
+package com.xjrsoft.module.databoard.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @title: 数据看板-课程统计出参
+* @Author dzx
+* @Date: 2024年8月2日
+* @Version 1.0
+*/
+@Data
+public class VisitorStatisticsVo {
+
+
+    @ApiModelProperty("历史访客总数")
+    private Integer allCount;
+
+    @ApiModelProperty("今日访客数")
+    private Integer todayCount;
+
+}

+ 2 - 1
src/main/java/com/xjrsoft/module/outint/entity/VisitorOutInRecord.java

@@ -10,6 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.time.LocalDateTime;
 import java.util.Date;
 
 
@@ -78,7 +79,7 @@ public class VisitorOutInRecord implements Serializable {
     * 记录时间
     */
     @ApiModelProperty("记录时间")
-    private String recordTime;
+    private LocalDateTime recordTime;
     /**
     * 人脸照片
     */

+ 2 - 0
src/main/java/com/xjrsoft/module/student/mapper/BaseStudentMapper.java

@@ -34,4 +34,6 @@ public interface BaseStudentMapper extends MPJBaseMapper<BaseStudent> {
     List<String> getCredentialNumbers();
 
     Page<BaseStudentUserPageVo> getStudentPage(Page<BaseStudentUserPageVo> page, BaseStudentUserPageDto dto);
+
+    List<BaseStudentUserPageVo> getStudentList(BaseStudentUserPageDto dto);
 }

+ 6 - 0
src/main/java/com/xjrsoft/module/student/service/IBaseStudentService.java

@@ -1,9 +1,13 @@
 package com.xjrsoft.module.student.service;
 
 import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
 import com.xjrsoft.module.student.entity.BaseStudent;
+import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
 import com.xjrsoft.module.student.vo.StudentPersonalInfoVo;
 
+import java.util.List;
+
 /**
 * @title: 奖学金申请
 * @Author dzx
@@ -13,4 +17,6 @@ import com.xjrsoft.module.student.vo.StudentPersonalInfoVo;
 
 public interface IBaseStudentService extends MPJBaseService<BaseStudent> {
     StudentPersonalInfoVo getPersonalInfo(Long userId);
+
+    List<BaseStudentUserPageVo> getStudentList(BaseStudentUserPageDto dto);
 }

+ 12 - 1
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentServiceImpl.java

@@ -1,13 +1,17 @@
 package com.xjrsoft.module.student.service.impl;
 
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
 import com.xjrsoft.module.student.entity.BaseStudent;
 import com.xjrsoft.module.student.mapper.BaseStudentMapper;
 import com.xjrsoft.module.student.service.IBaseStudentService;
+import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
 import com.xjrsoft.module.student.vo.StudentPersonalInfoVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
 * @title: 助学金申请
 * @Author dzx
@@ -22,5 +26,12 @@ public class BaseStudentServiceImpl extends MPJBaseServiceImpl<BaseStudentMapper
     @Override
     public StudentPersonalInfoVo getPersonalInfo(Long userId){
         return studentMapper.getPersonalInfo(userId);
-    };
+    }
+
+    @Override
+    public List<BaseStudentUserPageVo> getStudentList(BaseStudentUserPageDto dto) {
+        return this.baseMapper.getStudentList(dto);
+    }
+
+    ;
 }

+ 4 - 4
src/main/resources/mapper/activity/ActivityInfoMapper.xml

@@ -56,15 +56,15 @@
         SELECT a1.id, a1.club_activities_name AS NAME, 1 AS enroll_status,
         a1.club_activities_content AS content,
         a1.activity_location AS place,a1.start_time AS start_date
-        ,a1.end_time AS end_date, NULL AS cover_file_id,a1.activity_type AS category,NULL AS org_name
-        ,NULL AS enroll_end_time, 1 AS STATUS,NULL AS TYPE,null as type_cn
+        ,a1.end_time AS end_date, NULL AS cover_file_id,3 AS category,NULL AS org_name
+        ,NULL AS enroll_end_time, 1 AS STATUS,NULL AS TYPE,a1.activity_type as type_cn
         FROM club_activities a1 WHERE a1.delete_mark = 0 AND a1.student_id = #{dto.loginUserId}
         UNION
         SELECT a2.id, a2.moral_event_name AS NAME, 1 AS enroll_status,
         a2.event_content AS content,
         a2.event_address AS place,a2.event_start_time AS start_date
-        ,a2.event_end_time AS end_date, NULL AS cover_file_id,a2.event_type AS category,NULL AS org_name
-        ,NULL AS enroll_end_time, 1 AS STATUS,NULL AS TYPE,null as type_cn
+        ,a2.event_end_time AS end_date, NULL AS cover_file_id,4 AS category,NULL AS org_name
+        ,NULL AS enroll_end_time, 1 AS STATUS,NULL AS TYPE,a2.event_type as type_cn
         FROM moral_event a2 WHERE a2.delete_mark = 0 AND
         (a2.attend_teacher = #{dto.loginUserId} OR a2.attend_class IN (
         SELECT class_id FROM base_student_school_roll WHERE user_id =  #{dto.loginUserId}

+ 10 - 0
src/main/resources/mapper/student/BaseStudentMapper.xml

@@ -115,7 +115,17 @@
                 </if>
             </if>
         </if>
+    </select>
 
+    <select id="getStudentList" parameterType="com.xjrsoft.module.student.dto.BaseStudentUserPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentUserPageVo">
+        SELECT t1.id,t4.name AS class_name,t5.name AS teacher_name,t1.name,t1.gender AS gender_cn,t1.credential_number,
+        t1.mobile,t3.archives_status AS archives_status_cn ,t3.stduy_status AS stduy_status_cn,t3.student_type AS student_type_cn,t3.learn_status as learn_status_cn FROM xjr_user t1
+        INNER JOIN base_student t2 ON t1.id = t2.user_id
+        LEFT JOIN base_student_school_roll t3 ON t1.id = t3.user_id
+        LEFT JOIN base_class t4 ON t4.id = t3.class_id
+        LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
+        WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
+        and t3.archives_status = 'FB2901'
     </select>
 
 </mapper>