소스 검색

Merge remote-tracking branch 'origin/dev' into dev

大数据与最优化研究所 5 달 전
부모
커밋
5f3f851726

+ 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){

+ 78 - 46
src/main/java/com/xjrsoft/module/hikvision/util/OutInRecordUtil.java

@@ -5,12 +5,15 @@ import com.google.gson.Gson;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
+import com.microsoft.schemas.office.office.BulletAttribute;
 import com.xjrsoft.module.attendance.entity.AttendanceRuleDetails;
 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;
@@ -25,17 +28,20 @@ public class OutInRecordUtil {
     private static final Logger log = LoggerFactory.getLogger(OutInRecordUtil.class);
 
     private void teacherInsertRecord(Db db, Long userId, String recordTime, String facePhoto, int status, String eventId, String attendanceStatus) throws SQLException {
+        String photoValue = (facePhoto != null && !facePhoto.equals("null")) ? facePhoto : "";
 
         String sql = "INSERT INTO teacher_out_in_record(create_date, user_id, record_time, face_photo, eventId, status,delete_mark,enabled_mark, attendance_status) " +
                 "VALUES(now(), '"  + userId + "', '" + recordTime + "', '" +
-                facePhoto + "', '" + eventId + "', '" +status + "',0,1,'" + attendanceStatus + "')";
+                photoValue + "', '" + eventId + "', '" +status + "',0,1,'" + attendanceStatus + "')";
         db.execute(sql);
     }
 
     private void studentInsertRecord(Db db, Long userId, Long teacherId, Long classId, String facePhoto, String recordTime, int status, String eventId, String attendanceStatus) throws SQLException {
+        String photoValue = (facePhoto != null && !facePhoto.equals("null")) ? facePhoto : "";
+
         String sql = "INSERT INTO student_out_in_record(create_date, user_id, teacher_id, class_id, face_photo, record_time , eventId,status,delete_mark,enabled_mark, attendance_status) " +
                 "VALUES(now(), '" + userId + "', '" + teacherId + "', '" +
-                classId + "', '" + facePhoto + "', '" + recordTime + "', '" + eventId + "', '" + status + "',0,1,'" + attendanceStatus + "')";
+                classId + "', '" + photoValue + "', '" + recordTime + "', '" + eventId + "', '" + status + "',0,1,'" + attendanceStatus + "')";
         db.execute(sql);
     }
 
@@ -49,12 +55,35 @@ public class OutInRecordUtil {
 
     private void vehicleInsertRecord(Db db, Long carMessageApplyId, String recordTime, int releaseReason, int category, String facePhoto, int status, String planNo, String crossRecordSyscode,
                                      int releaseResult, int releaseWay, int vehicleType, String phone, String name) throws SQLException {
+        String phoneValue = (phone != null && !phone.equals("null")) ? phone : "";
+        String nameValue = (name != null && !name.equals("null")) ? name : "";
+        String photoValue = (facePhoto != null && !facePhoto.equals("null")) ? facePhoto : "";
+
         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 + "', '" + facePhoto + "', '" + status + "', '" + releaseReason + "', '" + planNo + "', '" +
-                crossRecordSyscode + "', '" + releaseResult + "', '" + releaseWay + "', '" + vehicleType + "', '" + phone + "', '" + name + "', '" + 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 {
@@ -76,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);
@@ -97,7 +126,17 @@ public class OutInRecordUtil {
             }
             if (personId == null) continue;
 
-            int status = item.get("inAndOutType").getAsInt();
+            int statusInt = item.get("inAndOutType").getAsInt();
+            int status = -1;
+            switch (statusInt){
+                case 0:
+                    status = 1;
+                    break;
+                case 1:
+                    status = 0;
+                    break;
+            }
+
             String uri = item.get("picUri").isJsonNull() ? null : item.get("picUri").getAsString();
             String recordTime = item.get("eventTime").isJsonNull() ? null : item.get("eventTime").getAsString();
             String eventId = item.get("eventId").isJsonNull() ? null : item.get("eventId").getAsString();
@@ -118,7 +157,7 @@ public class OutInRecordUtil {
                 LocalDateTime recordTimeDate = LocalDateTime.parse(recordTimeStr, formatter);
                 String attendanceStatus = discernStudentStatus(use, recordTimeDate, status, personId);
                 studentInsertRecord(use, personId, faceImportMapper.GetTeacherIdByPersonId(personId),
-                        faceImportMapper.GetClassIdByPersonId(personId), ApiUtil.GetRedirectURL(uri), recordTimeStr, status,eventId, attendanceStatus);
+                        faceImportMapper.GetClassIdByPersonId(personId), ApiUtil.GetRedirectURL(uri), recordTimeStr, status, eventId, attendanceStatus);
             }
         }
     }
@@ -178,7 +217,6 @@ public class OutInRecordUtil {
         return attendanceStatus;
     }
 
-
     String discernStudentStatus(Db use, LocalDateTime recordTime, int status, Long studentUserId) throws SQLException {
         String attendanceStatus = "";
         String dayOfWeek = recordTime.getDayOfWeek().name();
@@ -288,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);
@@ -414,19 +452,9 @@ public class OutInRecordUtil {
             } else {
                 facePicUri = ApiUtil.GetRedirectURL(facePicUriElement.getAsString());
             }
-            System.out.println(facePicUri + "haha");
 
             String phone = faceImportMapper.GetPhoneNumberByPlanNum(plateNo);
-            if (phone == null){
-                phone = faceImportMapper.GetPhoneNumberByPlanNumView(plateNo);
-                if (phone == null) phone = "";
-            }
-
             String name = faceImportMapper.GetNameByPlanNum(plateNo);
-            if (name == null){
-                name = faceImportMapper.GetNameByPlanNumView(plateNo);
-                if (name == null) name = "";
-            }
 
             if(vehicle_id_list.contains(crossRecordSyscode)) continue;
 
@@ -441,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);
     }
@@ -467,11 +497,23 @@ public class OutInRecordUtil {
 
                 String idNum = null;
                 if (dataObject.has("ExtEventPersonNo")) {
-                    idNum = dataObject.get("ExtEventPersonNo").getAsString();
+                    String idNumStr = dataObject.get("ExtEventPersonNo").getAsString();
+                    if (!idNumStr.isEmpty()) {
+                        idNum = idNumStr;
+                    }
                 }
                 String happenTime = eventObject.get("happenTime").getAsString();
                 String extEventPictureURL = dataObject.get("ExtEventPictureURL").getAsString();
-                int status = eventObject.get("status").getAsInt();
+                int statusInt = dataObject.get("ExtEventInOut").getAsInt();
+                int status = -1;
+                switch (statusInt){
+                    case 0:
+                        status = 1;
+                        break;
+                    case 1:
+                        status = 0;
+                        break;
+                }
                 String eventId = eventObject.get("eventId").getAsString();
                 String recordTimeStr = ChangeTime(happenTime);
 
@@ -520,13 +562,15 @@ public class OutInRecordUtil {
                     Long carId = (carMessageApplyIdStr == null || carMessageApplyIdStr.isEmpty()) ? 0 : Long.parseLong(carMessageApplyIdStr);
                     String eventTime = ChangeTime(dataObject.get("time").getAsString());
 
-                    int releaseWayInt = 0;
-                    int releaseReasonInt = 0;
-                    int releaseResultInt = 0;
+                    int releaseWayInt = -1;
+                    int releaseReasonInt = -1;
+                    int releaseResultInt = -1;
                     JsonObject inResultObject = dataObject.getAsJsonObject("inResult");
-                    if (inResultObject != null) {
-                        JsonObject rlsResultObject = inResultObject.getAsJsonObject("rlsResult");
-                        if (rlsResultObject != null && rlsResultObject.has("releaseWay") && rlsResultObject.has("releaseReason") && rlsResultObject.has("releaseResult")) {
+                    JsonObject outResultObject = dataObject.getAsJsonObject("outResult");
+                    JsonObject inoutResult = (inResultObject != null && !inResultObject.isJsonNull()) ? inResultObject : outResultObject;
+                    if (inoutResult != null) {
+                        JsonObject rlsResultObject = inoutResult.getAsJsonObject("rlsResult");
+                        if (rlsResultObject.has("releaseWay") && rlsResultObject.has("releaseReason") && rlsResultObject.has("releaseResult")) {
                             releaseWayInt = rlsResultObject.get("releaseWay").getAsInt();
                             releaseReasonInt = rlsResultObject.get("releaseReason").getAsInt();
                             releaseResultInt = rlsResultObject.get("releaseResult").getAsInt();
@@ -551,28 +595,16 @@ public class OutInRecordUtil {
                         facePicUri = picUrlObject.get("vehiclePicUrl").getAsString();
                     }
 
-                    int status = eventObject.get("status").getAsInt();
+                    String statusStr = dataObject.get("roadwayName").getAsString();
                     int statusInt = 0;
-                    switch (status){
-                        case 0:
-                            statusInt = 1;
-                            break;
-                        case 1:
-                            statusInt = 0;
-                            break;
+                    if (statusStr.contains("入")) {
+                        statusInt = 0;
+                    } else if (statusStr.contains("出")) {
+                        statusInt = 1;
                     }
 
                     String phone = faceImportMapper.GetPhoneNumberByPlanNum(carNum);
-                    if (phone == null){
-                        phone = faceImportMapper.GetPhoneNumberByPlanNumView(carNum);
-                        if (phone == null) phone = "";
-                    }
-
                     String name = faceImportMapper.GetNameByPlanNum(carNum);
-                    if (name == null){
-                        name = faceImportMapper.GetNameByPlanNumView(carNum);
-                        if (name == null) name = "";
-                    }
 
                     if (vehicle_id_list.contains(eventIndex)) continue;
 

+ 22 - 10
src/main/java/com/xjrsoft/module/job/AttenDanceWarnNoticeTask.java

@@ -14,7 +14,6 @@ import com.xjrsoft.module.organization.service.IWeChatService;
 import com.xjrsoft.module.system.entity.WechatMessageLog;
 import com.xjrsoft.module.system.service.IWechatMessageLogService;
 import com.xjrsoft.module.teacher.entity.XjrUser;
-import com.yomahub.liteflow.util.JsonUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -24,6 +23,7 @@ import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.ChronoUnit;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -94,7 +94,10 @@ public class AttenDanceWarnNoticeTask {
             log.info("未能查询出规则,不进行推送");
             return;
         }
-        List<WechatMessageLog> logList = new ArrayList<>();
+        String wechatTemplate = weChatUtil.getAttenDanceWarnTemplate();
+        WechatMessageLog messageLog = new WechatMessageLog();
+        messageLog.setTemplateId(wechatTemplate);
+//        messageLog.setSendTime(recentlyTime);
 
         List<XjrUser> userList = getUserList(allTodyRule.keySet());
         for (XjrUser xjrUser : userList) {
@@ -106,26 +109,35 @@ public class AttenDanceWarnNoticeTask {
 
             WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
             weChatSendMessageDto.setUserId(xjrUser.getOpenId());
-            weChatSendMessageDto.setTemplateId(weChatUtil.getAttenDanceWarnTemplate());
+            weChatSendMessageDto.setTemplateId(wechatTemplate);
             weChatSendMessageDto.setMsgId(xjrUser.getId().toString());
             JSONObject paramJson = new JSONObject();
 
-            paramJson.put("thing8", xjrUser.getName());
-            paramJson.put("time9", timeStr);
+            JSONObject thing8 = new JSONObject();
+            thing8.put("value", xjrUser.getName());
+            paramJson.put("thing8", thing8);
+
+            JSONObject time9 = new JSONObject();
+            time9.put("value", timeStr);
+            paramJson.put("time9", time9);
+
+            JSONObject const12 = new JSONObject();
             if(status == 1){
-                paramJson.put("const12", "进校");
+                const12.put("value", "进校");
             }else{
-                paramJson.put("const12", "出校");
+                const12.put("value", "出校");
             }
+            paramJson.put("const12", const12);
 
             weChatSendMessageDto.setContent(paramJson);
             weChatService.sendTemplateMessage(weChatSendMessageDto);
 
         }
 
-        if(!logList.isEmpty()){
-            wechatMessageLogService.saveBatch(logList);
-        }
+        messageLog.setCreateDate(new Date());
+        messageLog.setContent("消息推送人数:" + userList.size());
+        wechatMessageLogService.save(messageLog);
+
     }
 
     /**

+ 11 - 20
src/main/java/com/xjrsoft/module/job/AttendanceMessageTask.java

@@ -41,6 +41,7 @@ import java.time.format.DateTimeFormatter;
 import java.time.temporal.ChronoUnit;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -143,7 +144,7 @@ public class AttendanceMessageTask {
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         String format = recentlyTime.format(formatter);
 
-
+        int userCount = 0;
 
         for (AttendanceMessageSet messageSet : list) {
             if(!messageSet.getTimePeriod().contains(timePeriod + "")){
@@ -163,6 +164,7 @@ public class AttendanceMessageTask {
             if(userList.isEmpty()){
                 continue;
             }
+            userCount += userList.size();
             if(messageSet.getRoleType() != null && messageSet.getRoleType() == 2){
                 //教师总人数
                 long teacherCout = userService.count(
@@ -176,12 +178,6 @@ public class AttendanceMessageTask {
                                 .eq(TeacherOutInRecord::getStatus, 1)
                 );
 
-                //计算出勤率
-                BigDecimal divide = BigDecimal.ZERO;
-                if(teacherCout != 0){
-                    divide = BigDecimal.valueOf(outInRecords).divide(BigDecimal.valueOf(teacherCout), 4, RoundingMode.HALF_UP);
-                }
-
                 WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
                 weChatSendMessageDto.setTemplateId(wechatTemplate);
                 JSONObject paramJson = new JSONObject();
@@ -202,9 +198,9 @@ public class AttendanceMessageTask {
                 character_string18.put("value", teacherCout - outInRecords);
                 paramJson.put("character_string18", character_string18);
 
-                JSONObject const3 = new JSONObject();
-                const3.put("value", "出勤率 " + (divide.doubleValue() * 100) + "%");
-                paramJson.put("const3", const3);
+                JSONObject character_string16 = new JSONObject();
+                character_string16.put("value", teacherCout);
+                paramJson.put("character_string16", character_string16);
 
                 weChatSendMessageDto.setContent(paramJson);
                 weChatSendMessageDto.setUrl(StrUtil.format("{}pages/attendance/teacher/index", commonPropertiesConfig.getDomainApp()));
@@ -227,13 +223,6 @@ public class AttendanceMessageTask {
                                 .eq(StudentOutInRecord::getStatus, 1)
                 );
 
-                //计算出勤率
-                BigDecimal divide = BigDecimal.ZERO;
-                if(teacherCout != 0){
-                    divide = BigDecimal.valueOf(outInRecords).divide(BigDecimal.valueOf(teacherCout), 4, RoundingMode.HALF_UP);
-                }
-
-
                 WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
                 weChatSendMessageDto.setTemplateId(weChatUtil.getAttendanceMessageTemplate());
                 JSONObject paramJson = new JSONObject();
@@ -254,9 +243,9 @@ public class AttendanceMessageTask {
                 character_string18.put("value", teacherCout - outInRecords);
                 paramJson.put("character_string18", character_string18);
 
-                JSONObject const3 = new JSONObject();
-                const3.put("value", "出勤率 " + (divide.doubleValue() * 100) + "%");
-                paramJson.put("const3", const3);
+                JSONObject character_string16 = new JSONObject();
+                character_string16.put("value", teacherCout);
+                paramJson.put("const3", character_string16);
 
                 weChatSendMessageDto.setContent(paramJson);
                 weChatSendMessageDto.setUrl(StrUtil.format("{}pages/attendance/class/index", commonPropertiesConfig.getDomainApp()));
@@ -268,6 +257,8 @@ public class AttendanceMessageTask {
                 }
             }
         }
+        messageLog.setCreateDate(new Date());
+        messageLog.setContent("消息推送人数:" + userCount);
         wechatMessageLogService.save(messageLog);
     }
 

+ 1 - 1
src/main/java/com/xjrsoft/module/student/controller/ConsumptionController.java

@@ -196,7 +196,7 @@ public class ConsumptionController {
         return RT.ok(pbVXsxxsfytbService.feeitemStat(dto));
     }
 
-    @GetMapping(value = "/class-qf-export-query")
+    @PostMapping(value = "/class-qf-export-query")
     @ApiOperation(value="班级欠费排序-导出")
     @SaCheckPermission("consumption:detail")
     public ResponseEntity<byte[]> classQfExpert(@Valid @RequestBody PbVXsxxsfytbStatDto dto){

+ 0 - 3
src/main/java/com/xjrsoft/module/teacher/mapper/FaceImportMapper.java

@@ -32,9 +32,6 @@ public interface FaceImportMapper {
     String GetPhoneNumberByPlanNum(@Param("id") String id);
     String GetNameByPlanNum(@Param("id") String id);
 
-    String GetPhoneNumberByPlanNumView(@Param("id") String id);
-    String GetNameByPlanNumView(@Param("id") String id);
-
     List<String> GetVisitIdList();
 }
 

+ 1 - 1
src/main/resources/application-dev.yml

@@ -137,7 +137,7 @@ xjrsoft:
   weChatMessageTemplate:
     commonTemplate: qmpXORPM1Cocqn503Qa4OkNNQ0uxlj2-ed9m6uWO-v4
     assessmentTemplate: ehYfXni7exZUmt6dJX4Ukbm9ETarFfKLfXVYwNnjKMc
-    attendanceMessageTemplate: uPPJkWOSronnB_GJolcnatrQzGjJREIKL7JZzOieoew
+    attendanceMessageTemplate: uPPJkWOSronnB_GJolcnajRSdnIf8GCoCk4c0v1szPA
     outInTemplate: ERkMebHjsziZO6WBrlzsbENiEuRR4vrlhJw5LR4aDr8
     attenDanceWarnTemplate: Fg4AWVQRGernl0PiJQ8gRgCUFHEGZuizlClQNuVhqu4
   dingtalk:

+ 1 - 1
src/main/resources/application-prod.yml

@@ -114,7 +114,7 @@ xjrsoft:
   weChatMessageTemplate:
     commonTemplate: qmpXORPM1Cocqn503Qa4OkNNQ0uxlj2-ed9m6uWO-v4
     assessmentTemplate: ehYfXni7exZUmt6dJX4Ukbm9ETarFfKLfXVYwNnjKMc
-    attendanceMessageTemplate: uPPJkWOSronnB_GJolcnatrQzGjJREIKL7JZzOieoew
+    attendanceMessageTemplate: uPPJkWOSronnB_GJolcnajRSdnIf8GCoCk4c0v1szPA
     outInTemplate: ERkMebHjsziZO6WBrlzsbENiEuRR4vrlhJw5LR4aDr8
     attenDanceWarnTemplate: Fg4AWVQRGernl0PiJQ8gRgCUFHEGZuizlClQNuVhqu4
   appletWeChat:

+ 6 - 26
src/main/resources/mapper/teacher/TeacherFaceImportMapper.xml

@@ -125,38 +125,18 @@
     </select>
 
     <select id="GetPhoneNumberByPlanNum" resultType="java.lang.String">
-        SELECT c_phone
-        FROM base_car_management
-        where delete_mark = 0
+        SELECT 手机号
+        FROM car_info
         <if test="id != null">
-            and car_no = #{id}
+            where 车牌号码 = #{id}
         </if>
     </select>
 
     <select id="GetNameByPlanNum" resultType="java.lang.String">
-        SELECT c_name
-        FROM base_car_management
-        where delete_mark = 0
-        <if test="id != null">
-            and car_no = #{id}
-        </if>
-    </select>
-
-    <select id="GetPhoneNumberByPlanNumView" resultType="java.lang.String">
-        SELECT phone
-        FROM reservation_school_people
-        where delete_mark = 0
-        <if test="id != null">
-            and plate_number = #{id}
-        </if>
-    </select>
-
-    <select id="GetNameByPlanNumView" resultType="java.lang.String">
-        SELECT name
-        FROM reservation_school_people
-        where delete_mark = 0
+        SELECT 车主姓名
+        FROM car_info
         <if test="id != null">
-            and plate_number = #{id}
+            where 车牌号码 = #{id}
         </if>
     </select>
 

+ 51 - 22
src/test/java/com/xjrsoft/module/job/AttendanceMessageTaskTest.java

@@ -86,6 +86,48 @@ class AttendanceMessageTaskTest {
     private IWechatMessageLogService wechatMessageLogService;
 
 
+    @Test
+    void test2(){
+        String  wechatTemplate = "o-KboOcqcJ3YpjPN2xwgM_NcjN-0yzwWlDDXYfTM0Q4";
+        WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
+        weChatSendMessageDto.setTemplateId(wechatTemplate);
+        JSONObject paramJson = new JSONObject();
+
+        JSONObject thing6 = new JSONObject();
+        thing6.put("value", "教职工");
+        paramJson.put("thing6", thing6);
+
+        JSONObject time11 = new JSONObject();
+        time11.put("value", "2024-6-12 11:02:30");
+        paramJson.put("time11", time11);
+
+        JSONObject const23 = new JSONObject();
+        const23.put("value", "上午考勤");
+        paramJson.put("const23", const23);
+
+        JSONObject character_string18 = new JSONObject();
+        character_string18.put("value", "222");
+        paramJson.put("character_string18", character_string18);
+
+        JSONObject const3 = new JSONObject();
+        const3.put("value", "出勤率 99%");
+        paramJson.put("const3", const3);
+
+        weChatSendMessageDto.setContent(paramJson);
+        weChatSendMessageDto.setUrl(StrUtil.format("{}pages/attendance/teacher/index", commonPropertiesConfig.getDomainApp()));
+
+        List<String> userList = new ArrayList<>();
+        userList.add("oWZy-wec72H78ApagVBFomC5TNyw");
+        userList.add("oWZy-wUTki8Vi7ao3Wn5JGNDauVI");
+        for (String xjrUser : userList) {
+            weChatSendMessageDto.setMsgId(xjrUser);
+            weChatSendMessageDto.setUserId(xjrUser);
+            weChatService.sendTemplateMessage(weChatSendMessageDto);
+        }
+
+
+    }
+
     @Test
     void test(){
         doExecute();
@@ -111,9 +153,9 @@ class AttendanceMessageTaskTest {
                         .eq(WechatMessageLog::getSendTime, recentlyTime)
                         .eq(WechatMessageLog::getTemplateId, wechatTemplate)
         );
-        if(log != null){//已经推送过,不再进行推送
-            return;
-        }
+//        if(log != null){//已经推送过,不再进行推送
+//            return;
+//        }
 
         WechatMessageLog messageLog = new WechatMessageLog();
         messageLog.setTemplateId(wechatTemplate);
@@ -172,12 +214,6 @@ class AttendanceMessageTaskTest {
                                 .eq(TeacherOutInRecord::getStatus, 1)
                 );
 
-                //计算出勤率
-                BigDecimal divide = BigDecimal.ZERO;
-                if(teacherCout != 0){
-                    divide = BigDecimal.valueOf(outInRecords).divide(BigDecimal.valueOf(teacherCout), 4, RoundingMode.HALF_UP);
-                }
-
                 WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
                 weChatSendMessageDto.setTemplateId(wechatTemplate);
                 JSONObject paramJson = new JSONObject();
@@ -198,9 +234,9 @@ class AttendanceMessageTaskTest {
                 character_string18.put("value", teacherCout - outInRecords);
                 paramJson.put("character_string18", character_string18);
 
-                JSONObject const3 = new JSONObject();
-                const3.put("value", "出勤率  99%");
-                paramJson.put("const3", const3);
+                JSONObject character_string16 = new JSONObject();
+                character_string16.put("value", teacherCout);
+                paramJson.put("character_string16", character_string16);
 
                 weChatSendMessageDto.setContent(paramJson);
                 weChatSendMessageDto.setUrl(StrUtil.format("{}pages/attendance/teacher/index", commonPropertiesConfig.getDomainApp()));
@@ -223,13 +259,6 @@ class AttendanceMessageTaskTest {
                                 .eq(StudentOutInRecord::getStatus, 1)
                 );
 
-                //计算出勤率
-                BigDecimal divide = BigDecimal.ZERO;
-                if(teacherCout != 0){
-                    divide = BigDecimal.valueOf(outInRecords).divide(BigDecimal.valueOf(teacherCout), 4, RoundingMode.HALF_UP);
-                }
-
-
                 WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
                 weChatSendMessageDto.setTemplateId(weChatUtil.getAttendanceMessageTemplate());
                 JSONObject paramJson = new JSONObject();
@@ -250,9 +279,9 @@ class AttendanceMessageTaskTest {
                 character_string18.put("value", teacherCout - outInRecords);
                 paramJson.put("character_string18", character_string18);
 
-                JSONObject const3 = new JSONObject();
-                const3.put("value", "出勤率  99%");
-                paramJson.put("const3", const3);
+                JSONObject character_string16 = new JSONObject();
+                character_string16.put("value", teacherCout);
+                paramJson.put("const3", character_string16);
 
                 weChatSendMessageDto.setContent(paramJson);
                 weChatSendMessageDto.setUrl(StrUtil.format("{}pages/attendance/class/index", commonPropertiesConfig.getDomainApp()));

+ 2 - 1
src/test/java/com/xjrsoft/module/job/HikvisionBaseDataTaskTest.java

@@ -104,7 +104,8 @@ class HikvisionBaseDataTaskTest {
 //        String carTableName = "car_message_apply";
 //        selectCar(use, carTableName);
 
-        outInRecordUtil.GetVisitRecord(use,faceImportMapper);
+//        outInRecordUtil.GetVehicleRecord(use,faceImportMapper);
+        outInRecordUtil.GetTeacherAndStudentRecords(use,faceImportMapper);
 ////        selecAllPersonById(use);
 //        selectResource(use);
     }