|
|
@@ -1,12 +1,16 @@
|
|
|
package com.x1ongzhu.wisFactory.service;
|
|
|
|
|
|
import com.x1ongzhu.wisFactory.domain.Department;
|
|
|
+import com.x1ongzhu.wisFactory.domain.Shift;
|
|
|
+import com.x1ongzhu.wisFactory.enums.AttendanceType;
|
|
|
import com.x1ongzhu.wisFactory.repo.DepartmentRepo;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
+import java.time.LocalTime;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
|
|
|
@@ -22,7 +26,15 @@ public class DepartmentService {
|
|
|
if (department == null) {
|
|
|
department = Department.builder()
|
|
|
.name(d)
|
|
|
+ .attendanceType(AttendanceType.FIX)
|
|
|
.hours(8)
|
|
|
+ .workDay("1,2,3,4,5")
|
|
|
+ .shifts(new ArrayList<Shift>() {{
|
|
|
+ add(Shift.builder()
|
|
|
+ .start(LocalTime.of(8, 30))
|
|
|
+ .end(LocalTime.of(17, 30))
|
|
|
+ .build());
|
|
|
+ }})
|
|
|
.build();
|
|
|
departmentRepo.save(department);
|
|
|
}
|