瀏覽代碼

Merge branch 'pre'

dzx 1 年之前
父節點
當前提交
35a997eca2

+ 1 - 0
src/main/java/com/xjrsoft/module/attendance/controller/StatisticsController.java

@@ -145,6 +145,7 @@ public class StatisticsController {
                 .disableSubLogicDel()
                 .distinct()
                 .eq(ObjectUtil.isNotNull(dto.getGradeId()), BaseStudentSchoolRoll::getGradeId, dto.getGradeId())
+                .eq(BaseStudentSchoolRoll::getArchivesStatus, "FB2901")
                 .eq(ObjectUtil.isNotNull(dto.getClassId()), BaseStudentSchoolRoll::getClassId, dto.getClassId())
                 .innerJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, XjrUser::getId)
                 .innerJoin(BaseStudent.class, BaseStudent::getUserId, XjrUser::getId);

+ 13 - 2
src/main/java/com/xjrsoft/module/attendance/controller/StudentStatisticsController.java

@@ -17,6 +17,8 @@ import com.xjrsoft.module.attendance.vo.ClassStatisticsVo;
 import com.xjrsoft.module.attendance.vo.StudentStatisticsPageVo;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.base.service.IBaseClassService;
+import com.xjrsoft.module.holiday.entity.HolidayDate;
+import com.xjrsoft.module.holiday.service.IHolidayDateService;
 import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.service.IUserService;
 import com.xjrsoft.module.outint.entity.StudentOutInRecord;
@@ -65,6 +67,7 @@ public class StudentStatisticsController {
     private final IStudentOutInRecordService studentOutInRecordService;
     private final IStudentLeaveService studentLeaveService;
     private final IBaseClassService classService;
+    private final IHolidayDateService holidayDateService;
 
     @GetMapping(value = "/class-statistics")
     @ApiOperation(value="班级考勤统计")
@@ -78,6 +81,15 @@ public class StudentStatisticsController {
         if(dto.getDate() != null && !"".equals(dto.getDate())){
             DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE;
             LocalDate queryDate = LocalDate.parse(dto.getDate(), formatter);
+
+            HolidayDate holidayDate = holidayDateService.getOne(
+                    new QueryWrapper<HolidayDate>().lambda()
+                            .eq(HolidayDate::getDate, queryDate)
+            );
+            if(holidayDate != null && holidayDate.getWay() != null && holidayDate.getWay() != 0){
+                return RT.ok(ConventPage.getPageOutput(attendancePage, ClassStatisticsVo.class));
+            }
+
             LocalDateTime startTime, endTime;
 
 
@@ -94,8 +106,6 @@ public class StudentStatisticsController {
                 startTime = queryDate.atTime(0, 0, 0);
                 endTime = queryDate.atTime(23, 59, 59);
             }
-            LocalDateTime lastSundayStart = startTime.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)).plusDays(-1);
-            LocalDateTime lastSundayEnd = endTime.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)).plusDays(-1);
 
             //查询每个班的走读生实到人数
             Map<Long, List<StudentOutInRecordVo>> notStayMap = studentOutInRecordService.getList(startTime, endTime, classIds);
@@ -237,6 +247,7 @@ public class StudentStatisticsController {
             LocalDateTime startTime = LocalDate.parse(dto.getStartTime(), formatter).atTime(0, 0, 0);
             LocalDateTime endTime = LocalDate.parse(dto.getEndTime(), formatter).atTime(23, 59, 59);
 
+
             //查询每个班的走读生实到人数
             Map<Long, List<StudentOutInRecordVo>> notStayMap = studentOutInRecordService.getNotStayList(startTime, endTime, classIds);
             //查询住校生的实到情况

+ 13 - 0
src/main/java/com/xjrsoft/module/attendance/controller/TeacherStatisticsController.java

@@ -10,7 +10,10 @@ import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.module.attendance.dto.TeacherDetailsDto;
+import com.xjrsoft.module.attendance.vo.ClassStatisticsVo;
 import com.xjrsoft.module.attendance.vo.TeacherStatisticsPageVo;
+import com.xjrsoft.module.holiday.entity.HolidayDate;
+import com.xjrsoft.module.holiday.service.IHolidayDateService;
 import com.xjrsoft.module.organization.entity.Department;
 import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.entity.UserDeptRelation;
@@ -51,6 +54,7 @@ public class TeacherStatisticsController {
     private final IUserService xjrUserService;
     private final ITeacherOutInRecordService teacherOutInRecordService;
     private final IWfTeacherleaveService wfTeacherleaveService;
+    private final IHolidayDateService holidayDateService;
 
 
     @GetMapping(value = "/teacher-details")
@@ -73,6 +77,15 @@ public class TeacherStatisticsController {
         if(dto.getDate() != null && !"".equals(dto.getDate())){
             DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE;
             LocalDate queryDate = LocalDate.parse(dto.getDate(), formatter);
+
+            HolidayDate holidayDate = holidayDateService.getOne(
+                    new QueryWrapper<HolidayDate>().lambda()
+                            .eq(HolidayDate::getDate, queryDate)
+            );
+            if(holidayDate != null && holidayDate.getWay() != null && holidayDate.getWay() != 0){
+                return RT.ok(ConventPage.getPageOutput(voIPage, TeacherStatisticsPageVo.class));
+            }
+
             LocalDateTime startTime, endTime;
 
             if(dto.getTimePeriod() == 1){

+ 31 - 9
src/main/java/com/xjrsoft/module/hikvision/util/OutInRecordUtil.java

@@ -11,7 +11,9 @@ import com.xjrsoft.module.teacher.mapper.FaceImportMapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.sql.PreparedStatement;
 import java.sql.SQLException;
+import java.sql.Types;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
@@ -59,10 +61,29 @@ public class OutInRecordUtil {
 
         String sql = "INSERT INTO car_out_in_record(create_date, car_message_apply_id, record_time, face_photo, status,release_reason, plan_no, " +
                 "cross_record_syscode, release_result, release_way, vehicle_type, phone, name, category,delete_mark,enabled_mark) " +
-                "VALUES(now(), '"  + carMessageApplyId + "', '" +
-                recordTime + "', '" + photoValue + "', '" + status + "', '" + releaseReason + "', '" + planNo + "', '" +
-                crossRecordSyscode + "', '" + releaseResult + "', '" + releaseWay + "', '" + vehicleType + "', '" + phoneValue + "', '" + nameValue + "', '" + category  +  "',0,1)";
-        db.execute(sql);
+                "VALUES(now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, 1)";
+
+        try (PreparedStatement pstmt = db.getConnection().prepareStatement(sql)) {
+            if (carMessageApplyId != 0) {
+                pstmt.setLong(1, carMessageApplyId);
+            } else {
+                pstmt.setNull(1, Types.BIGINT);
+            }
+            pstmt.setString(2, recordTime);
+            pstmt.setString(3, photoValue);
+            pstmt.setInt(4, status);
+            pstmt.setInt(5, releaseReason);
+            pstmt.setString(6, planNo);
+            pstmt.setString(7, crossRecordSyscode);
+            pstmt.setInt(8, releaseResult);
+            pstmt.setInt(9, releaseWay);
+            pstmt.setInt(10, vehicleType);
+            pstmt.setString(11, phoneValue);
+            pstmt.setString(12, nameValue);
+            pstmt.setInt(13, category);
+
+            pstmt.executeUpdate();
+        }
     }
 
     public void GetTeacherAndStudentRecords(Db use, FaceImportMapper faceImportMapper) throws SQLException, ParseException {
@@ -84,7 +105,7 @@ public class OutInRecordUtil {
 
             JsonObject responseJson = new Gson().fromJson(response, JsonObject.class);
             int totalCount = responseJson.getAsJsonObject("data").get("totalPage").getAsInt();
-            hasMorePages = pageNo.getAndIncrement() * pageSize < totalCount;
+            hasMorePages = pageNo.getAndIncrement() < totalCount;
         }
         // Process the records
         InsertTeacherStudentRecords(use, responseBuilder, faceImportMapper);
@@ -305,7 +326,7 @@ public class OutInRecordUtil {
 
             JsonObject responseJson = new Gson().fromJson(response, JsonObject.class);
             int totalCount = responseJson.getAsJsonObject("data").get("total").getAsInt();
-            hasMorePages = pageNo.getAndIncrement() * pageSize < totalCount;
+            hasMorePages = pageNo.getAndIncrement() < totalCount;
         }
 
         InsertVisitRecords(use, responseBuilder,responseDoorBuilder,faceImportMapper);
@@ -378,7 +399,7 @@ public class OutInRecordUtil {
             JsonObject item = element.getAsJsonObject();
 
             String carMessageApplyIdStr = faceImportMapper.GetCarMessageApplyIdByCarNumber(item.get("plateNo").getAsString().trim());
-            Long carId = (carMessageApplyIdStr == null || carMessageApplyIdStr.isEmpty()) ? null : Long.parseLong(carMessageApplyIdStr);
+            Long carId = (carMessageApplyIdStr == null || carMessageApplyIdStr.isEmpty()) ? 0 : Long.parseLong(carMessageApplyIdStr);
             String category = null;
             int categoryInt = 0;
             if (item.has("carCategory")){
@@ -431,7 +452,6 @@ public class OutInRecordUtil {
             } else {
                 facePicUri = ApiUtil.GetRedirectURL(facePicUriElement.getAsString());
             }
-            System.out.println(facePicUri + "haha");
 
             String phone = faceImportMapper.GetPhoneNumberByPlanNum(plateNo);
             String name = faceImportMapper.GetNameByPlanNum(plateNo);
@@ -449,6 +469,8 @@ public class OutInRecordUtil {
         JsonObject paramJson = new JsonObject();
         paramJson.addProperty("pageNo", pageNo.get());
         paramJson.addProperty("pageSize", pageSize);
+        paramJson.addProperty("startTime", "2024-06-01T00:00:00Z");
+        paramJson.addProperty("endTime", "2024-06-12T00:00:00Z");
 
         return apiUtil.doPost(apiPath, String.valueOf(paramJson), null);
     }
@@ -537,7 +559,7 @@ public class OutInRecordUtil {
                     String carNum = dataObject.get("plateNo").getAsString().trim();
                     String eventIndex = dataObject.get("eventIndex").getAsString().trim();
                     String carMessageApplyIdStr = faceImportMapper.GetCarMessageApplyIdByCarNumber(carNum);
-                    Long carId = (carMessageApplyIdStr == null || carMessageApplyIdStr.isEmpty()) ? null : Long.parseLong(carMessageApplyIdStr);
+                    Long carId = (carMessageApplyIdStr == null || carMessageApplyIdStr.isEmpty()) ? 0 : Long.parseLong(carMessageApplyIdStr);
                     String eventTime = ChangeTime(dataObject.get("time").getAsString());
 
                     int releaseWayInt = -1;