|
|
@@ -189,19 +189,19 @@ public class DataboardController {
|
|
|
@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.NODELETE.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 ++;
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ String sql = "SELECT * FROM reservation_school_people t1" +
|
|
|
+ " INNER JOIN reservation_school t2 ON t1.reservation_schoo_id = t2.id" +
|
|
|
+ " INNER JOIN xjr_workflow_form_relation t3 ON CAST(t2.id AS CHAR) = t3.form_key_value" +
|
|
|
+ " WHERE t3.current_state = 'COMPLETED' AND t1.delete_mark = 0 AND t1.enabled_mark = 1" +
|
|
|
+ " AND t2.delete_mark = 0 AND t2.enabled_mark = 1";
|
|
|
+ int size = SqlRunnerAdapter.db().selectList(sql).size();
|
|
|
+ result.setAllCount(size);
|
|
|
+
|
|
|
+ sql += " and now() between t2.start_time and t2.end_time";
|
|
|
+
|
|
|
+ int todayCount = SqlRunnerAdapter.db().selectList(sql).size();
|
|
|
result.setTodayCount(todayCount);
|
|
|
return RT.ok(result);
|
|
|
}
|