116 lines
3.1 KiB
Java
116 lines
3.1 KiB
Java
/************************************************************
|
|
*
|
|
* @packageName : io.company.localhost.controller.api
|
|
* @fileName : CommuterController.java
|
|
* @author : 박지윤
|
|
* @date : 25.03.10
|
|
* @description : 출퇴근
|
|
*
|
|
* ===========================================================
|
|
* DATE AUTHOR NOTE
|
|
* -----------------------------------------------------------
|
|
* 25.03.10 박지윤 최초 생성
|
|
*
|
|
*************************************************************/
|
|
|
|
package io.company.localhost.controller.api;
|
|
|
|
import java.util.List;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PatchMapping;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import io.company.localhost.common.annotation.ReqMap;
|
|
import io.company.localhost.common.dto.ApiResponse;
|
|
import io.company.localhost.common.dto.MapDto;
|
|
import io.company.localhost.service.CommutersService;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@RestController
|
|
@RequestMapping("/api/commuters")
|
|
@RequiredArgsConstructor
|
|
@Slf4j
|
|
public class CommutersController {
|
|
|
|
private final CommutersService commutersService;
|
|
|
|
|
|
/**
|
|
* 출퇴근 등록
|
|
*
|
|
* @param map
|
|
* @return
|
|
*/
|
|
@PostMapping("/insert")
|
|
public ApiResponse<Integer> insertCommuters(@ReqMap MapDto map) {
|
|
int commuters = commutersService.insertCommuters(map);
|
|
return ApiResponse.ok(commuters);
|
|
}
|
|
|
|
/**
|
|
* 퇴근 업데이트
|
|
*
|
|
* @param map
|
|
* @return
|
|
*
|
|
*/
|
|
@PatchMapping("/updateLve")
|
|
public ApiResponse<Boolean> updateLeaveTime(@ReqMap MapDto map) {
|
|
boolean isLeaveTime = commutersService.updateLeaveTime(map);
|
|
return ApiResponse.ok(isLeaveTime);
|
|
}
|
|
|
|
|
|
/**
|
|
* 현재 달의 모든 출근 정보 조회
|
|
*
|
|
* @param map
|
|
* @return
|
|
*/
|
|
@GetMapping("/month")
|
|
public ApiResponse<List<MapDto>> selectCommutersByMonth(int year, int month) {
|
|
return ApiResponse.ok(commutersService.selectCommutersByMonth(year, month));
|
|
}
|
|
|
|
/**
|
|
* 오늘 사용자의 출근 정보 조회
|
|
*
|
|
* @param map
|
|
* @return
|
|
*/
|
|
@GetMapping("/today/{memberSeq}")
|
|
public ApiResponse<List<MapDto>> selectTodayCommuterInfo(@PathVariable Integer memberSeq) {
|
|
return ApiResponse.ok(commutersService.selectTodayCommuterInfo(memberSeq));
|
|
}
|
|
|
|
/**
|
|
* 오늘 출근 모든 사용자 조회
|
|
*
|
|
* @param map
|
|
* @return
|
|
*/
|
|
@GetMapping("/todays")
|
|
public ApiResponse<List<MapDto>> selectTodayCommuter() {
|
|
return ApiResponse.ok(commutersService.selectTodayCommuter());
|
|
}
|
|
|
|
/**
|
|
* 출근 프로젝트 업데이트
|
|
*
|
|
* @param map
|
|
* @return
|
|
*
|
|
*/
|
|
@PatchMapping("/update")
|
|
public ApiResponse<Boolean> updateCommuterProject(@ReqMap MapDto map) {
|
|
boolean isCommuter = commutersService.updateCommuterProject(map);
|
|
return ApiResponse.ok(isCommuter);
|
|
}
|
|
|
|
}
|