Merge branch 'main' into yoon

This commit is contained in:
yoon 2025-02-25 09:47:48 +09:00
commit a7e3dfd23d
29 changed files with 284 additions and 141 deletions

45
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,45 @@
pipeline {
agent any
tools {
gradle 'gradle8'
}
stages {
stage('Clean & Build') {
steps {
bat './gradlew clean build -x test'
}
}
stage('Deploy') {
steps {
bat '''
echo "checking Tomcat is running"
netstat -ano | find "8005" > nul
if errorlevel 1 (
echo "Tomcat is not running, skipping shutdown..."
) else (
echo "Tomcat is running, shutting down..."
cd C:\\localhost-tomcat\\apache-tomcat-10.1.36-windows-x64\\apache-tomcat-10.1.36\\bin
call shutdown.bat
ping -n 5 127.0.0.1 > nul
)
echo "del"
del /F /Q C:\\localhost-tomcat\\apache-tomcat-10.1.36-windows-x64\\apache-tomcat-10.1.36\\webapps\\*.war
ping -n 3 127.0.0.1 > nul
echo "copy"
copy /Y /B "%WORKSPACE%\\build\\libs\\*-plain.war" "C:\\localhost-tomcat\\apache-tomcat-10.1.36-windows-x64\\apache-tomcat-10.1.36\\webapps\\ROOT.war"
ping -n 5 127.0.0.1 > nul
echo "start"
cd /d C:\\localhost-tomcat\\apache-tomcat-10.1.36-windows-x64\\apache-tomcat-10.1.36\\bin
call startup.bat
ping -n 5 127.0.0.1 > nul
'''
}
}
}
}

View File

@ -2,6 +2,7 @@ plugins {
id 'java' id 'java'
id 'org.springframework.boot' version "${springBootVersion}" id 'org.springframework.boot' version "${springBootVersion}"
id 'io.spring.dependency-management' version "${springDependencyManagementVersion}" id 'io.spring.dependency-management' version "${springDependencyManagementVersion}"
id 'war'
} }
group = "${projectGroup}" group = "${projectGroup}"
@ -77,6 +78,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-actuator-autoconfigure' implementation 'org.springframework.boot:spring-boot-actuator-autoconfigure'
/*implementation 'org.springframework.boot:spring-boot-starter-batch'*/ /*implementation 'org.springframework.boot:spring-boot-starter-batch'*/
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
/** spring-boot-starter-security */ /** spring-boot-starter-security */
implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-security'

View File

@ -80,8 +80,7 @@ public class BoardController {
@ParameterCheck @ParameterCheck
@PostMapping @PostMapping
public ApiResponse<BigInteger> createBoard(@ReqMap MapDto map) { public ApiResponse<BigInteger> createBoard(@ReqMap MapDto map) {
Long userId = AuthUtil.getUser().getId();
map.put("MEMBERSEQ", userId);
if (map.containsKey("LOCBRDPWD") && !map.getString("LOCBRDPWD").trim().isEmpty()) { // 체크 if (map.containsKey("LOCBRDPWD") && !map.getString("LOCBRDPWD").trim().isEmpty()) { // 체크
String rawPassword = map.getString("LOCBRDPWD"); String rawPassword = map.getString("LOCBRDPWD");
@ -204,9 +203,6 @@ public class BoardController {
@ParameterCheck @ParameterCheck
@PostMapping("/{LOCBRDSEQ}/comment") @PostMapping("/{LOCBRDSEQ}/comment")
public ApiResponse<String> addCommentOrReply(@ReqMap MapDto map) { public ApiResponse<String> addCommentOrReply(@ReqMap MapDto map) {
Long userId = AuthUtil.getUser().getId();
map.put("MEMBERSEQ", userId);
if (map.containsKey("LOCCMTPWD") && !map.getString("LOCCMTPWD").trim().isEmpty()) { // 체크 if (map.containsKey("LOCCMTPWD") && !map.getString("LOCCMTPWD").trim().isEmpty()) { // 체크
String rawPassword = map.getString("LOCCMTPWD"); String rawPassword = map.getString("LOCCMTPWD");
String hashedPassword = passwordEncoder.encode(rawPassword); String hashedPassword = passwordEncoder.encode(rawPassword);

View File

@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.PathVariable;
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.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.RestController; import org.springframework.web.bind.annotation.RestController;
import io.company.localhost.common.annotation.Member; import io.company.localhost.common.annotation.Member;
@ -29,11 +30,17 @@ import lombok.extern.slf4j.Slf4j;
public class VacationController { public class VacationController {
private final localvacaService localVacaService; private final localvacaService localVacaService;
private final commoncodService commonCodService;
/**
* 휴가 선물하기
* @ReqMap map 요청 파라미터 (LOCVACTYP, LOCVACRDT, LOCVACUDT, LOCVACRMM, MEMBERSEQ)
* @return 결과 메시지
*/
@Member @Member
@ParameterCheck @ParameterCheck
@PostMapping @PostMapping
public ApiResponse<?> saveVacations(@RequestBody List<MapDto> list) { public ApiResponse<?> insertVacations(@RequestBody List<MapDto> list) {
Long user = AuthUtil.getUser().getId(); Long user = AuthUtil.getUser().getId();
for (MapDto request : list) { for (MapDto request : list) {
String date = request.getString("date"); String date = request.getString("date");
@ -45,7 +52,6 @@ public class VacationController {
throw new IllegalArgumentException("요청 데이터에 누락된 값이 있습니다: " + request); throw new IllegalArgumentException("요청 데이터에 누락된 값이 있습니다: " + request);
} }
// count 필드가 있으면, 해당 값만큼 반복해서 insert
Integer count = request.getInt("count"); Integer count = request.getInt("count");
if (count == null || count < 1) { if (count == null || count < 1) {
count = 1; count = 1;
@ -56,11 +62,16 @@ public class VacationController {
} }
return ApiResponse.ok("모든 휴가가 성공적으로 저장되었습니다."); return ApiResponse.ok("모든 휴가가 성공적으로 저장되었습니다.");
} }
/**
* 휴가 저장/수정
* @ReqMap map 요청 파라미터 (LOCVACTYP, LOCVACRDT, LOCVACUDT, MEMBERSEQ / LOCVACSEQ)
* @return 결과 메시지
*/
@Member @Member
@ParameterCheck @ParameterCheck
@PostMapping("/batchUpdate") @PostMapping("/batchUpdate")
public ApiResponse<?> batchUpdateVacations(@ReqMap MapDto map) { public ApiResponse<?> saveVacations(@ReqMap MapDto map) {
Long user = AuthUtil.getUser().getId(); Long user = AuthUtil.getUser().getId();
List<MapDto> addRequests = map.getList("add", MapDto.class); List<MapDto> addRequests = map.getList("add", MapDto.class);
List<Long> deleteIds = map.getList("delete", Long.class); List<Long> deleteIds = map.getList("delete", Long.class);
@ -80,56 +91,73 @@ public class VacationController {
} }
/** /**
* 특정 연월에 대한 휴가 데이터 조회 * 전체 사원의 휴가 조회
* @param year, month
* @return 휴가 데이터 목록
*/ */
@Member @Member
@ParameterCheck @ParameterCheck
@GetMapping("/list/{year}/{month}") @GetMapping("/list/{year}/{month}")
public List<MapDto> getVacations(@PathVariable("year") int year, @PathVariable("month") int month) { public List<MapDto> selectVacations(@PathVariable("year") int year, @PathVariable("month") int month) {
return localVacaService.getVacationList(year, month); return localVacaService.selectVacationList(year, month);
} }
/** /**
* 특정 연월에 대한 공휴일 데이터 조회 * 공휴일 정보 조회
* @param year, month
* @return 공휴일 데이터 목록
*/ */
@Member @Member
@ParameterCheck @ParameterCheck
@GetMapping("/{year}/{month}") @GetMapping("/{year}/{month}")
public List<MapDto> getHolidays(@PathVariable("year") int year, @PathVariable("month") int month) { public List<MapDto> selectHolidays(@PathVariable("year") int year, @PathVariable("month") int month) {
return localVacaService.getHolidays(year, month); return localVacaService.selectHolidays(year, month);
} }
/** /**
* 연차 사용 내역 조회 * 로그인한 회원의 연차 사용 내역 조회
*/ */
@Member @Member
@ParameterCheck @ParameterCheck
@GetMapping("/history") @GetMapping("/history")
public ApiResponse<Map<String, List<MapDto>>> getUserVacationHistory() { public ApiResponse<Map<String, List<MapDto>>> selectUserVacationHistory(@RequestParam("year") int year) {
Long userId = AuthUtil.getUser().getId(); Long userId = AuthUtil.getUser().getId();
return ApiResponse.ok(localVacaService.getUserVacationHistory(userId)); return ApiResponse.ok(localVacaService.selectUserVacationHistory(userId, year));
} }
/**
* 사원별 남은 연차 개수 조회
*/
@Member
@ParameterCheck
@GetMapping("/remaining") @GetMapping("/remaining")
public ApiResponse<List<MapDto>> getRemainingVacation() { public ApiResponse<List<MapDto>> selectRemainingVacation() {
List<MapDto> employeeVacations = localVacaService.getEmployeeRemainingVacation(); List<MapDto> employeeVacations = localVacaService.selectEmployeeRemainingVacation();
return ApiResponse.ok(employeeVacations); return ApiResponse.ok(employeeVacations);
} }
/**
* 휴가 종류 조회(공통코드)
*/
@Member
@ParameterCheck
@GetMapping("/codes") @GetMapping("/codes")
public ApiResponse<List<MapDto>> getVacationCodeNames() { public ApiResponse<List<MapDto>> selectVacationType() {
return ApiResponse.ok(localVacaService.getCommonCodeList()); return ApiResponse.ok(commonCodService.selectVacationType());
} }
/**
* 사원 남은 보내기개수
* @ReqMap map 요청 파라미터 (LOCVACRMM, MEMBERSEQ)
* @return 남은 선물보내기 개수
*/
@Member
@ParameterCheck
@GetMapping("/sent") @GetMapping("/sent")
public ApiResponse<List<MapDto>> getSentVacations(@ReqMap MapDto map) { public ApiResponse<List<MapDto>> selectSentVacationCount(@ReqMap MapDto map) {
Long userId = AuthUtil.getUser().getId(); // 현재 로그인한 사용자 ID Long userId = AuthUtil.getUser().getId();
map.put("userId", userId); map.put("userId", userId);
List<MapDto> sentCount = localVacaService.getSentVacationCount(map); return ApiResponse.ok(localVacaService.selectSentVacationCount(map));
return ApiResponse.ok(sentCount);
} }
} }

View File

@ -36,12 +36,12 @@ public class VoteBoardController {
@Member @Member
@ParameterCheck @ParameterCheck
@GetMapping("getVoteList") @GetMapping("getVoteList")
public ApiResponse<PageInfo<MapDto>> getVoteList(@AuthenticationPrincipal MemberVo memberVo,@ReqMap MapDto map) { public ApiResponse<PageInfo<MapDto>> selectVoteList(@AuthenticationPrincipal MemberVo memberVo,@ReqMap MapDto map) {
//userId //userId
Long userId = AuthUtil.getUser().getId(); Long userId = AuthUtil.getUser().getId();
map.put("userId", userId); map.put("userId", userId);
PageInfo<MapDto> VoteList = localvoteservice.getVoteList(map); PageInfo<MapDto> VoteList = localvoteservice.selectVoteList(map);
return ApiResponse.ok(VoteList); return ApiResponse.ok(VoteList);
@ -90,6 +90,16 @@ public class VoteBoardController {
map.put("userId", userId); map.put("userId", userId);
return ApiResponse.ok(localvoteservice.updateEndData(map)); return ApiResponse.ok(localvoteservice.updateEndData(map));
} }
/**
* 투표 랜덤뽑기
* @param randomList 랜덤리스트 ,voteid 투표 번호
* @return
*/
@Member
@PostMapping("randomList")
public ApiResponse<Long> randomList(@ReqMap MapDto map) {
return ApiResponse.ok(localvoteservice.updateRandomResult(map));
}
} }

View File

@ -88,29 +88,13 @@ public class worddictController {
return ApiResponse.ok( worddictyservice.getWordDetail(map)); return ApiResponse.ok( worddictyservice.getWordDetail(map));
} }
/** /**
* 용어집 카테고리 등록 * 용어 등록 - 카테고리 등록
* @param CMNCODNAM 용어집 등록 카테고리 이름 * @param WRDDICCAT 카테고리 코드값 ,WRDDICTTL 용어,WRDDICCON 내용 ,WRDDICRIK 링크 ,CMNCODNAM 추가 등록 카테고리 이름
* @return
*/
@Member
@ParameterCheck
@PostMapping("insertCategory")
public ApiResponse<Long> insertCategory(@ReqMap MapDto map) {
Long result = commoncodservice.insertCategory(map);
if(result == -1) {
return ApiResponse.okMessage("이미 존재하는 카테고리명입니다.");
}
return ApiResponse.ok(result);
}
/**
* 용어 등록
* @param WRDDICCAT 카테고리 코드값 ,WRDDICTTL 용어,WRDDICCON 내용 ,WRDDICRIK 링크
* @return * @return
*/ */
@Member @Member
@PostMapping("insertWord") @PostMapping("insertWord")
public ApiResponse<Long> insertWord(@AuthenticationPrincipal MemberVo memberVo,@ReqMap MapDto map) { public ApiResponse<Long> insertWord(@AuthenticationPrincipal MemberVo memberVo,@ReqMap MapDto map) {
//userId //userId
//Long userId = AuthUtil.getUser().getId(); //Long userId = AuthUtil.getUser().getId();
//임시 //임시

View File

@ -15,6 +15,27 @@
*************************************************************/ *************************************************************/
package io.company.localhost.controller.common; package io.company.localhost.controller.common;
import static org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices.SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.security.authentication.RememberMeAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.context.SecurityContextHolderStrategy;
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import io.company.localhost.common.annotation.Admin; import io.company.localhost.common.annotation.Admin;
import io.company.localhost.common.annotation.Guest; import io.company.localhost.common.annotation.Guest;
import io.company.localhost.common.annotation.Member; import io.company.localhost.common.annotation.Member;
@ -33,26 +54,6 @@ import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession; import jakarta.servlet.http.HttpSession;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.security.authentication.RememberMeAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.context.SecurityContextHolderStrategy;
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices.SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY;
@Slf4j @Slf4j
@RestController @RestController
@ -71,7 +72,7 @@ public class UserController {
*/ */
@ParameterCheck @ParameterCheck
@GetMapping("/color") @GetMapping("/color")
public ApiResponse<List<MapDto>> selectColorList(String type) { public ApiResponse<List<MapDto>> selectColorList(@RequestParam("type") String type) {
List<MapDto> ColorList = commoncodservice.selectColorList(type); List<MapDto> ColorList = commoncodservice.selectColorList(type);
return ApiResponse.ok(ColorList); return ApiResponse.ok(ColorList);
} }
@ -123,7 +124,7 @@ public class UserController {
* *
*/ */
@GetMapping("/checkId") @GetMapping("/checkId")
public ApiResponse<Boolean> selectCheckId(@RequestParam String memberIds) { public ApiResponse<Boolean> selectCheckId(@RequestParam("memberIds") String memberIds) {
boolean isDuplicate = netmemberservice.selectCheckId(memberIds); boolean isDuplicate = netmemberservice.selectCheckId(memberIds);
return ApiResponse.ok(!isDuplicate); return ApiResponse.ok(!isDuplicate);
} }

View File

@ -11,6 +11,6 @@ public interface VotDetailMapper {
Long insertdetail(MapDto map); Long insertdetail(MapDto map);
List<MapDto> getVoteDetails(int locvotSeq); List<MapDto> selectVoteDetails(int locvotSeq);
} }

View File

@ -11,7 +11,7 @@ public interface VotMemberMapper {
void insertmem(MapDto map); void insertmem(MapDto map);
List<MapDto> getVoteMember(Integer locvotSeq); List<MapDto> selectVoteMember(Integer locvotSeq);

View File

@ -7,7 +7,7 @@ import io.company.localhost.common.dto.MapDto;
@Mapper @Mapper
public interface VotRecordMapper { public interface VotRecordMapper {
int yesVotetotal(MapDto map); int selectYesVotetotal(MapDto map);
Long insertCheckedNums(MapDto map); Long insertCheckedNums(MapDto map);

View File

@ -1,5 +1,7 @@
package io.company.localhost.mapper; package io.company.localhost.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import io.company.localhost.common.dto.MapDto; import io.company.localhost.common.dto.MapDto;
@ -9,4 +11,6 @@ public interface VotchoiceMapper {
void insertChoice(MapDto map); void insertChoice(MapDto map);
List<MapDto> selectVoteResult(Integer locvotSeq);
} }

View File

@ -42,4 +42,6 @@ public interface commoncodMapper {
List<MapDto> selectCategories(); List<MapDto> selectCategories();
Long selectcheckCategoryExists(MapDto map); Long selectcheckCategoryExists(MapDto map);
List<MapDto> selectVacationType();
} }

View File

@ -14,17 +14,15 @@ public interface localvacaMapper {
void deleteVacation(Long vacationId); void deleteVacation(Long vacationId);
List<MapDto> findVacations(@Param("year") int year, @Param("month") int month); List<MapDto> selectVacations(@Param("year") int year, @Param("month") int month);
List<MapDto> getUsedVacations(@Param("userId") Long userId); List<MapDto> selectUsedVacations(@Param("userId") Long userId, @Param("year") int year);
List<MapDto> getReceivedVacations(@Param("userId") Long userId); List<MapDto> selectReceivedVacations(@Param("userId") Long userId, @Param("year") int year);
List<MapDto> getEmployeeRemainingVacation(); List<MapDto> selectEmployeeRemainingVacation();
List<MapDto> getCommonCodeNames(); List<MapDto> selectSentVacationCount(MapDto map);
List<MapDto> countSentVacations(MapDto map);
} }

View File

@ -13,9 +13,11 @@ public interface localvoteMapper {
Long insertVote(MapDto map); Long insertVote(MapDto map);
List<MapDto> getVoteList(MapDto map); List<MapDto> selectVoteList(MapDto map);
Long updateEndData(MapDto map); Long updateEndData(MapDto map);
Long updateRandomResult(MapDto selectedItem);
} }

View File

@ -14,6 +14,7 @@
*************************************************************/ *************************************************************/
package io.company.localhost.service; package io.company.localhost.service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -28,19 +29,11 @@ import lombok.RequiredArgsConstructor;
public class commoncodService { public class commoncodService {
private final commoncodMapper commoncodmapper; private final commoncodMapper commoncodmapper;
public List<MapDto> selectWordCategory() { public List<MapDto> selectWordCategory() {
return commoncodmapper.selectWordCategory(); return commoncodmapper.selectWordCategory();
} }
public Long insertCategory(MapDto map) {
Long count = commoncodmapper.selectcheckCategoryExists(map);
if(count > 0) {
return -1L;
}
return commoncodmapper.insertCategory(map);
}
public List<MapDto> selectColorList(String type) { public List<MapDto> selectColorList(String type) {
return commoncodmapper.selectColorList(type); return commoncodmapper.selectColorList(type);
} }
@ -60,4 +53,11 @@ public class commoncodService {
public List<MapDto> selectCategoryList() { public List<MapDto> selectCategoryList() {
return commoncodmapper.selectCategories(); return commoncodmapper.selectCategories();
} }
public List<MapDto> selectVacationType() {
List<MapDto> codeList = commoncodmapper.selectVacationType();
// 데이터가 비어있으면 리스트 반환 (null 방지)
return (codeList != null) ? codeList : new ArrayList<>();
}
} }

View File

@ -16,6 +16,7 @@ import com.github.pagehelper.PageInfo;
import io.company.localhost.common.dto.MapDto; import io.company.localhost.common.dto.MapDto;
import io.company.localhost.mapper.localbordMapper; import io.company.localhost.mapper.localbordMapper;
import io.company.localhost.utils.AuthUtil;
import io.company.localhost.utils.PageUtil; import io.company.localhost.utils.PageUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -54,6 +55,13 @@ public class localbordService {
} }
public BigInteger insertBoard(MapDto map) { public BigInteger insertBoard(MapDto map) {
// 익명게시판이면 회원 정보를 null로 설정
if ("300102".equals(String.valueOf(map.get("LOCBRDTYP")))) {
map.put("MEMBERSEQ", null);
}else {
Long userId = AuthUtil.getUser().getId();
map.put("MEMBERSEQ", userId);
}
boardMapper.insertBoard(map); boardMapper.insertBoard(map);
return (BigInteger) map.get("LOCBRDSEQ"); return (BigInteger) map.get("LOCBRDSEQ");
} }
@ -126,6 +134,13 @@ public class localbordService {
} }
public void insertCommentOrReply(MapDto map) { public void insertCommentOrReply(MapDto map) {
// 익명게시판이면 회원 정보를 null로 설정
if ("300102".equals(String.valueOf(map.get("LOCBRDTYP")))) {
map.put("MEMBERSEQ", null);
}else {
Long userId = AuthUtil.getUser().getId();
map.put("MEMBERSEQ", userId);
}
if (map.get("LOCCMTPNT") == null) { if (map.get("LOCCMTPNT") == null) {
map.put("LOCCMTPNT", null); map.put("LOCCMTPNT", null);
} }

View File

@ -43,14 +43,14 @@ public class localvacaService {
localvacaMapper.deleteVacation(vacationId); localvacaMapper.deleteVacation(vacationId);
} }
public List<MapDto> getVacationList(int year, int month) { public List<MapDto> selectVacationList(int year, int month) {
return localvacaMapper.findVacations(year, month); return localvacaMapper.selectVacations(year, month);
} }
/** /**
* 🔹 특정 연월에 대한 공휴일 데이터 조회 * 🔹 특정 연월에 대한 공휴일 데이터 조회
*/ */
public List<MapDto> getHolidays(int year, int month) { public List<MapDto> selectHolidays(int year, int month) {
// ServiceKey를 디코딩해서 사용 // ServiceKey를 디코딩해서 사용
String decodedServiceKey = URLDecoder.decode(serviceKey, StandardCharsets.UTF_8); String decodedServiceKey = URLDecoder.decode(serviceKey, StandardCharsets.UTF_8);
System.out.println("📌 디코딩된 ServiceKey: " + decodedServiceKey); System.out.println("📌 디코딩된 ServiceKey: " + decodedServiceKey);
@ -158,9 +158,9 @@ public class localvacaService {
/** /**
* 연차 사용 내역 조회 (사용한 연차 & 받은 연차) * 연차 사용 내역 조회 (사용한 연차 & 받은 연차)
*/ */
public Map<String, List<MapDto>> getUserVacationHistory(Long userId) { public Map<String, List<MapDto>> selectUserVacationHistory(Long userId, int year) {
List<MapDto> usedVacations = localvacaMapper.getUsedVacations(userId); List<MapDto> usedVacations = localvacaMapper.selectUsedVacations(userId,year);
List<MapDto> receivedVacations = localvacaMapper.getReceivedVacations(userId); List<MapDto> receivedVacations = localvacaMapper.selectReceivedVacations(userId,year);
Map<String, List<MapDto>> history = new HashMap<>(); Map<String, List<MapDto>> history = new HashMap<>();
history.put("usedVacations", usedVacations); history.put("usedVacations", usedVacations);
@ -172,8 +172,8 @@ public class localvacaService {
/** /**
* 사원별 남은 연차 개수 조회 * 사원별 남은 연차 개수 조회
*/ */
public List<MapDto> getEmployeeRemainingVacation() { public List<MapDto> selectEmployeeRemainingVacation() {
List<MapDto> employeeVacations = localvacaMapper.getEmployeeRemainingVacation(); List<MapDto> employeeVacations = localvacaMapper.selectEmployeeRemainingVacation();
return employeeVacations.stream().map(emp -> { return employeeVacations.stream().map(emp -> {
// 🔹 hireDate 변환 (포맷 정규화) // 🔹 hireDate 변환 (포맷 정규화)
@ -191,7 +191,7 @@ public class localvacaService {
} }
// 🔹 연차 개수 계산 // 🔹 연차 개수 계산
int totalVacation = calculateTotalVacation(hireDate); int totalVacation = procCalculateTotalVacation(hireDate);
// 🔹 사용한 연차 개수 처리 (null 방지) // 🔹 사용한 연차 개수 처리 (null 방지)
double usedVacation = emp.get("used_quota") != null ? ((Number) emp.get("used_quota")).doubleValue() : 0.0; double usedVacation = emp.get("used_quota") != null ? ((Number) emp.get("used_quota")).doubleValue() : 0.0;
@ -215,7 +215,7 @@ public class localvacaService {
/** /**
* 연차 계산 로직 * 연차 계산 로직
*/ */
private int calculateTotalVacation(LocalDate hireDate) { private int procCalculateTotalVacation(LocalDate hireDate) {
LocalDate today = LocalDate.now(); LocalDate today = LocalDate.now();
int yearsWorked = hireDate.until(today).getYears(); int yearsWorked = hireDate.until(today).getYears();
@ -237,14 +237,7 @@ public class localvacaService {
return totalVacation; return totalVacation;
} }
public List<MapDto> getCommonCodeList() { public List<MapDto> selectSentVacationCount(MapDto map) {
List<MapDto> codeList = localvacaMapper.getCommonCodeNames(); return localvacaMapper.selectSentVacationCount(map);
// 데이터가 비어있으면 리스트 반환 (null 방지)
return (codeList != null) ? codeList : new ArrayList<>();
}
public List<MapDto> getSentVacationCount(MapDto map) {
return localvacaMapper.countSentVacations(map);
} }
} }

View File

@ -2,12 +2,16 @@ package io.company.localhost.service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
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.VotDetailMapper; import io.company.localhost.mapper.VotDetailMapper;
import io.company.localhost.mapper.VotMemberMapper; import io.company.localhost.mapper.VotMemberMapper;
@ -30,7 +34,6 @@ public class localvoteService {
public Long insertVote(MapDto map) { public Long insertVote(MapDto map) {
Long result = 0L; Long result = 0L;
int voteIdInt = 0 ; int voteIdInt = 0 ;
if(map.get("voteId") != null) { if(map.get("voteId") != null) {
voteIdInt = (int) map.get("voteId"); voteIdInt = (int) map.get("voteId");
@ -48,12 +51,11 @@ public class localvoteService {
} }
return result; return result;
} }
public PageInfo<MapDto> selectVoteList(MapDto map) {
public PageInfo<MapDto> getVoteList(MapDto map) {
//투표 목록조회 //투표 목록조회
int page = map.getString("page") != null ? Integer.parseInt(map.getString("page")) : 1; int page = map.getString("page") != null ? Integer.parseInt(map.getString("page")) : 1;
PageHelper.startPage(page, 10); PageHelper.startPage(page, 10);
PageInfo<MapDto> localvote = PageUtil.redefineNavigation(new PageInfo<>(localvotemapper.getVoteList(map),10)); PageInfo<MapDto> localvote = PageUtil.redefineNavigation(new PageInfo<>(localvotemapper.selectVoteList(map),10));
List<MapDto> resultList = new ArrayList<>(); List<MapDto> resultList = new ArrayList<>();
List<MapDto> voteList = localvote.getList(); List<MapDto> voteList = localvote.getList();
@ -63,15 +65,19 @@ public class localvoteService {
voteMap.put("localVote", vote); voteMap.put("localVote", vote);
Integer locvotSeq = (Integer) vote.get("LOCVOTSEQ"); Integer locvotSeq = (Integer) vote.get("LOCVOTSEQ");
//투표 항목조회 //투표 항목조회
List<MapDto> voteDetails = votdetailmapper.getVoteDetails(locvotSeq); List<MapDto> voteDetails = votdetailmapper.selectVoteDetails(locvotSeq);
//투표 가능 멤버 조회 //투표 가능 멤버 조회
List<MapDto> voteMembers = votmembermapper.getVoteMember(locvotSeq); List<MapDto> voteMembers = votmembermapper.selectVoteMember(locvotSeq);
//투표 결과 조회
List<MapDto> voteResult = votchoicemapper.selectVoteResult(locvotSeq);
voteMap.put("voteDetails", voteDetails); voteMap.put("voteDetails", voteDetails);
voteMap.put("voteMembers", voteMembers); voteMap.put("voteMembers", voteMembers);
voteMap.put("voteResult", voteResult);
map.put("id",locvotSeq); map.put("id",locvotSeq);
//투표 여부 //투표 여부
int yesVotetotal = votrecordmapper.yesVotetotal(map); int yesVotetotal = votrecordmapper.selectYesVotetotal(map);
voteMap.put("yesVotetotal", yesVotetotal); voteMap.put("yesVotetotal", yesVotetotal);
resultList.add(voteMap); resultList.add(voteMap);
@ -94,5 +100,23 @@ public class localvoteService {
return localvotemapper.updateEndData(map); return localvotemapper.updateEndData(map);
} }
public Long updateRandomResult(MapDto map) {
Long result = 0L;
ObjectMapper objectMapper = new ObjectMapper();
Object randomListObj = map.get("randomList");
if (randomListObj instanceof List<?>) {
List<?> rawList = (List<?>) randomListObj;
if (!rawList.isEmpty()) {
//랜덤뽑기
Object selectedObj = rawList.get(new Random().nextInt(rawList.size()));
MapDto selectedItem = objectMapper.convertValue(selectedObj, MapDto.class);
selectedItem.put("voteid", map.get("voteid"));
//투표결과 저장
result = localvotemapper.updateRandomResult(selectedItem);
}
}
return result;
}
} }

View File

@ -21,6 +21,7 @@ import java.util.List;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import io.company.localhost.common.dto.MapDto; import io.company.localhost.common.dto.MapDto;
import io.company.localhost.mapper.commoncodMapper;
import io.company.localhost.mapper.worddictyMapper; import io.company.localhost.mapper.worddictyMapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -29,6 +30,8 @@ import lombok.RequiredArgsConstructor;
public class worddictyService { public class worddictyService {
private final worddictyMapper worddictymapper; private final worddictyMapper worddictymapper;
private final commoncodMapper commoncodmapper;
public List<MapDto> getWordList(MapDto map) { public List<MapDto> getWordList(MapDto map) {
List<MapDto> wordList = worddictymapper.getWordList(map); List<MapDto> wordList = worddictymapper.getWordList(map);
@ -59,6 +62,10 @@ public class worddictyService {
} }
public Long insertWord(MapDto map) { public Long insertWord(MapDto map) {
if (map.containsKey("CMNCODNAM") && map.get("CMNCODNAM") != null) {
commoncodmapper.insertCategory(map);
}
return worddictymapper.insertWord(map); return worddictymapper.insertWord(map);
} }

View File

@ -81,6 +81,11 @@ server:
http-only: false http-only: false
secure: true secure: true
same-site: NONE same-site: NONE
partitioned: true
ssl:
key-store: classpath:localhost.p12
key-store-password: pmgk1234
key-store-type: PKCS12
logging: logging:
level: level:

Binary file not shown.

View File

@ -16,7 +16,7 @@
) )
</foreach> </foreach>
</insert> </insert>
<select id="getVoteDetails" parameterType="int" > <select id="selectVoteDetails" parameterType="int" >
select select
* *
from from

View File

@ -11,7 +11,7 @@
(#{voteId}, #{user.id}) (#{voteId}, #{user.id})
</foreach> </foreach>
</insert> </insert>
<select id="getVoteMember" parameterType="int" > <select id="selectVoteMember" parameterType="int" >
SELECT SELECT
a.*, a.*,
n.*, n.*,

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.company.localhost.mapper.VotRecordMapper"> <mapper namespace="io.company.localhost.mapper.VotRecordMapper">
<select id="yesVotetotal" parameterType="map"> <select id="selectYesVotetotal" parameterType="map">
select count(*) as yesvote select count(*) as yesvote
from from
votrecord votrecord

View File

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.company.localhost.mapper.VotchoiceMapper"> <mapper namespace="io.company.localhost.mapper.VotchoiceMapper">
<insert id="insertChoice" parameterType="map">
<insert id="insertChoice" parameterType="map">
INSERT INTO votchoice INSERT INTO votchoice
( (
LOCVOTSEQ LOCVOTSEQ
@ -16,5 +15,21 @@
) )
</foreach> </foreach>
</insert> </insert>
<select id="selectVoteResult" parameterType="int">
SELECT
c.VOTDETSEQ,
v.LOCVOTCON,
COUNT(v.VOTDETSEQ) AS VOTE_COUNT
FROM
votchoice c
LEFT JOIN
votdetail v ON c.LOCVOTSEQ = v.LOCVOTSEQ AND c.VOTDETSEQ = v.VOTDETSEQ
WHERE
c.LOCVOTSEQ = #{LOCVOTSEQ}
GROUP BY
c.LOCVOTSEQ, c.VOTDETSEQ
ORDER BY
VOTE_COUNT DESC
</select>
</mapper> </mapper>

View File

@ -120,4 +120,11 @@
where where
CMNCODNAM = #{CMNCODNAM} CMNCODNAM = #{CMNCODNAM}
</select> </select>
<!-- 공통 코드 목록 조회 -->
<select id="selectVacationType" resultType="io.company.localhost.common.dto.MapDto">
SELECT CMNCODVAL AS code, CMNCODNAM AS name
FROM commoncod
WHERE CMNCODVAL IN ('700101', '700102', '700103')
</select>
</mapper> </mapper>

View File

@ -74,7 +74,8 @@
b.LOCBRDUDT AS date, b.LOCBRDUDT AS date,
b.LOCBRDTYP AS type, b.LOCBRDTYP AS type,
b.LOCBRDCNT AS cnt, b.LOCBRDCNT AS cnt,
m.MEMBERNAM AS author m.MEMBERNAM AS author,
m.MEMBERSEQ AS authorId
FROM localbord b FROM localbord b
LEFT JOIN netmember m ON b.MEMBERSEQ = m.MEMBERSEQ LEFT JOIN netmember m ON b.MEMBERSEQ = m.MEMBERSEQ
WHERE b.LOCBRDSEQ = #{boardId} WHERE b.LOCBRDSEQ = #{boardId}
@ -137,7 +138,8 @@
SELECT SELECT
c.LOCCMTSEQ,c.LOCBRDSEQ,c.LOCCMTPNT,c.LOCCMTRPY, c.LOCCMTSEQ,c.LOCBRDSEQ,c.LOCCMTPNT,c.LOCCMTRPY,
c.LOCCMTUDT,c.LOCCMTPWD,c.LOCCMTRDT,c.LOCCMTPNT, c.LOCCMTUDT,c.LOCCMTPWD,c.LOCCMTRDT,c.LOCCMTPNT,
m.MEMBERNAM AS author m.MEMBERNAM AS author,
m.MEMBERSEQ AS authorId
FROM localcomt c FROM localcomt c
LEFT JOIN netmember m ON c.MEMBERSEQ = m.MEMBERSEQ LEFT JOIN netmember m ON c.MEMBERSEQ = m.MEMBERSEQ
WHERE LOCBRDSEQ = #{LOCBRDSEQ} and LOCCMTPNT = 1 WHERE LOCBRDSEQ = #{LOCBRDSEQ} and LOCCMTPNT = 1
@ -149,7 +151,8 @@
SELECT SELECT
c.LOCCMTSEQ,c.LOCBRDSEQ,c.LOCCMTPNT,c.LOCCMTRPY, c.LOCCMTSEQ,c.LOCBRDSEQ,c.LOCCMTPNT,c.LOCCMTRPY,
c.LOCCMTUDT,c.LOCCMTPWD,c.LOCCMTRDT,c.LOCCMTPNT, c.LOCCMTUDT,c.LOCCMTPWD,c.LOCCMTRDT,c.LOCCMTPNT,
m.MEMBERNAM AS author m.MEMBERNAM AS author,
m.MEMBERSEQ AS authorId
FROM localcomt c FROM localcomt c
LEFT JOIN netmember m ON c.MEMBERSEQ = m.MEMBERSEQ LEFT JOIN netmember m ON c.MEMBERSEQ = m.MEMBERSEQ
WHERE LOCCMTPNT = #{LOCCMTPNT} and LOCCMTPNT != 1 WHERE LOCCMTPNT = #{LOCCMTPNT} and LOCCMTPNT != 1

View File

@ -15,15 +15,15 @@
</delete> </delete>
<!-- 휴가 정보 조회 --> <!-- 휴가 정보 조회 -->
<select id="findVacations" parameterType="map" resultType="io.company.localhost.common.dto.MapDto"> <select id="selectVacations" parameterType="map" resultType="io.company.localhost.common.dto.MapDto">
SELECT LOCVACSEQ, MEMBERSEQ, LOCVACUDT, LOCVACTYP, LOCVACRMM SELECT LOCVACSEQ, MEMBERSEQ, LOCVACUDT, LOCVACTYP, LOCVACRMM
FROM localvaca FROM localvaca
WHERE DATE_FORMAT(LOCVACUDT, '%Y-%m') = CONCAT(#{year}, '-', LPAD(#{month}, 2, '0')) WHERE DATE_FORMAT(LOCVACUDT, '%Y-%m') = CONCAT(#{year}, '-', LPAD(#{month}, 2, '0'))
</select> </select>
<!-- 사용자가 사용한 연차 목록 조회 --> <!-- 사용자가 사용한 연차 목록 조회 -->
<select id="getUsedVacations" resultType="io.company.localhost.common.dto.MapDto"> <select id="selectUsedVacations" resultType="io.company.localhost.common.dto.MapDto">
SELECT LOCVACUDT AS date, LOCVACTYP AS type, LOCVACRMM AS receiverId, SELECT LOCVACSEQ AS id, LOCVACUDT AS date, LOCVACTYP AS type, LOCVACRMM AS receiverId,
-- 반차(700101, 700102)는 0.5, 연차(700103)는 1로 계산 -- 반차(700101, 700102)는 0.5, 연차(700103)는 1로 계산
SUM(CASE SUM(CASE
WHEN LOCVACTYP IN ('700101', '700102') THEN 0.5 WHEN LOCVACTYP IN ('700101', '700102') THEN 0.5
@ -32,16 +32,18 @@
END) AS used_quota END) AS used_quota
FROM localvaca FROM localvaca
WHERE MEMBERSEQ = #{userId} WHERE MEMBERSEQ = #{userId}
AND YEAR(LOCVACUDT) = #{year}
AND DATE_FORMAT(LOCVACUDT, '%Y') = DATE_FORMAT(CURDATE(), '%Y') AND DATE_FORMAT(LOCVACUDT, '%Y') = DATE_FORMAT(CURDATE(), '%Y')
GROUP BY LOCVACUDT, LOCVACTYP, LOCVACRMM GROUP BY LOCVACUDT, LOCVACTYP, LOCVACRMM
ORDER BY LOCVACUDT DESC ORDER BY LOCVACUDT DESC
</select> </select>
<!-- 사용자가 받은 연차 목록 조회 --> <!-- 사용자가 받은 연차 목록 조회 -->
<select id="getReceivedVacations" resultType="io.company.localhost.common.dto.MapDto"> <select id="selectReceivedVacations" resultType="io.company.localhost.common.dto.MapDto">
SELECT LOCVACUDT AS date, LOCVACTYP AS type, MEMBERSEQ AS senderId SELECT LOCVACUDT AS date, LOCVACTYP AS type, MEMBERSEQ AS senderId
FROM localvaca FROM localvaca
WHERE LOCVACRMM = #{userId} WHERE LOCVACRMM = #{userId}
AND YEAR(LOCVACUDT) = #{year}
AND DATE_FORMAT(LOCVACUDT, '%Y') = DATE_FORMAT(CURDATE(), '%Y') AND DATE_FORMAT(LOCVACUDT, '%Y') = DATE_FORMAT(CURDATE(), '%Y')
GROUP BY LOCVACUDT, LOCVACTYP, MEMBERSEQ GROUP BY LOCVACUDT, LOCVACTYP, MEMBERSEQ
ORDER BY LOCVACUDT DESC ORDER BY LOCVACUDT DESC
@ -49,7 +51,7 @@
<!-- 전체 직원 남은 연차 조회 --> <!-- 전체 직원 남은 연차 조회 -->
<select id="getEmployeeRemainingVacation" resultType="io.company.localhost.common.dto.MapDto"> <select id="selectEmployeeRemainingVacation" resultType="io.company.localhost.common.dto.MapDto">
<![CDATA[ <![CDATA[
SELECT SELECT
nm.MEMBERSEQ AS employeeId, nm.MEMBERSEQ AS employeeId,
@ -111,14 +113,7 @@
]]> ]]>
</select> </select>
<!-- 공통 코드 목록 조회 --> <select id="selectSentVacationCount" resultType="io.company.localhost.common.dto.MapDto">
<select id="getCommonCodeNames" resultType="io.company.localhost.common.dto.MapDto">
SELECT CMNCODVAL AS code, CMNCODNAM AS name
FROM commoncod
WHERE CMNCODVAL IN ('700101', '700102', '700103')
</select>
<select id="countSentVacations" resultType="io.company.localhost.common.dto.MapDto">
SELECT COUNT(*) as count FROM localvaca WHERE MEMBERSEQ = #{userId} AND LOCVACRMM = #{receiverId} SELECT COUNT(*) as count FROM localvaca WHERE MEMBERSEQ = #{userId} AND LOCVACRMM = #{receiverId}
</select> </select>

View File

@ -22,7 +22,7 @@
,#{votemMltiIs} ,#{votemMltiIs}
) )
</insert> </insert>
<select id="getVoteList" parameterType="map"> <select id="selectVoteList" parameterType="map">
select select
a.* a.*
,DATE_FORMAT(a.LOCVOTRDT, '%Y-%m-%d %H:%i') AS formatted_LOCVOTRDT ,DATE_FORMAT(a.LOCVOTRDT, '%Y-%m-%d %H:%i') AS formatted_LOCVOTRDT
@ -49,4 +49,11 @@
LOCVOTDDT = now() LOCVOTDDT = now()
WHERE LOCVOTSEQ = #{endVoteId} WHERE LOCVOTSEQ = #{endVoteId}
</update> </update>
<update id="updateRandomResult" parameterType="map">
UPDATE
localvote
SET
LOCVOTRES = #{LOCVOTCON}
WHERE LOCVOTSEQ = #{voteid}
</update>
</mapper> </mapper>