|
@@ -17,7 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
|
|
|
@Service
|
|
|
public class TimePeriodServiceImpl extends ServiceImpl<TimePeriodDao, TimePeriodEntity> implements TimePeriodService {
|
|
@@ -37,6 +39,18 @@ public class TimePeriodServiceImpl extends ServiceImpl<TimePeriodDao, TimePeriod
|
|
|
ApplyTaskEntity task = taskService.getById(id);
|
|
|
if (task == null)
|
|
|
throw new StatusException("预约任务不存在!");
|
|
|
+
|
|
|
+ //校验起止时间不能一样
|
|
|
+ Set<String> timeSet = new HashSet<>();
|
|
|
+ for (TimePeriodReq time : timeList) {
|
|
|
+ String key = time.getStartTime() + "_" + time.getEndTime();
|
|
|
+ if (timeSet.contains(key)) {
|
|
|
+ throw new StatusException("起止时间不能一样");
|
|
|
+ }
|
|
|
+ timeSet.add(key);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
for (TimePeriodReq time : timeList) {
|
|
|
TimePeriodEntity timePeriod = new TimePeriodEntity();
|
|
|
BeanUtils.copyProperties(time, timePeriod);
|