소스 검색

bug修复

dzx 4 달 전
부모
커밋
522ab521bc

+ 6 - 5
src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskClassStudentServiceImpl.java

@@ -41,6 +41,7 @@ import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
@@ -160,7 +161,7 @@ public class BandingTaskClassStudentServiceImpl extends MPJBaseServiceImpl<Bandi
                 setClassroomId(taskClass.getClassroomId());
                 setTeacherId(taskClass.getTeacherId());
                 setIsGraduate(1);
-                setIsOrderClass(taskClass.getIsOrderClass().intValue());
+                setIsOrderClass(taskClass.getIsOrderClass()==null?0:taskClass.getIsOrderClass().intValue());
                 setGradeId(bandingTask.getGradeId());
                 setDeleteMark(DeleteMark.NODELETE.getCode());
                 setEnrollType(bandingTask.getEnrollType());
@@ -194,7 +195,7 @@ public class BandingTaskClassStudentServiceImpl extends MPJBaseServiceImpl<Bandi
         LocalDateTime now = LocalDateTime.now();
         Map<Long, Long> studentClassRelation = classStudents.stream().collect(Collectors.toMap(BandingTaskClassStudent::getNewStudentId, BandingTaskClassStudent::getBandingTaskClassId));
         for (BaseNewStudent student : updateList) {
-            LocalDateTime birthDate = getBirthDate(student.getCredentialNumber());
+            LocalDate birthDate = getBirthDate(student.getCredentialNumber());
             User xjrUser = new User() {{
                 setCreateDate(now);
                 setPassword(BCrypt.hashpw(propertiesConfig.getDefaultPassword(), BCrypt.gensalt()));
@@ -206,7 +207,7 @@ public class BandingTaskClassStudentServiceImpl extends MPJBaseServiceImpl<Bandi
                 setEnabledMark(EnabledMark.DISABLED.getCode());
                 setGender(student.getGender());
                 setIsChangePassword(1);
-                setBirthDate(birthDate);
+                setBirthDate(birthDate.atStartOfDay());
             }};
             userService.save(xjrUser);
 
@@ -250,13 +251,13 @@ public class BandingTaskClassStudentServiceImpl extends MPJBaseServiceImpl<Bandi
         }
     }
 
-    LocalDateTime getBirthDate(String idCardNumber){
+    LocalDate getBirthDate(String idCardNumber){
         // 获取出生日期前6位,即yyyyMM
         String birthdayString = idCardNumber.substring(6, 14);
 
         // 将字符串解析为LocalDate对象
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
-        return LocalDateTime.parse(birthdayString, formatter);
+        return LocalDate.parse(birthdayString, formatter);
     }
 
     @Override

+ 5 - 4
src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskServiceImpl.java

@@ -55,6 +55,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
@@ -504,7 +505,7 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
         LocalDateTime now = LocalDateTime.now();
         Map<Long, Long> studentClassRelation = classStudents.stream().collect(Collectors.toMap(BandingTaskClassStudent::getNewStudentId, BandingTaskClassStudent::getBandingTaskClassId));
         for (BaseNewStudent student : updateList) {
-            LocalDateTime birthDate = getBirthDate(student.getCredentialNumber());
+            LocalDate birthDate = getBirthDate(student.getCredentialNumber());
             User xjrUser = new User() {{
                 setCreateDate(now);
                 setPassword(BCrypt.hashpw(propertiesConfig.getDefaultPassword(), BCrypt.gensalt()));
@@ -516,7 +517,7 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
                 setEnabledMark(EnabledMark.DISABLED.getCode());
                 setGender(student.getGender());
                 setIsChangePassword(1);
-                setBirthDate(birthDate);
+                setBirthDate(birthDate.atStartOfDay());
             }};
             userService.save(xjrUser);
 
@@ -560,12 +561,12 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
         }
     }
 
-    LocalDateTime getBirthDate(String idCardNumber){
+    LocalDate getBirthDate(String idCardNumber){
         // 获取出生日期前6位,即yyyyMM
         String birthdayString = idCardNumber.substring(6, 14);
 
         // 将字符串解析为LocalDate对象
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
-        return LocalDateTime.parse(birthdayString, formatter);
+        return LocalDate.parse(birthdayString, formatter);
     }
 }