Browse Source

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

大数据与最优化研究所 6 months ago
parent
commit
54c942d495

+ 1 - 1
src/main/java/com/xjrsoft/module/attendance/mapper/TeacherAttendanceRecordMapper.java

@@ -27,6 +27,6 @@ public interface TeacherAttendanceRecordMapper extends MPJBaseMapper<TeacherAtte
 
     List<TeacherAttendanceRecord> getLeaveList(@Param("dto") WfTeacherleave dto);
 
-    @Delete("delete from teacher_attendance_record where time_interval = #{timePeriod} and attendance_date = '#{attendanceDate}'")
+    @Delete("delete from teacher_attendance_record where time_interval = #{timePeriod} and attendance_date = #{attendanceDate}")
     Boolean deleteRecord(@Param("timePeriod") Integer timePeriod, @Param("attendanceDate") String attendanceDate);
 }

+ 3 - 1
src/main/java/com/xjrsoft/module/attendance/service/impl/AttendanceStatisticsServiceImpl.java

@@ -63,6 +63,7 @@ import java.io.IOException;
 import java.text.ParseException;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.ChronoUnit;
 import java.util.ArrayList;
@@ -194,7 +195,8 @@ public class AttendanceStatisticsServiceImpl extends MPJBaseServiceImpl<Attendan
 
             List<LocalDate> dateList2 = getDatesBetween(statistics.getStartDate(), statistics.getEndDate());
             LocalDateTime now = LocalDateTime.now();
-            if (dateList2.contains(now.toLocalDate())) {
+
+            if (dateList2.contains(now.toLocalDate()) && (statistics.getTimePeriod() == 1 && now.toLocalTime().isBefore(LocalTime.MIDNIGHT))) {
                 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
                 String sql = "DELETE FROM teacher_attendance_record WHERE attendance_date = '" + now.toLocalDate().format(dtf) + "'" +
                         " AND time_interval = " + statistics.getTimePeriod();

+ 33 - 0
src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskClassStudentServiceImpl.java

@@ -43,8 +43,10 @@ import org.springframework.transaction.annotation.Transactional;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.CompletableFuture;
 import java.util.stream.Collectors;
 
@@ -381,6 +383,37 @@ public class BandingTaskClassStudentServiceImpl extends MPJBaseServiceImpl<Bandi
     @Override
     @Transactional
     public Boolean syncStudentData(StudentReportPlan studentReportPlan) {
+        //先删除所有的
+        reportRecordMapper.deleteRecordByPlanId(studentReportPlan.getId());
+        
+        //拷贝试读报到的数据过来
+        StudentReportPlan tryReadingReportPlan = reportPlanService.getOne(
+                new QueryWrapper<StudentReportPlan>().lambda()
+                        .eq(StudentReportPlan::getCategory, 2)
+                        .eq(StudentReportPlan::getBandingTaskId, studentReportPlan.getBandingTaskId())
+        );
+
+        List<StudentReportRecord> records = reportRecordMapper.selectList(
+                new QueryWrapper<StudentReportRecord>().lambda()
+                        .eq(StudentReportRecord::getStudentReportPlanId, tryReadingReportPlan.getId())
+        );
+        Date createDate = new Date();
+        Set<Long> existInsertUserIds = new HashSet<>();
+        for (StudentReportRecord record : records) {
+            if(existInsertUserIds.contains(record.getUserId())){
+                continue;
+            }
+            record.setReportTime(null);
+            record.setModifyUserId(null);
+            record.setModifyDate(null);
+            record.setCreateDate(createDate);
+            record.setStudentReportPlanId(studentReportPlan.getId());
+            record.setId(null);
+            reportRecordMapper.insert(record);
+            existInsertUserIds.add(record.getUserId());
+        }
+
+
         List<SyncStudentDataListVo> syncStudentDataList = this.baseMapper.getSyncStudentDataList(studentReportPlan.getId());
         List<Long> newStudentIds = syncStudentDataList.stream().map(SyncStudentDataListVo::getNewStudentId).collect(Collectors.toList());
 

+ 4 - 0
src/main/java/com/xjrsoft/module/student/mapper/StudentReportRecordMapper.java

@@ -10,6 +10,7 @@ import com.xjrsoft.module.student.vo.StudentReportRecordPageVo;
 import com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo;
 import com.xjrsoft.module.student.vo.StudentReportRecordStatisticsListVo;
 import com.xjrsoft.module.student.vo.StudentReportRecordStatisticsVo;
+import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Update;
@@ -45,4 +46,7 @@ public interface StudentReportRecordMapper extends MPJBaseMapper<StudentReportRe
     @Update("update student_report_record set delete_mark = 1 where user_id = #{userId} and student_report_plan_id = #{planId}")
     Boolean deleteRecordByUserIdAndPlanId(@Param("userId") Long userId, @Param("planId") Long planId);
 
+    @Delete("delete from student_report_record where student_report_plan_id = #{planId}")
+    Boolean deleteRecordByPlanId(@Param("planId") Long planId);
+
 }

+ 2 - 2
src/main/resources/mapper/banding/BandingTaskClassStudentMapper.xml

@@ -208,8 +208,8 @@
     <select id="getSyncStudentDataList" resultType="com.xjrsoft.module.banding.vo.SyncStudentDataListVo">
         SELECT t2.id AS new_student_id,t4.class_id,t6.banding_task_class_id,t4.stduy_status FROM student_report_record t1
         INNER JOIN base_new_student t2 ON t1.user_id = t2.id
-        INNER JOIN xjr_user t3 ON t2.credential_number = t3.credential_number
-        INNER JOIN base_student_school_roll t4 ON t3.id = t4.user_id
+        INNER JOIN xjr_user t3 ON t2.credential_number = t3.credential_number AND t3.delete_mark = 0
+        INNER JOIN base_student_school_roll t4 ON t3.id = t4.user_id AND t4.delete_mark = 0
         LEFT JOIN banding_task_class t5 ON t4.class_id = t5.base_class_id
         LEFT JOIN banding_task_class_student t6 ON t2.id = t6.new_student_id AND t6.delete_mark = 0
         WHERE t1.delete_mark = 0 AND t1.student_report_plan_id = #{studentReportPlanId}