瀏覽代碼

ignore_files

Joburgess 5 年之前
父節點
當前提交
f5e83a5afa

+ 5 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExtracurricularExercisesServiceImpl.java

@@ -54,12 +54,14 @@ public class ExtracurricularExercisesServiceImpl extends BaseServiceImpl<Long, E
 		if(StringUtils.isBlank(exercises.getContent())){
 		if(StringUtils.isBlank(exercises.getContent())){
 			throw new BizException("请填写内容");
 			throw new BizException("请填写内容");
 		}
 		}
-		if(Objects.isNull(exercises.getExpireDate())){
-			throw new BizException("请指定截至日期");
-		}
 		if(StringUtils.isBlank(exercises.getStudentIdList())){
 		if(StringUtils.isBlank(exercises.getStudentIdList())){
 			throw new BizException("请指定学生");
 			throw new BizException("请指定学生");
 		}
 		}
+		if(Objects.isNull(exercises.getExpireDate())){
+			LocalDateTime localDateTime=LocalDateTime.now();
+			localDateTime=localDateTime.plusDays(2).withHour(21).withMinute(0).withSecond(0);
+			exercises.setExpireDate(Date.from(localDateTime.atZone(DateUtil.zoneId).toInstant()));
+		}
 		List<Integer> studentIds = Arrays.asList(exercises.getStudentIdList().split(",")).stream().mapToInt(Integer::valueOf).boxed().collect(Collectors.toList());
 		List<Integer> studentIds = Arrays.asList(exercises.getStudentIdList().split(",")).stream().mapToInt(Integer::valueOf).boxed().collect(Collectors.toList());
 		exercises.setBatchNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
 		exercises.setBatchNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
 		exercises.setExpectNum(studentIds.size());
 		exercises.setExpectNum(studentIds.size());