Compare commits
No commits in common. "main" and "yoon" have entirely different histories.
@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@ -24,7 +25,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
public class MainController {
|
public class MainController {
|
||||||
|
|
||||||
private final MainService mainService;
|
private final MainService mainService;
|
||||||
|
|
||||||
|
|
||||||
@Member
|
@Member
|
||||||
@ParameterCheck
|
@ParameterCheck
|
||||||
@ -50,8 +50,8 @@ public class MainController {
|
|||||||
@Member
|
@Member
|
||||||
@ParameterCheck
|
@ParameterCheck
|
||||||
@PostMapping("/inserEvent")
|
@PostMapping("/inserEvent")
|
||||||
public ApiResponse<String> insertEvent(@ReqMap MapDto map) {
|
public ApiResponse<String> inserEvent(@ReqMap MapDto map) {
|
||||||
return mainService.insertEvent(map);
|
return mainService.inserEvent(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Admin
|
@Admin
|
||||||
@ -76,11 +76,4 @@ public class MainController {
|
|||||||
long memberSeq = map.getInt("memberSeq");
|
long memberSeq = map.getInt("memberSeq");
|
||||||
return mainService.rejectMember(memberSeq);
|
return mainService.rejectMember(memberSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Member
|
|
||||||
@ParameterCheck
|
|
||||||
@PostMapping("/getUserLeaveRecord")
|
|
||||||
public ApiResponse<MapDto> getUserLeaveRecord(@ReqMap MapDto map) {
|
|
||||||
return mainService.getUserLeaveRecord(map);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -180,11 +180,4 @@ public class ProjectController {
|
|||||||
return ApiResponse.ok(netprojctService.selectUserProjectPeriod(projctSeq));
|
return ApiResponse.ok(netprojctService.selectUserProjectPeriod(projctSeq));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterCheck
|
|
||||||
@GetMapping("/people/{memberSeq}")
|
|
||||||
public ApiResponse<List<MapDto>> selectUserProjectPeriod2(@PathVariable int memberSeq) {
|
|
||||||
|
|
||||||
return ApiResponse.ok(netprojctService.selectUserProjectPeriod2(memberSeq));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,11 +30,9 @@ import org.springframework.security.core.context.SecurityContext;
|
|||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.security.core.context.SecurityContextHolderStrategy;
|
import org.springframework.security.core.context.SecurityContextHolderStrategy;
|
||||||
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
|
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PatchMapping;
|
import org.springframework.web.bind.annotation.PatchMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RequestPart;
|
import org.springframework.web.bind.annotation.RequestPart;
|
||||||
@ -243,9 +241,6 @@ public class UserController {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @GetMapping("checkUserSession")
|
|
||||||
// public
|
|
||||||
|
|
||||||
|
|
||||||
// 유저 세션 체크
|
// 유저 세션 체크
|
||||||
@ -262,21 +257,6 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
return ApiResponse.ok(sessionData);
|
return ApiResponse.ok(sessionData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 유저 세션 권한 체크
|
|
||||||
@PostMapping(value = "authCheck")
|
|
||||||
public ApiResponse<?> authCheck(@ReqMap MapDto map) {
|
|
||||||
String memberId = map.getString("memberId");
|
|
||||||
if(!StringUtils.hasText(memberId)) return ApiResponse.error(HttpStatus.BAD_REQUEST, "파라미터 오류");
|
|
||||||
|
|
||||||
String userRole = "";
|
|
||||||
MemberVo vo = AuthUtil.getUser();
|
|
||||||
if(vo != null && memberId.equals(vo.getLoginId())) {
|
|
||||||
userRole = vo.getRole();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ApiResponse.ok(userRole);
|
|
||||||
}
|
|
||||||
|
|
||||||
// rememberMe 확인용
|
// rememberMe 확인용
|
||||||
@GetMapping(value = "rememberCheck")
|
@GetMapping(value = "rememberCheck")
|
||||||
@ -327,7 +307,10 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 사원 목록 전체 조회
|
* 사원 목록 전체 조회
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@ParameterCheck
|
@ParameterCheck
|
||||||
@GetMapping("/allUserList")
|
@GetMapping("/allUserList")
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
package io.company.localhost.controller.common;
|
package io.company.localhost.controller.common;
|
||||||
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -69,86 +65,62 @@ public class WeatherController {
|
|||||||
JsonNode nodeData = objectMapper.readTree(jsonData);
|
JsonNode nodeData = objectMapper.readTree(jsonData);
|
||||||
JsonNode forecastList = nodeData.get("list");
|
JsonNode forecastList = nodeData.get("list");
|
||||||
|
|
||||||
// 현재 날짜 및 시간 계산
|
// 날짜별로 데이터 그룹화
|
||||||
LocalDate today = LocalDate.now();
|
|
||||||
LocalDateTime nowTime = LocalDateTime.now();
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
||||||
|
|
||||||
// 날짜별 데이터를 그룹화
|
|
||||||
Map<String, List<String>> dailyWeathers = new HashMap<>();
|
Map<String, List<String>> dailyWeathers = new HashMap<>();
|
||||||
Map<String, List<String>> dailyDescriptions = new HashMap<>();
|
Map<String, List<String>> dailyDescriptions = new HashMap<>();
|
||||||
Map<String, List<String>> dailyIcons = new HashMap<>();
|
Map<String, List<String>> dailyIcons = new HashMap<>();
|
||||||
|
|
||||||
// 오늘 예보 중 가장 가까운 예보 저장 변수
|
|
||||||
JsonNode closestForecastToday = null;
|
|
||||||
long minDiff = Long.MAX_VALUE;
|
|
||||||
|
|
||||||
// forecastList를 순회하며 데이터를 그룹화하고, 오늘의 경우 가장 가까운 forecast 선택
|
|
||||||
for (JsonNode forecast : forecastList) {
|
for (JsonNode forecast : forecastList) {
|
||||||
String dtTxt = forecast.get("dt_txt").asText();
|
String date = forecast.get("dt_txt").asText().split(" ")[0]; //날짜 추출
|
||||||
String date = dtTxt.split(" ")[0]; // 날짜 추출 (예: "2025-04-04")
|
|
||||||
|
|
||||||
JsonNode weather = forecast.get("weather").get(0);
|
JsonNode weather = forecast.get("weather").get(0);
|
||||||
String mainWeather = weather.get("main").asText();
|
String mainWeather = weather.get("main").asText();
|
||||||
String description = weather.get("description").asText();
|
String description = weather.get("description").asText();
|
||||||
String icon = weather.get("icon").asText();
|
String icon = weather.get("icon").asText();
|
||||||
|
|
||||||
// 해당 날짜의 리스트에 추가 (map이 없으면 생성)
|
if (!dailyWeathers.containsKey(date)) {
|
||||||
dailyWeathers.computeIfAbsent(date, k -> new ArrayList<>()).add(mainWeather);
|
dailyWeathers.put(date, new ArrayList<>());
|
||||||
dailyDescriptions.computeIfAbsent(date, k -> new ArrayList<>()).add(description);
|
dailyDescriptions.put(date, new ArrayList<>());
|
||||||
dailyIcons.computeIfAbsent(date, k -> new ArrayList<>()).add(icon);
|
dailyIcons.put(date, new ArrayList<>());
|
||||||
|
|
||||||
// 오늘 날짜의 forecast라면 현재 시간과의 차이 계산
|
|
||||||
if (date.equals(today.toString())) {
|
|
||||||
LocalDateTime forecastTime = LocalDateTime.parse(dtTxt, formatter);
|
|
||||||
long diff = Math.abs(Duration.between(forecastTime, nowTime).toMillis());
|
|
||||||
if (diff < minDiff) {
|
|
||||||
minDiff = diff;
|
|
||||||
closestForecastToday = forecast;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dailyWeathers.get(date).add(mainWeather);
|
||||||
|
dailyDescriptions.get(date).add(description);
|
||||||
|
dailyIcons.get(date).add(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 최종적으로 각 날짜의 대표 날씨 결정
|
// 각 날짜별 대표 날씨 결정 (가장 빈번한 날씨 상태)
|
||||||
List<WeatherVo> dailyWeatherList = new ArrayList<>();
|
List<WeatherVo> dailyWeatherList = new ArrayList<>();
|
||||||
|
|
||||||
for (String date : dailyWeathers.keySet()) {
|
for (String date : dailyWeathers.keySet()) {
|
||||||
String repMainWeather;
|
List<String> weathers = dailyWeathers.get(date);
|
||||||
String repDescription;
|
List<String> descriptions = dailyDescriptions.get(date);
|
||||||
String repIcon;
|
List<String> icons = dailyIcons.get(date);
|
||||||
|
|
||||||
// 오늘인 경우, 가장 가까운 forecast의 아이콘과 설명 사용
|
// 가장 빈번한 날씨 찾기(카운팅)
|
||||||
if (date.equals(today.toString()) && closestForecastToday != null) {
|
Map<String, Integer> weatherCounts = new HashMap<>();
|
||||||
JsonNode weather = closestForecastToday.get("weather").get(0);
|
for (String w : weathers) {
|
||||||
repMainWeather = weather.get("main").asText();
|
weatherCounts.put(w, weatherCounts.getOrDefault(w, 0) + 1);
|
||||||
repDescription = weather.get("description").asText();
|
|
||||||
repIcon = weather.get("icon").asText();
|
|
||||||
} else {
|
|
||||||
// 기타 날짜는 기존 방식대로 가장 빈번한 날씨 상태 선택
|
|
||||||
List<String> weathers = dailyWeathers.get(date);
|
|
||||||
List<String> descriptions = dailyDescriptions.get(date);
|
|
||||||
List<String> icons = dailyIcons.get(date);
|
|
||||||
|
|
||||||
Map<String, Integer> weatherCounts = new HashMap<>();
|
|
||||||
for (String w : weathers) {
|
|
||||||
weatherCounts.put(w, weatherCounts.getOrDefault(w, 0) + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
repMainWeather = "";
|
|
||||||
int maxCount = 0;
|
|
||||||
for (Map.Entry<String, Integer> entry : weatherCounts.entrySet()) {
|
|
||||||
if (entry.getValue() > maxCount) {
|
|
||||||
maxCount = entry.getValue();
|
|
||||||
repMainWeather = entry.getKey();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int repIndex = weathers.indexOf(repMainWeather);
|
|
||||||
repDescription = descriptions.get(repIndex);
|
|
||||||
repIcon = icons.get(repIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dailyWeatherList.add(new WeatherVo(date, repMainWeather, repDescription, repIcon));
|
String mainWeather = "";
|
||||||
|
int maxCount = 0;
|
||||||
|
|
||||||
|
for (Map.Entry<String, Integer> entry : weatherCounts.entrySet()) {
|
||||||
|
if (entry.getValue() > maxCount) {
|
||||||
|
maxCount = entry.getValue();
|
||||||
|
mainWeather = entry.getKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 평균값 계산
|
||||||
|
int mainWeatherIndex = weathers.indexOf(mainWeather);
|
||||||
|
String description = descriptions.get(mainWeatherIndex);
|
||||||
|
String icon = icons.get(mainWeatherIndex);
|
||||||
|
|
||||||
|
dailyWeatherList.add(new WeatherVo(date, mainWeather, description, icon));
|
||||||
}
|
}
|
||||||
|
|
||||||
return dailyWeatherList;
|
return dailyWeatherList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,5 @@ public interface CommutersMapper {
|
|||||||
// int updateCommuterProject(MapDto map);
|
// int updateCommuterProject(MapDto map);
|
||||||
|
|
||||||
int deleteCommuters(MapDto map);
|
int deleteCommuters(MapDto map);
|
||||||
|
|
||||||
MapDto selectUserLeaveWorkList(MapDto map);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,4 @@ public interface NetprojctMapper {
|
|||||||
int deleteProject(MapDto map);
|
int deleteProject(MapDto map);
|
||||||
|
|
||||||
List<MapDto> selectUserProjectPeriod(int projectSeq);
|
List<MapDto> selectUserProjectPeriod(int projectSeq);
|
||||||
|
|
||||||
List<MapDto> selectUserProjectPeriod2(int memberSeq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,8 +20,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
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.common.dto.MapDto;
|
||||||
import io.company.localhost.mapper.CommutersMapper;
|
import io.company.localhost.mapper.CommutersMapper;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -108,16 +106,5 @@ public class CommutersService {
|
|||||||
* public boolean updateCommuterProject(MapDto map) { return
|
* public boolean updateCommuterProject(MapDto map) { return
|
||||||
* commutersMapper.updateCommuterProject(map) > 0; }
|
* commutersMapper.updateCommuterProject(map) > 0; }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 사용자의 퇴근 기록 조회
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public ApiResponse<MapDto> selectUserLeaveWorkList(@ReqMap MapDto map) {
|
|
||||||
map.put("currentDate", LocalDateTime.now());
|
|
||||||
return ApiResponse.ok(commutersMapper.selectUserLeaveWorkList(map));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,8 +21,6 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import io.company.localhost.common.dto.ApiResponse;
|
import io.company.localhost.common.dto.ApiResponse;
|
||||||
import io.company.localhost.common.dto.MapDto;
|
import io.company.localhost.common.dto.MapDto;
|
||||||
import io.company.localhost.utils.AuthUtil;
|
|
||||||
import io.company.localhost.vo.MemberVo;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -30,10 +28,12 @@ import lombok.RequiredArgsConstructor;
|
|||||||
public class MainService {
|
public class MainService {
|
||||||
|
|
||||||
private final commoncodService commoncodService;
|
private final commoncodService commoncodService;
|
||||||
|
|
||||||
private final NetmemberService netmemberService;
|
private final NetmemberService netmemberService;
|
||||||
|
|
||||||
private final localvacaService localvacaService;
|
private final localvacaService localvacaService;
|
||||||
|
|
||||||
private final LocalevntService localevntService;
|
private final LocalevntService localevntService;
|
||||||
private final CommutersService commutersService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,13 +72,15 @@ public class MainService {
|
|||||||
if(localevntService.selectCheckEvent(map) > 0) {
|
if(localevntService.selectCheckEvent(map) > 0) {
|
||||||
localevntService.deleteEvent(map);
|
localevntService.deleteEvent(map);
|
||||||
return ApiResponse.okMessage("이벤트 삭제");
|
return ApiResponse.okMessage("이벤트 삭제");
|
||||||
|
//return ApiResponse.error(HttpStatus.CONFLICT, "이미 동일한 이벤트가 존재합니다");
|
||||||
} else {
|
} else {
|
||||||
|
// localevntService.insertEvent(map);
|
||||||
|
// return ApiResponse.okMessage("이벤트 추가");
|
||||||
return ApiResponse.error(HttpStatus.CONFLICT, "해당 이벤트가 존재하지 않습니다");
|
return ApiResponse.error(HttpStatus.CONFLICT, "해당 이벤트가 존재하지 않습니다");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiResponse<String> insertEvent(MapDto map) {
|
public ApiResponse<String> inserEvent(MapDto map) {
|
||||||
if(localevntService.selectCheckEvent(map) > 0) {
|
if(localevntService.selectCheckEvent(map) > 0) {
|
||||||
return ApiResponse.error(HttpStatus.CONFLICT, "이미 동일한 이벤트가 존재합니다");
|
return ApiResponse.error(HttpStatus.CONFLICT, "이미 동일한 이벤트가 존재합니다");
|
||||||
} else {
|
} else {
|
||||||
@ -104,14 +106,8 @@ public class MainService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ApiResponse<String> registerMember(long memberSeq) {
|
public ApiResponse<String> registerMember(long memberSeq) {
|
||||||
Long loginUserId = AuthUtil.getUser().getId();
|
|
||||||
MemberVo user = netmemberService.getUserInfoById(loginUserId);
|
|
||||||
|
|
||||||
if(user.getId() != loginUserId || !"ROLE_ADMIN".equals(user.getRole())) {
|
|
||||||
return ApiResponse.error(HttpStatus.FORBIDDEN, "사용 권한 없음");
|
|
||||||
}
|
|
||||||
|
|
||||||
int result = netmemberService.registerMember(memberSeq);
|
int result = netmemberService.registerMember(memberSeq);
|
||||||
|
|
||||||
return result == 1 ? ApiResponse.ok("사원 등록 성공") : ApiResponse.ok("사원 등록 실패");
|
return result == 1 ? ApiResponse.ok("사원 등록 성공") : ApiResponse.ok("사원 등록 실패");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,20 +118,10 @@ public class MainService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ApiResponse<String> rejectMember(long memberSeq) {
|
public ApiResponse<String> rejectMember(long memberSeq) {
|
||||||
Long loginUserId = AuthUtil.getUser().getId();
|
|
||||||
MemberVo user = netmemberService.getUserInfoById(loginUserId);
|
|
||||||
|
|
||||||
if(user.getId() != loginUserId || !"ROLE_ADMIN".equals(user.getRole())) {
|
|
||||||
return ApiResponse.error(HttpStatus.UNAUTHORIZED, "사용 권한 없음");
|
|
||||||
}
|
|
||||||
|
|
||||||
int result = netmemberService.rejectMember(memberSeq);
|
int result = netmemberService.rejectMember(memberSeq);
|
||||||
|
|
||||||
return result == 1 ? ApiResponse.ok("미승인 대상자 등록") : ApiResponse.ok("미승인 대상자 등록 실패");
|
return result == 1 ? ApiResponse.ok("미승인 대상자 등록") : ApiResponse.ok("미승인 대상자 등록 실패");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiResponse<MapDto> getUserLeaveRecord(MapDto map) {
|
|
||||||
return commutersService.selectUserLeaveWorkList(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -175,8 +175,4 @@ public class NetprojctService {
|
|||||||
return netprojctMapper.selectUserProjectPeriod(projctSeq);
|
return netprojctMapper.selectUserProjectPeriod(projctSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MapDto> selectUserProjectPeriod2(int memberSeq) {
|
|
||||||
return netprojctMapper.selectUserProjectPeriod2(memberSeq);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -288,32 +288,38 @@ public class localvacaService {
|
|||||||
return emp;
|
return emp;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
/**
|
* 총 연차 계산 로직
|
||||||
* 총 연차 계산 로직
|
*/
|
||||||
*/
|
|
||||||
public int procCalculateTotalVacation(LocalDate hireDate) {
|
public int procCalculateTotalVacation(LocalDate hireDate) {
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now(); // 현재 날짜
|
||||||
int hireYear = hireDate.getYear();
|
int yearsWorked = hireDate.until(today).getYears();
|
||||||
int currentYear = today.getYear();
|
int hireMonth = hireDate.getMonthValue();
|
||||||
|
|
||||||
// 입사년도와 현재년도가 같으면 : (12 - 입사월)
|
// 🔹 1년 미만: 입사한 월을 고려하여 연차 개수 계산
|
||||||
if (hireYear == currentYear) {
|
if (yearsWorked < 1) {
|
||||||
return 12 - hireDate.getMonthValue();
|
return 12 - hireMonth;
|
||||||
|
} else {
|
||||||
|
int totalVacation = 12 - hireMonth; // 1년 미만 사용하고 남은 연차 수 반영
|
||||||
|
LocalDate nextIncreaseDate = hireDate.plusYears(1).withMonth(hireMonth).withDayOfMonth(1);
|
||||||
|
|
||||||
|
// 🔹 매년 입사월에 15개 지급
|
||||||
|
while (!nextIncreaseDate.isAfter(today)) {
|
||||||
|
totalVacation += 15;
|
||||||
|
nextIncreaseDate = nextIncreaseDate.plusYears(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🔹 입사년도 2년마다 입사월에 15개에서 1개씩 추가 지급
|
||||||
|
LocalDate additionalIncreaseDate = hireDate.plusYears(2).withMonth(hireMonth).withDayOfMonth(1);
|
||||||
|
int extraIncrease = 1;
|
||||||
|
while (!additionalIncreaseDate.isAfter(today)) {
|
||||||
|
totalVacation += extraIncrease;
|
||||||
|
additionalIncreaseDate = additionalIncreaseDate.plusYears(2);
|
||||||
|
extraIncrease++; // 2년마다 1개씩 증가
|
||||||
|
}
|
||||||
|
|
||||||
|
return totalVacation;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 기본 연차 15
|
|
||||||
int totalVacation = 15;
|
|
||||||
|
|
||||||
// 입사년도 기준 3년차 1월부터, 매 2년마다 1개씩 증가
|
|
||||||
LocalDate accrualDate = LocalDate.of(hireYear + 3, 1, 1);
|
|
||||||
|
|
||||||
while (!accrualDate.isAfter(today)) {
|
|
||||||
totalVacation++;
|
|
||||||
accrualDate = accrualDate.plusYears(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
return totalVacation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MapDto> selectSentVacationCount(MapDto map) {
|
public List<MapDto> selectSentVacationCount(MapDto map) {
|
||||||
|
|||||||
@ -93,8 +93,6 @@ public class worddictyService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return filtered;
|
return filtered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -95,8 +95,6 @@ logging:
|
|||||||
connection: off
|
connection: off
|
||||||
io.company: DEBUG
|
io.company: DEBUG
|
||||||
io.company.localhost.mapper: off
|
io.company.localhost.mapper: off
|
||||||
file:
|
|
||||||
path: logs
|
|
||||||
|
|
||||||
|
|
||||||
filePath:
|
filePath:
|
||||||
|
|||||||
@ -100,9 +100,4 @@
|
|||||||
<delete id="deleteCommuters" parameterType="int">
|
<delete id="deleteCommuters" parameterType="int">
|
||||||
DELETE FROM commuters WHERE PROJCTSEQ = #{projctSeq}
|
DELETE FROM commuters WHERE PROJCTSEQ = #{projctSeq}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="selectUserLeaveWorkList">
|
|
||||||
/* 금일 퇴근 조회 */
|
|
||||||
SELECT * FROM COMMUTERS WHERE MEMBERSEQ = #{memberSeq} AND COMMUTDAY = DATE_FORMAT(#{currentDate}, '%Y-%m-%d')
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -116,65 +116,35 @@
|
|||||||
|
|
||||||
<!-- 프로젝트 모든 사용자 참여기간 조회 -->
|
<!-- 프로젝트 모든 사용자 참여기간 조회 -->
|
||||||
<select id="selectUserProjectPeriod" resultType="io.company.localhost.common.dto.MapDto">
|
<select id="selectUserProjectPeriod" resultType="io.company.localhost.common.dto.MapDto">
|
||||||
SELECT
|
SELECT
|
||||||
m.MEMBERSEQ,
|
m.MEMBERSEQ,
|
||||||
m.MEMBERNAM,
|
m.MEMBERNAM,
|
||||||
p.PROJCTSEQ,
|
p.PROJCTSEQ,
|
||||||
p.PROJCTNAM,
|
p.PROJCTNAM,
|
||||||
p.PROJCTSTR AS projectStartDate,
|
p.PROJCTSTR as projectStartDate,
|
||||||
p.PROJCTEND AS projectEndDate,
|
p.PROJCTEND as projectEndDate,
|
||||||
COALESCE((
|
(
|
||||||
SELECT MIN(c2.COMMUTDAY)
|
SELECT MIN(c2.COMMUTDAY)
|
||||||
FROM commuters c2
|
FROM commuters c2
|
||||||
WHERE c2.PROJCTSEQ = p.PROJCTSEQ
|
WHERE c2.PROJCTSEQ = p.PROJCTSEQ
|
||||||
AND c2.MEMBERSEQ = m.MEMBERSEQ
|
AND c2.MEMBERSEQ = m.MEMBERSEQ
|
||||||
), p.PROJCTSTR) AS userStartDate,
|
) as userStartDate,
|
||||||
COALESCE((
|
(
|
||||||
SELECT MAX(c2.COMMUTDAY)
|
SELECT MAX(c2.COMMUTDAY)
|
||||||
FROM commuters c2
|
FROM commuters c2
|
||||||
WHERE c2.PROJCTSEQ = p.PROJCTSEQ
|
WHERE c2.PROJCTSEQ = p.PROJCTSEQ
|
||||||
AND c2.MEMBERSEQ = m.MEMBERSEQ
|
AND c2.MEMBERSEQ = m.MEMBERSEQ
|
||||||
), p.PROJCTEND) AS userEndDate
|
) as userEndDate
|
||||||
FROM
|
FROM
|
||||||
netprojct p
|
netprojct p
|
||||||
LEFT JOIN
|
INNER JOIN
|
||||||
commuters c ON p.PROJCTSEQ = c.PROJCTSEQ
|
commuters c ON p.PROJCTSEQ = c.PROJCTSEQ
|
||||||
LEFT JOIN
|
INNER JOIN
|
||||||
netmember m ON c.MEMBERSEQ = m.MEMBERSEQ
|
netmember m ON c.MEMBERSEQ = m.MEMBERSEQ
|
||||||
WHERE
|
WHERE
|
||||||
p.PROJCTSEQ = #{projectSeq}
|
p.PROJCTSEQ = #{projectSeq}
|
||||||
GROUP BY
|
GROUP BY
|
||||||
m.MEMBERSEQ, m.MEMBERNAM, p.PROJCTSEQ, p.PROJCTNAM, p.PROJCTSTR, p.PROJCTEND
|
m.MEMBERSEQ, p.PROJCTSEQ
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserProjectPeriod2" resultType="io.company.localhost.common.dto.MapDto">
|
|
||||||
SELECT
|
|
||||||
pm.MEMBERSEQ,
|
|
||||||
p.PROJCTSEQ,
|
|
||||||
p.PROJCTNAM,
|
|
||||||
p.PROJCTSTR AS projectStartDate,
|
|
||||||
p.PROJCTEND AS projectEndDate,
|
|
||||||
(
|
|
||||||
SELECT MIN(c2.COMMUTDAY)
|
|
||||||
FROM commuters c2
|
|
||||||
WHERE c2.PROJCTSEQ = p.PROJCTSEQ
|
|
||||||
AND c2.MEMBERSEQ = pm.MEMBERSEQ
|
|
||||||
) AS userStartDate,
|
|
||||||
CASE
|
|
||||||
WHEN p.PROJCTEND IS NOT NULL THEN (
|
|
||||||
SELECT MAX(c2.COMMUTDAY)
|
|
||||||
FROM commuters c2
|
|
||||||
WHERE c2.PROJCTSEQ = p.PROJCTSEQ
|
|
||||||
AND c2.MEMBERSEQ = pm.MEMBERSEQ
|
|
||||||
)
|
|
||||||
ELSE NULL
|
|
||||||
END AS userEndDate
|
|
||||||
FROM promember pm
|
|
||||||
INNER JOIN netprojct p ON pm.PROJCTSEQ = p.PROJCTSEQ
|
|
||||||
WHERE pm.MEMBERSEQ = #{memberSeq}
|
|
||||||
AND pm.PROJCTYON = 1
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -84,14 +84,7 @@
|
|||||||
</when>
|
</when>
|
||||||
</choose>
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
<choose>
|
ORDER BY formatted_LOCVOTRDT DESC
|
||||||
<when test='myVote == "2"'>
|
|
||||||
ORDER BY LOCVOTEDT ASC, formatted_LOCVOTRDT DESC
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
ORDER BY formatted_LOCVOTRDT DESC
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
</select>
|
</select>
|
||||||
<update id="updateEndData" parameterType="map">
|
<update id="updateEndData" parameterType="map">
|
||||||
UPDATE
|
UPDATE
|
||||||
|
|||||||
@ -12,49 +12,49 @@
|
|||||||
<!-- 색인표 조건 -->
|
<!-- 색인표 조건 -->
|
||||||
<if test="indexKeyword != null and indexKeyword != ''">
|
<if test="indexKeyword != null and indexKeyword != ''">
|
||||||
<choose>
|
<choose>
|
||||||
<!-- 한글 ㄱ ~ ㅎ에 대한 검색 (자음만 있는 경우도 포함) -->
|
<!-- 한글 ㄱ ~ ㅎ에 대한 검색 -->
|
||||||
<when test='indexKeyword == "ㄱ"'>
|
<when test='indexKeyword == "ㄱ"'>
|
||||||
AND (w.WRDDICTTL BETWEEN '가' AND '깋' OR w.WRDDICTTL LIKE 'ㄱ%')
|
and w.WRDDICTTL BETWEEN '가' AND '깋'
|
||||||
</when>
|
</when>
|
||||||
<when test='indexKeyword == "ㄴ"'>
|
<when test='indexKeyword == "ㄴ"'>
|
||||||
AND (w.WRDDICTTL BETWEEN '나' AND '닣' OR w.WRDDICTTL LIKE 'ㄴ%')
|
and w.WRDDICTTL BETWEEN '나' AND '닣'
|
||||||
</when>
|
</when>
|
||||||
<when test='indexKeyword == "ㄷ"'>
|
<when test='indexKeyword == "ㄷ"'>
|
||||||
AND (w.WRDDICTTL BETWEEN '다' AND '딷' OR w.WRDDICTTL LIKE 'ㄷ%')
|
and w.WRDDICTTL BETWEEN '다' AND '딷'
|
||||||
</when>
|
</when>
|
||||||
<when test='indexKeyword == "ㄹ"'>
|
<when test='indexKeyword == "ㄹ"'>
|
||||||
AND (w.WRDDICTTL BETWEEN '라' AND '릿' OR w.WRDDICTTL LIKE 'ㄹ%')
|
and w.WRDDICTTL BETWEEN '라' AND '릿'
|
||||||
</when>
|
</when>
|
||||||
<when test='indexKeyword == "ㅁ"'>
|
<when test='indexKeyword == "ㅁ"'>
|
||||||
AND (w.WRDDICTTL BETWEEN '마' AND '밓' OR w.WRDDICTTL LIKE 'ㅁ%')
|
and w.WRDDICTTL BETWEEN '마' AND '밓'
|
||||||
</when>
|
</when>
|
||||||
<when test='indexKeyword == "ㅂ"'>
|
<when test='indexKeyword == "ㅂ"'>
|
||||||
AND (w.WRDDICTTL BETWEEN '바' AND '빟' OR w.WRDDICTTL LIKE 'ㅂ%')
|
and w.WRDDICTTL BETWEEN '바' AND '빟'
|
||||||
</when>
|
</when>
|
||||||
<when test='indexKeyword == "ㅅ"'>
|
<when test='indexKeyword == "ㅅ"'>
|
||||||
AND (w.WRDDICTTL BETWEEN '사' AND '싷' OR w.WRDDICTTL LIKE 'ㅅ%')
|
and w.WRDDICTTL BETWEEN '사' AND '싷'
|
||||||
</when>
|
</when>
|
||||||
<when test='indexKeyword == "ㅇ"'>
|
<when test='indexKeyword == "ㅇ"'>
|
||||||
AND (w.WRDDICTTL BETWEEN '아' AND '잏' OR w.WRDDICTTL LIKE 'ㅇ%')
|
and w.WRDDICTTL BETWEEN '아' AND '잏'
|
||||||
</when>
|
</when>
|
||||||
<when test='indexKeyword == "ㅈ"'>
|
<when test='indexKeyword == "ㅈ"'>
|
||||||
AND (w.WRDDICTTL BETWEEN '자' AND '짛' OR w.WRDDICTTL LIKE 'ㅈ%')
|
and w.WRDDICTTL BETWEEN '자' AND '짛'
|
||||||
</when>
|
</when>
|
||||||
<when test='indexKeyword == "ㅊ"'>
|
<when test='indexKeyword == "ㅊ"'>
|
||||||
AND (w.WRDDICTTL BETWEEN '차' AND '칳' OR w.WRDDICTTL LIKE 'ㅊ%')
|
and w.WRDDICTTL BETWEEN '차' AND '칳'
|
||||||
</when>
|
</when>
|
||||||
<when test='indexKeyword == "ㅋ"'>
|
<when test='indexKeyword == "ㅋ"'>
|
||||||
AND (w.WRDDICTTL BETWEEN '카' AND '킿' OR w.WRDDICTTL LIKE 'ㅋ%')
|
and w.WRDDICTTL BETWEEN '카' AND '킿'
|
||||||
</when>
|
</when>
|
||||||
<when test='indexKeyword == "ㅌ"'>
|
<when test='indexKeyword == "ㅌ"'>
|
||||||
AND (w.WRDDICTTL BETWEEN '타' AND '틷' OR w.WRDDICTTL LIKE 'ㅌ%')
|
and w.WRDDICTTL BETWEEN '타' AND '틷'
|
||||||
</when>
|
</when>
|
||||||
<when test='indexKeyword == "ㅍ"'>
|
<when test='indexKeyword == "ㅍ"'>
|
||||||
AND (w.WRDDICTTL BETWEEN '파' AND '핗' OR w.WRDDICTTL LIKE 'ㅍ%')
|
and w.WRDDICTTL BETWEEN '파' AND '핗'
|
||||||
</when>
|
</when>
|
||||||
<when test='indexKeyword == "ㅎ"'>
|
<when test='indexKeyword == "ㅎ"'>
|
||||||
AND (w.WRDDICTTL BETWEEN '하' AND '힣' OR w.WRDDICTTL LIKE 'ㅎ%')
|
and w.WRDDICTTL BETWEEN '하' AND '힣'
|
||||||
</when>
|
</when>
|
||||||
<!-- 알파벳 a ~ z에 대한 검색 -->
|
<!-- 알파벳 a ~ z에 대한 검색 -->
|
||||||
<when test='indexKeyword == "a"'>
|
<when test='indexKeyword == "a"'>
|
||||||
and w.WRDDICTTL like "a%"
|
and w.WRDDICTTL like "a%"
|
||||||
@ -134,9 +134,6 @@
|
|||||||
<when test='indexKeyword == "z"'>
|
<when test='indexKeyword == "z"'>
|
||||||
and w.WRDDICTTL like "z%"
|
and w.WRDDICTTL like "z%"
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
|
||||||
and w.WRDDICTTL like CONCAT('%', #{indexKeyword}, '%')
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
<!-- 카테고리 조건 -->
|
<!-- 카테고리 조건 -->
|
||||||
@ -304,47 +301,33 @@
|
|||||||
CHARACTER_,
|
CHARACTER_,
|
||||||
COUNT(*) AS COUNT
|
COUNT(*) AS COUNT
|
||||||
FROM (
|
FROM (
|
||||||
SELECT 'ㄱ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
SELECT 'ㄱ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '가' AND '깋'
|
||||||
WHERE WRDDICTTL BETWEEN '가' AND '깋' OR WRDDICTTL LIKE 'ㄱ%'
|
UNION ALL
|
||||||
UNION ALL
|
SELECT 'ㄴ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '나' AND '닣'
|
||||||
SELECT 'ㄴ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
UNION ALL
|
||||||
WHERE WRDDICTTL BETWEEN '나' AND '닣' OR WRDDICTTL LIKE 'ㄴ%'
|
SELECT 'ㄷ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '다' AND '딷'
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT 'ㄷ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
SELECT 'ㄹ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '라' AND '릿'
|
||||||
WHERE WRDDICTTL BETWEEN '다' AND '딷' OR WRDDICTTL LIKE 'ㄷ%'
|
UNION ALL
|
||||||
UNION ALL
|
SELECT 'ㅁ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '마' AND '밓'
|
||||||
SELECT 'ㄹ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
UNION ALL
|
||||||
WHERE WRDDICTTL BETWEEN '라' AND '릿' OR WRDDICTTL LIKE 'ㄹ%'
|
SELECT 'ㅂ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '바' AND '빟'
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT 'ㅁ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
SELECT 'ㅅ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '사' AND '싷'
|
||||||
WHERE WRDDICTTL BETWEEN '마' AND '밓' OR WRDDICTTL LIKE 'ㅁ%'
|
UNION ALL
|
||||||
UNION ALL
|
SELECT 'ㅇ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '아' AND '잏'
|
||||||
SELECT 'ㅂ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
UNION ALL
|
||||||
WHERE WRDDICTTL BETWEEN '바' AND '빟' OR WRDDICTTL LIKE 'ㅂ%'
|
SELECT 'ㅈ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '자' AND '짛'
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT 'ㅅ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
SELECT 'ㅊ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '차' AND '칳'
|
||||||
WHERE WRDDICTTL BETWEEN '사' AND '싷' OR WRDDICTTL LIKE 'ㅅ%'
|
UNION ALL
|
||||||
UNION ALL
|
SELECT 'ㅋ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '카' AND '킿'
|
||||||
SELECT 'ㅇ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
UNION ALL
|
||||||
WHERE WRDDICTTL BETWEEN '아' AND '잏' OR WRDDICTTL LIKE 'ㅇ%'
|
SELECT 'ㅌ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '타' AND '틷'
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT 'ㅈ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
SELECT 'ㅍ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '파' AND '핗'
|
||||||
WHERE WRDDICTTL BETWEEN '자' AND '짛' OR WRDDICTTL LIKE 'ㅈ%'
|
UNION ALL
|
||||||
UNION ALL
|
SELECT 'ㅎ' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL BETWEEN '하' AND '힣'
|
||||||
SELECT 'ㅊ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
|
||||||
WHERE WRDDICTTL BETWEEN '차' AND '칳' OR WRDDICTTL LIKE 'ㅊ%'
|
|
||||||
UNION ALL
|
|
||||||
SELECT 'ㅋ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
|
||||||
WHERE WRDDICTTL BETWEEN '카' AND '킿' OR WRDDICTTL LIKE 'ㅋ%'
|
|
||||||
UNION ALL
|
|
||||||
SELECT 'ㅌ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
|
||||||
WHERE WRDDICTTL BETWEEN '타' AND '틷' OR WRDDICTTL LIKE 'ㅌ%'
|
|
||||||
UNION ALL
|
|
||||||
SELECT 'ㅍ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
|
||||||
WHERE WRDDICTTL BETWEEN '파' AND '핗' OR WRDDICTTL LIKE 'ㅍ%'
|
|
||||||
UNION ALL
|
|
||||||
SELECT 'ㅎ' AS CHARACTER_, WRDDICTTL FROM worddicty
|
|
||||||
WHERE WRDDICTTL BETWEEN '하' AND '힣' OR WRDDICTTL LIKE 'ㅎ%'
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT 'a' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL LIKE 'a%'
|
SELECT 'a' AS CHARACTER_, WRDDICTTL FROM worddicty WHERE WRDDICTTL LIKE 'a%'
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user