Kaynağa Gözat

数据看板

dzx 2 ay önce
ebeveyn
işleme
26fb2ed002

+ 114 - 1
src/main/java/com/xjrsoft/module/databoard/controller/DataboardController.java

@@ -14,14 +14,15 @@ import com.xjrsoft.module.courseTable.entity.CourseTable;
 import com.xjrsoft.module.courseTable.service.ICourseTableService;
 import com.xjrsoft.module.databoard.dto.StatisticsDetailDto;
 import com.xjrsoft.module.databoard.dto.StatisticsDto;
+import com.xjrsoft.module.databoard.vo.AttendanceStatisticsVo;
 import com.xjrsoft.module.databoard.vo.CourseStatisticsVo;
 import com.xjrsoft.module.databoard.vo.HealthStatisticsVo;
 import com.xjrsoft.module.databoard.vo.ItemCountAmountVo;
-import com.xjrsoft.module.databoard.vo.ItemCountVo;
 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.ReimbursementStatisticsVo;
+import com.xjrsoft.module.databoard.vo.RepairStatisticsVo;
 import com.xjrsoft.module.databoard.vo.VisitorStatisticsVo;
 import com.xjrsoft.module.outint.entity.VisitorOutInRecord;
 import com.xjrsoft.module.outint.service.IVisitorOutInRecordService;
@@ -427,4 +428,116 @@ public class DataboardController {
         return RT.ok(result);
     }
 
+    @GetMapping(value = "/repair-statistics")
+    @ApiOperation(value="维修申报")
+    @SaCheckPermission("databoard:detail")
+    public RT<RepairStatisticsVo> repairStatistics(@Valid StatisticsDetailDto dto){
+        LocalDateTime startTime = null;
+        LocalDateTime endTime = null;
+        if(dto.getStartDate() != null){
+            startTime = dto.getStartDate().atStartOfDay();
+        }
+        if(dto.getEndDate() != null){
+            endTime = dto.getEndDate().atStartOfDay().plusDays(1).plusNanos(-1);
+        }
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        RepairStatisticsVo result = new RepairStatisticsVo();
+        String sql = "SELECT * FROM wf_repair_declaration where 1 = 1";
+        if(startTime != null && endTime != null){
+            sql += " and application_time between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
+        }
+        List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(sql);
+        result.setAllCount(list.size());
+        int completeCount = 0;
+        int uncompleteCount = 0;
+        int personCount = 0;
+
+        for (Map<String, Object> objectMap : list) {
+            Object statusObj = objectMap.get("status");
+            if(statusObj == null){
+                uncompleteCount ++;
+            }else{
+                completeCount ++;
+            }
+            if(objectMap.get("status") != null && "是".equals(objectMap.get("status").toString())){
+                personCount ++;
+            }
+
+        }
+        result.setCompleteCount(completeCount);
+        result.setUncompleteCount(uncompleteCount);
+        result.setPersonCount(personCount);
+
+        sql = "SELECT ifnull(SUM(indemnity), 0) as indemnity FROM wf_repair_declaration";
+        list = SqlRunnerAdapter.db().selectList(sql);
+        result.setTotalAmount(Double.parseDouble(list.get(0).get("indemnity").toString()));
+
+        return RT.ok(result);
+    }
+
+    @GetMapping(value = "/attendance-statistics")
+    @ApiOperation(value="个人考勤")
+    @SaCheckPermission("databoard:detail")
+    public RT<AttendanceStatisticsVo> attendanceStatistics(@Valid StatisticsDetailDto dto){
+        LocalDateTime startTime = null;
+        LocalDateTime endTime = null;
+        if(dto.getStartDate() != null){
+            startTime = dto.getStartDate().atStartOfDay();
+        }
+        if(dto.getEndDate() != null){
+            endTime = dto.getEndDate().atStartOfDay().plusDays(1).plusNanos(-1);
+        }
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        AttendanceStatisticsVo result = new AttendanceStatisticsVo();
+
+        String sql = " SELECT ifnull(sum(leave_days), 0) as leave_days FROM wf_teacherleave WHERE status = 1";
+
+        if(startTime != null && endTime != null){
+            String startTimeStr = startTime.format(formatter);
+            String endTimeStr = endTime.format(formatter);
+            sql +=" AND (" +
+                " (leave_start_time BETWEEN '" + startTimeStr + "' and '" + endTimeStr + "')" +
+                " OR (leave_end_time BETWEEN '" + startTimeStr + "' and '" + endTimeStr + "')" +
+                " OR (leave_start_time > '" + startTimeStr + "' and '" + endTimeStr + "' > leave_end_time)" +
+                " OR ('" + startTimeStr + "' > leave_start_time and leave_end_time > '" + endTimeStr + "')" +
+                ")";
+        }
+        if(dto.getUserId() != null){
+            sql += " and user_id = " + dto.getUserId();
+        }
+        List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(sql);
+        result.setLeaveDays(Double.parseDouble(list.get(0).get("leave_days").toString()));
+
+        sql = "SELECT COUNT(*) AS a_count FROM teacher_out_in_record WHERE delete_mark = 0 and attendance_status = '迟到'";
+        if(startTime != null && endTime != null){
+            sql +=" AND record_time between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
+        }
+        if(dto.getUserId() != null){
+            sql += " and user_id = " + dto.getUserId();
+        }
+        list = SqlRunnerAdapter.db().selectList(sql);
+        result.setLateCount(Integer.parseInt(list.get(0).get("a_count").toString()));
+
+        sql = "select COUNT(*) AS a_count from wf_course_adjust where status = 1";
+        if(startTime != null && endTime != null){
+            sql +=" AND adjust_date between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
+        }
+        if(dto.getUserId() != null){
+            sql += " and user_id = " + dto.getUserId();
+        }
+        list = SqlRunnerAdapter.db().selectList(sql);
+        result.setAdjustCount(Integer.parseInt(list.get(0).get("a_count").toString()));
+
+        sql = "select COUNT(*) AS a_count from wf_course_adjust where status = 1";
+        if(startTime != null && endTime != null){
+            sql +=" AND exchange_date between '" + startTime.format(formatter) + "' and '" + endTime.format(formatter) + "'";
+        }
+        if(dto.getUserId() != null){
+            sql += " and user_id = " + dto.getUserId();
+        }
+        list = SqlRunnerAdapter.db().selectList(sql);
+        result.setExchangeCount(Integer.parseInt(list.get(0).get("a_count").toString()));
+        return RT.ok(result);
+    }
+
 }

+ 30 - 0
src/main/java/com/xjrsoft/module/databoard/vo/AttendanceStatisticsVo.java

@@ -0,0 +1,30 @@
+package com.xjrsoft.module.databoard.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @title: 数据看板-个人考勤统计出参
+* @Author dzx
+* @Date: 2024年9月2日
+* @Version 1.0
+*/
+@Data
+public class AttendanceStatisticsVo {
+
+
+    @ApiModelProperty("总请假天数")
+    private Double leaveDays;
+
+    @ApiModelProperty("吃到次数")
+    private Integer lateCount;
+
+    @ApiModelProperty("总课时")
+    private Integer courseCount;
+
+    @ApiModelProperty("调课次数")
+    private Integer adjustCount;
+
+    @ApiModelProperty("顶课次数")
+    private Integer exchangeCount;
+}

+ 32 - 0
src/main/java/com/xjrsoft/module/databoard/vo/RepairStatisticsVo.java

@@ -0,0 +1,32 @@
+package com.xjrsoft.module.databoard.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+* @title: 数据看板-维修申报统计出参
+* @Author dzx
+* @Date: 2024年9月2日
+* @Version 1.0
+*/
+@Data
+public class RepairStatisticsVo {
+
+
+    @ApiModelProperty("报修次数")
+    private Integer allCount;
+
+    @ApiModelProperty("已维修次数")
+    private Integer completeCount;
+
+    @ApiModelProperty("待维修次数")
+    private Integer uncompleteCount;
+
+    @ApiModelProperty("人为毁坏次数")
+    private Integer personCount;
+
+    @ApiModelProperty("赔偿总金额")
+    private Double totalAmount;
+}