|
@@ -2,6 +2,9 @@ package com.xjrsoft.module.databoard.controller;
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
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.enums.WorkflowIsRecycleType;
|
|
import com.xjrsoft.common.model.result.RT;
|
|
import com.xjrsoft.common.model.result.RT;
|
|
import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
|
|
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.dto.StatisticsDto;
|
|
import com.xjrsoft.module.databoard.vo.CourseStatisticsVo;
|
|
import com.xjrsoft.module.databoard.vo.CourseStatisticsVo;
|
|
import com.xjrsoft.module.databoard.vo.MeetingStatisticsVo;
|
|
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.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 com.xjrsoft.module.workflow.constant.WorkflowConstant;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -22,9 +32,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
|
+import java.time.LocalDate;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.Set;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @title: 数据看板代码
|
|
* @title: 数据看板代码
|
|
@@ -39,6 +52,8 @@ public class DataboardController {
|
|
|
|
|
|
private final HistoryService historyService;
|
|
private final HistoryService historyService;
|
|
private final ICourseTableService courseTableService;
|
|
private final ICourseTableService courseTableService;
|
|
|
|
+ private final IVisitorOutInRecordService visitorService;
|
|
|
|
+ private final IBaseStudentService studentService;
|
|
|
|
|
|
@GetMapping(value = "/process-statistics")
|
|
@GetMapping(value = "/process-statistics")
|
|
@ApiOperation(value="流程统计")
|
|
@ApiOperation(value="流程统计")
|
|
@@ -106,4 +121,88 @@ public class DataboardController {
|
|
return RT.ok(result);
|
|
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);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|