Merge branch 'main' into yoon
This commit is contained in:
commit
a7e3dfd23d
45
Jenkinsfile
vendored
Normal file
45
Jenkinsfile
vendored
Normal 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
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@ plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot' version "${springBootVersion}"
|
||||
id 'io.spring.dependency-management' version "${springDependencyManagementVersion}"
|
||||
id 'war'
|
||||
}
|
||||
|
||||
group = "${projectGroup}"
|
||||
@ -77,6 +78,7 @@ dependencies {
|
||||
implementation 'org.springframework.boot:spring-boot-actuator-autoconfigure'
|
||||
/*implementation 'org.springframework.boot:spring-boot-starter-batch'*/
|
||||
|
||||
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
|
||||
|
||||
/** spring-boot-starter-security */
|
||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||
|
||||
@ -80,8 +80,7 @@ public class BoardController {
|
||||
@ParameterCheck
|
||||
@PostMapping
|
||||
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()) { // 빈 값 체크
|
||||
String rawPassword = map.getString("LOCBRDPWD");
|
||||
@ -204,9 +203,6 @@ public class BoardController {
|
||||
@ParameterCheck
|
||||
@PostMapping("/{LOCBRDSEQ}/comment")
|
||||
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()) { // 빈 값 체크
|
||||
String rawPassword = map.getString("LOCCMTPWD");
|
||||
String hashedPassword = passwordEncoder.encode(rawPassword);
|
||||
|
||||
@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.company.localhost.common.annotation.Member;
|
||||
@ -29,11 +30,17 @@ import lombok.extern.slf4j.Slf4j;
|
||||
public class VacationController {
|
||||
|
||||
private final localvacaService localVacaService;
|
||||
private final commoncodService commonCodService;
|
||||
|
||||
/**
|
||||
* 휴가 선물하기
|
||||
* @ReqMap map 요청 파라미터 (LOCVACTYP, LOCVACRDT, LOCVACUDT, LOCVACRMM, MEMBERSEQ)
|
||||
* @return 결과 메시지
|
||||
*/
|
||||
@Member
|
||||
@ParameterCheck
|
||||
@PostMapping
|
||||
public ApiResponse<?> saveVacations(@RequestBody List<MapDto> list) {
|
||||
public ApiResponse<?> insertVacations(@RequestBody List<MapDto> list) {
|
||||
Long user = AuthUtil.getUser().getId();
|
||||
for (MapDto request : list) {
|
||||
String date = request.getString("date");
|
||||
@ -45,7 +52,6 @@ public class VacationController {
|
||||
throw new IllegalArgumentException("요청 데이터에 누락된 값이 있습니다: " + request);
|
||||
}
|
||||
|
||||
// count 필드가 있으면, 해당 값만큼 반복해서 insert
|
||||
Integer count = request.getInt("count");
|
||||
if (count == null || count < 1) {
|
||||
count = 1;
|
||||
@ -57,10 +63,15 @@ public class VacationController {
|
||||
return ApiResponse.ok("모든 휴가가 성공적으로 저장되었습니다.");
|
||||
}
|
||||
|
||||
/**
|
||||
* 휴가 저장/수정
|
||||
* @ReqMap map 요청 파라미터 (LOCVACTYP, LOCVACRDT, LOCVACUDT, MEMBERSEQ / LOCVACSEQ)
|
||||
* @return 결과 메시지
|
||||
*/
|
||||
@Member
|
||||
@ParameterCheck
|
||||
@PostMapping("/batchUpdate")
|
||||
public ApiResponse<?> batchUpdateVacations(@ReqMap MapDto map) {
|
||||
public ApiResponse<?> saveVacations(@ReqMap MapDto map) {
|
||||
Long user = AuthUtil.getUser().getId();
|
||||
List<MapDto> addRequests = map.getList("add", MapDto.class);
|
||||
List<Long> deleteIds = map.getList("delete", Long.class);
|
||||
@ -80,56 +91,73 @@ public class VacationController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 연월에 대한 휴가 데이터 조회
|
||||
* 전체 사원의 휴가 조회
|
||||
* @param year, month
|
||||
* @return 휴가 데이터 목록
|
||||
*/
|
||||
@Member
|
||||
@ParameterCheck
|
||||
@GetMapping("/list/{year}/{month}")
|
||||
public List<MapDto> getVacations(@PathVariable("year") int year, @PathVariable("month") int month) {
|
||||
return localVacaService.getVacationList(year, month);
|
||||
public List<MapDto> selectVacations(@PathVariable("year") int year, @PathVariable("month") int month) {
|
||||
return localVacaService.selectVacationList(year, month);
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 연월에 대한 공휴일 데이터 조회
|
||||
* 공휴일 정보 조회
|
||||
* @param year, month
|
||||
* @return 공휴일 데이터 목록
|
||||
*/
|
||||
@Member
|
||||
@ParameterCheck
|
||||
@GetMapping("/{year}/{month}")
|
||||
public List<MapDto> getHolidays(@PathVariable("year") int year, @PathVariable("month") int month) {
|
||||
return localVacaService.getHolidays(year, month);
|
||||
public List<MapDto> selectHolidays(@PathVariable("year") int year, @PathVariable("month") int month) {
|
||||
return localVacaService.selectHolidays(year, month);
|
||||
}
|
||||
|
||||
/**
|
||||
* 내 연차 사용 내역 조회
|
||||
* 로그인한 회원의 연차 사용 내역 조회
|
||||
*/
|
||||
@Member
|
||||
@ParameterCheck
|
||||
@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();
|
||||
return ApiResponse.ok(localVacaService.getUserVacationHistory(userId));
|
||||
return ApiResponse.ok(localVacaService.selectUserVacationHistory(userId, year));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 사원별 남은 연차 개수 조회
|
||||
*/
|
||||
@Member
|
||||
@ParameterCheck
|
||||
@GetMapping("/remaining")
|
||||
public ApiResponse<List<MapDto>> getRemainingVacation() {
|
||||
List<MapDto> employeeVacations = localVacaService.getEmployeeRemainingVacation();
|
||||
public ApiResponse<List<MapDto>> selectRemainingVacation() {
|
||||
List<MapDto> employeeVacations = localVacaService.selectEmployeeRemainingVacation();
|
||||
return ApiResponse.ok(employeeVacations);
|
||||
}
|
||||
|
||||
/**
|
||||
* 휴가 종류 조회(공통코드)
|
||||
*/
|
||||
@Member
|
||||
@ParameterCheck
|
||||
@GetMapping("/codes")
|
||||
public ApiResponse<List<MapDto>> getVacationCodeNames() {
|
||||
return ApiResponse.ok(localVacaService.getCommonCodeList());
|
||||
public ApiResponse<List<MapDto>> selectVacationType() {
|
||||
return ApiResponse.ok(commonCodService.selectVacationType());
|
||||
}
|
||||
|
||||
/**
|
||||
* 사원 별 남은 보내기개수
|
||||
* @ReqMap map 요청 파라미터 (LOCVACRMM, MEMBERSEQ)
|
||||
* @return 남은 선물보내기 개수
|
||||
*/
|
||||
@Member
|
||||
@ParameterCheck
|
||||
@GetMapping("/sent")
|
||||
public ApiResponse<List<MapDto>> getSentVacations(@ReqMap MapDto map) {
|
||||
Long userId = AuthUtil.getUser().getId(); // 현재 로그인한 사용자 ID
|
||||
public ApiResponse<List<MapDto>> selectSentVacationCount(@ReqMap MapDto map) {
|
||||
Long userId = AuthUtil.getUser().getId();
|
||||
map.put("userId", userId);
|
||||
List<MapDto> sentCount = localVacaService.getSentVacationCount(map);
|
||||
|
||||
|
||||
return ApiResponse.ok(sentCount);
|
||||
return ApiResponse.ok(localVacaService.selectSentVacationCount(map));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -36,12 +36,12 @@ public class VoteBoardController {
|
||||
@Member
|
||||
@ParameterCheck
|
||||
@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
|
||||
Long userId = AuthUtil.getUser().getId();
|
||||
map.put("userId", userId);
|
||||
PageInfo<MapDto> VoteList = localvoteservice.getVoteList(map);
|
||||
PageInfo<MapDto> VoteList = localvoteservice.selectVoteList(map);
|
||||
|
||||
|
||||
return ApiResponse.ok(VoteList);
|
||||
@ -90,6 +90,16 @@ public class VoteBoardController {
|
||||
map.put("userId", userId);
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -88,29 +88,13 @@ public class worddictController {
|
||||
return ApiResponse.ok( worddictyservice.getWordDetail(map));
|
||||
}
|
||||
/**
|
||||
* 용어집 카테고리 등록
|
||||
* @param 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 링크
|
||||
* 용어 등록 - 카테고리 등록
|
||||
* @param WRDDICCAT 카테고리 코드값 ,WRDDICTTL 용어,WRDDICCON 내용 ,WRDDICRIK 링크 ,CMNCODNAM 추가 등록 카테고리 이름
|
||||
* @return
|
||||
*/
|
||||
@Member
|
||||
@PostMapping("insertWord")
|
||||
public ApiResponse<Long> insertWord(@AuthenticationPrincipal MemberVo memberVo,@ReqMap MapDto map) {
|
||||
|
||||
//userId
|
||||
//Long userId = AuthUtil.getUser().getId();
|
||||
//임시
|
||||
|
||||
@ -15,6 +15,27 @@
|
||||
*************************************************************/
|
||||
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.Guest;
|
||||
import io.company.localhost.common.annotation.Member;
|
||||
@ -33,26 +54,6 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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
|
||||
@RestController
|
||||
@ -71,7 +72,7 @@ public class UserController {
|
||||
*/
|
||||
@ParameterCheck
|
||||
@GetMapping("/color")
|
||||
public ApiResponse<List<MapDto>> selectColorList(String type) {
|
||||
public ApiResponse<List<MapDto>> selectColorList(@RequestParam("type") String type) {
|
||||
List<MapDto> ColorList = commoncodservice.selectColorList(type);
|
||||
return ApiResponse.ok(ColorList);
|
||||
}
|
||||
@ -123,7 +124,7 @@ public class UserController {
|
||||
*
|
||||
*/
|
||||
@GetMapping("/checkId")
|
||||
public ApiResponse<Boolean> selectCheckId(@RequestParam String memberIds) {
|
||||
public ApiResponse<Boolean> selectCheckId(@RequestParam("memberIds") String memberIds) {
|
||||
boolean isDuplicate = netmemberservice.selectCheckId(memberIds);
|
||||
return ApiResponse.ok(!isDuplicate);
|
||||
}
|
||||
|
||||
@ -11,6 +11,6 @@ public interface VotDetailMapper {
|
||||
|
||||
Long insertdetail(MapDto map);
|
||||
|
||||
List<MapDto> getVoteDetails(int locvotSeq);
|
||||
List<MapDto> selectVoteDetails(int locvotSeq);
|
||||
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ public interface VotMemberMapper {
|
||||
|
||||
void insertmem(MapDto map);
|
||||
|
||||
List<MapDto> getVoteMember(Integer locvotSeq);
|
||||
List<MapDto> selectVoteMember(Integer locvotSeq);
|
||||
|
||||
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ import io.company.localhost.common.dto.MapDto;
|
||||
@Mapper
|
||||
public interface VotRecordMapper {
|
||||
|
||||
int yesVotetotal(MapDto map);
|
||||
int selectYesVotetotal(MapDto map);
|
||||
|
||||
Long insertCheckedNums(MapDto map);
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package io.company.localhost.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import io.company.localhost.common.dto.MapDto;
|
||||
@ -9,4 +11,6 @@ public interface VotchoiceMapper {
|
||||
|
||||
void insertChoice(MapDto map);
|
||||
|
||||
List<MapDto> selectVoteResult(Integer locvotSeq);
|
||||
|
||||
}
|
||||
|
||||
@ -42,4 +42,6 @@ public interface commoncodMapper {
|
||||
List<MapDto> selectCategories();
|
||||
|
||||
Long selectcheckCategoryExists(MapDto map);
|
||||
|
||||
List<MapDto> selectVacationType();
|
||||
}
|
||||
|
||||
@ -14,17 +14,15 @@ public interface localvacaMapper {
|
||||
|
||||
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> countSentVacations(MapDto map);
|
||||
List<MapDto> selectSentVacationCount(MapDto map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -13,9 +13,11 @@ public interface localvoteMapper {
|
||||
|
||||
Long insertVote(MapDto map);
|
||||
|
||||
List<MapDto> getVoteList(MapDto map);
|
||||
List<MapDto> selectVoteList(MapDto map);
|
||||
|
||||
Long updateEndData(MapDto map);
|
||||
|
||||
Long updateRandomResult(MapDto selectedItem);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
*************************************************************/
|
||||
package io.company.localhost.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -33,14 +34,6 @@ public class commoncodService {
|
||||
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) {
|
||||
return commoncodmapper.selectColorList(type);
|
||||
}
|
||||
@ -60,4 +53,11 @@ public class commoncodService {
|
||||
public List<MapDto> selectCategoryList() {
|
||||
return commoncodmapper.selectCategories();
|
||||
}
|
||||
|
||||
public List<MapDto> selectVacationType() {
|
||||
List<MapDto> codeList = commoncodmapper.selectVacationType();
|
||||
|
||||
// 데이터가 비어있으면 빈 리스트 반환 (null 방지)
|
||||
return (codeList != null) ? codeList : new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import com.github.pagehelper.PageInfo;
|
||||
|
||||
import io.company.localhost.common.dto.MapDto;
|
||||
import io.company.localhost.mapper.localbordMapper;
|
||||
import io.company.localhost.utils.AuthUtil;
|
||||
import io.company.localhost.utils.PageUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@ -54,6 +55,13 @@ public class localbordService {
|
||||
}
|
||||
|
||||
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);
|
||||
return (BigInteger) map.get("LOCBRDSEQ");
|
||||
}
|
||||
@ -126,6 +134,13 @@ public class localbordService {
|
||||
}
|
||||
|
||||
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) {
|
||||
map.put("LOCCMTPNT", null);
|
||||
}
|
||||
|
||||
@ -43,14 +43,14 @@ public class localvacaService {
|
||||
localvacaMapper.deleteVacation(vacationId);
|
||||
}
|
||||
|
||||
public List<MapDto> getVacationList(int year, int month) {
|
||||
return localvacaMapper.findVacations(year, month);
|
||||
public List<MapDto> selectVacationList(int year, int month) {
|
||||
return localvacaMapper.selectVacations(year, month);
|
||||
}
|
||||
|
||||
/**
|
||||
* 🔹 특정 연월에 대한 공휴일 데이터 조회
|
||||
*/
|
||||
public List<MapDto> getHolidays(int year, int month) {
|
||||
public List<MapDto> selectHolidays(int year, int month) {
|
||||
// ✅ ServiceKey를 디코딩해서 사용
|
||||
String decodedServiceKey = URLDecoder.decode(serviceKey, StandardCharsets.UTF_8);
|
||||
System.out.println("📌 디코딩된 ServiceKey: " + decodedServiceKey);
|
||||
@ -158,9 +158,9 @@ public class localvacaService {
|
||||
/**
|
||||
* 내 연차 사용 내역 조회 (사용한 연차 & 받은 연차)
|
||||
*/
|
||||
public Map<String, List<MapDto>> getUserVacationHistory(Long userId) {
|
||||
List<MapDto> usedVacations = localvacaMapper.getUsedVacations(userId);
|
||||
List<MapDto> receivedVacations = localvacaMapper.getReceivedVacations(userId);
|
||||
public Map<String, List<MapDto>> selectUserVacationHistory(Long userId, int year) {
|
||||
List<MapDto> usedVacations = localvacaMapper.selectUsedVacations(userId,year);
|
||||
List<MapDto> receivedVacations = localvacaMapper.selectReceivedVacations(userId,year);
|
||||
|
||||
Map<String, List<MapDto>> history = new HashMap<>();
|
||||
history.put("usedVacations", usedVacations);
|
||||
@ -172,8 +172,8 @@ public class localvacaService {
|
||||
/**
|
||||
* 사원별 남은 연차 개수 조회
|
||||
*/
|
||||
public List<MapDto> getEmployeeRemainingVacation() {
|
||||
List<MapDto> employeeVacations = localvacaMapper.getEmployeeRemainingVacation();
|
||||
public List<MapDto> selectEmployeeRemainingVacation() {
|
||||
List<MapDto> employeeVacations = localvacaMapper.selectEmployeeRemainingVacation();
|
||||
|
||||
return employeeVacations.stream().map(emp -> {
|
||||
// 🔹 hireDate 변환 (포맷 정규화)
|
||||
@ -191,7 +191,7 @@ public class localvacaService {
|
||||
}
|
||||
|
||||
// 🔹 총 연차 개수 계산
|
||||
int totalVacation = calculateTotalVacation(hireDate);
|
||||
int totalVacation = procCalculateTotalVacation(hireDate);
|
||||
|
||||
// 🔹 사용한 연차 개수 처리 (null 방지)
|
||||
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();
|
||||
int yearsWorked = hireDate.until(today).getYears();
|
||||
|
||||
@ -237,14 +237,7 @@ public class localvacaService {
|
||||
return totalVacation;
|
||||
}
|
||||
|
||||
public List<MapDto> getCommonCodeList() {
|
||||
List<MapDto> codeList = localvacaMapper.getCommonCodeNames();
|
||||
|
||||
// 데이터가 비어있으면 빈 리스트 반환 (null 방지)
|
||||
return (codeList != null) ? codeList : new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<MapDto> getSentVacationCount(MapDto map) {
|
||||
return localvacaMapper.countSentVacations(map);
|
||||
public List<MapDto> selectSentVacationCount(MapDto map) {
|
||||
return localvacaMapper.selectSentVacationCount(map);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,12 +2,16 @@ package io.company.localhost.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import io.company.localhost.common.dto.ApiResponse;
|
||||
import io.company.localhost.common.dto.MapDto;
|
||||
import io.company.localhost.mapper.VotDetailMapper;
|
||||
import io.company.localhost.mapper.VotMemberMapper;
|
||||
@ -30,7 +34,6 @@ public class localvoteService {
|
||||
public Long insertVote(MapDto map) {
|
||||
|
||||
Long result = 0L;
|
||||
|
||||
int voteIdInt = 0 ;
|
||||
if(map.get("voteId") != null) {
|
||||
voteIdInt = (int) map.get("voteId");
|
||||
@ -48,12 +51,11 @@ public class localvoteService {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public PageInfo<MapDto> getVoteList(MapDto map) {
|
||||
public PageInfo<MapDto> selectVoteList(MapDto map) {
|
||||
//투표 목록조회
|
||||
int page = map.getString("page") != null ? Integer.parseInt(map.getString("page")) : 1;
|
||||
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> voteList = localvote.getList();
|
||||
@ -63,15 +65,19 @@ public class localvoteService {
|
||||
voteMap.put("localVote", vote);
|
||||
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("voteMembers", voteMembers);
|
||||
voteMap.put("voteResult", voteResult);
|
||||
|
||||
map.put("id",locvotSeq);
|
||||
//투표 여부
|
||||
int yesVotetotal = votrecordmapper.yesVotetotal(map);
|
||||
int yesVotetotal = votrecordmapper.selectYesVotetotal(map);
|
||||
voteMap.put("yesVotetotal", yesVotetotal);
|
||||
|
||||
resultList.add(voteMap);
|
||||
@ -94,5 +100,23 @@ public class localvoteService {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import io.company.localhost.common.dto.MapDto;
|
||||
import io.company.localhost.mapper.commoncodMapper;
|
||||
import io.company.localhost.mapper.worddictyMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@ -29,6 +30,8 @@ import lombok.RequiredArgsConstructor;
|
||||
public class worddictyService {
|
||||
|
||||
private final worddictyMapper worddictymapper;
|
||||
private final commoncodMapper commoncodmapper;
|
||||
|
||||
|
||||
public List<MapDto> getWordList(MapDto map) {
|
||||
List<MapDto> wordList = worddictymapper.getWordList(map);
|
||||
@ -59,6 +62,10 @@ public class worddictyService {
|
||||
}
|
||||
|
||||
public Long insertWord(MapDto map) {
|
||||
|
||||
if (map.containsKey("CMNCODNAM") && map.get("CMNCODNAM") != null) {
|
||||
commoncodmapper.insertCategory(map);
|
||||
}
|
||||
return worddictymapper.insertWord(map);
|
||||
}
|
||||
|
||||
|
||||
@ -81,6 +81,11 @@ server:
|
||||
http-only: false
|
||||
secure: true
|
||||
same-site: NONE
|
||||
partitioned: true
|
||||
ssl:
|
||||
key-store: classpath:localhost.p12
|
||||
key-store-password: pmgk1234
|
||||
key-store-type: PKCS12
|
||||
|
||||
logging:
|
||||
level:
|
||||
|
||||
BIN
src/main/resources/localhost.p12
Normal file
BIN
src/main/resources/localhost.p12
Normal file
Binary file not shown.
@ -16,7 +16,7 @@
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<select id="getVoteDetails" parameterType="int" >
|
||||
<select id="selectVoteDetails" parameterType="int" >
|
||||
select
|
||||
*
|
||||
from
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
(#{voteId}, #{user.id})
|
||||
</foreach>
|
||||
</insert>
|
||||
<select id="getVoteMember" parameterType="int" >
|
||||
<select id="selectVoteMember" parameterType="int" >
|
||||
SELECT
|
||||
a.*,
|
||||
n.*,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?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">
|
||||
<mapper namespace="io.company.localhost.mapper.VotRecordMapper">
|
||||
<select id="yesVotetotal" parameterType="map">
|
||||
<select id="selectYesVotetotal" parameterType="map">
|
||||
select count(*) as yesvote
|
||||
from
|
||||
votrecord
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<?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">
|
||||
<mapper namespace="io.company.localhost.mapper.VotchoiceMapper">
|
||||
|
||||
<insert id="insertChoice" parameterType="map">
|
||||
INSERT INTO votchoice
|
||||
(
|
||||
@ -16,5 +15,21 @@
|
||||
)
|
||||
</foreach>
|
||||
</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>
|
||||
|
||||
@ -120,4 +120,11 @@
|
||||
where
|
||||
CMNCODNAM = #{CMNCODNAM}
|
||||
</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>
|
||||
|
||||
@ -74,7 +74,8 @@
|
||||
b.LOCBRDUDT AS date,
|
||||
b.LOCBRDTYP AS type,
|
||||
b.LOCBRDCNT AS cnt,
|
||||
m.MEMBERNAM AS author
|
||||
m.MEMBERNAM AS author,
|
||||
m.MEMBERSEQ AS authorId
|
||||
FROM localbord b
|
||||
LEFT JOIN netmember m ON b.MEMBERSEQ = m.MEMBERSEQ
|
||||
WHERE b.LOCBRDSEQ = #{boardId}
|
||||
@ -137,7 +138,8 @@
|
||||
SELECT
|
||||
c.LOCCMTSEQ,c.LOCBRDSEQ,c.LOCCMTPNT,c.LOCCMTRPY,
|
||||
c.LOCCMTUDT,c.LOCCMTPWD,c.LOCCMTRDT,c.LOCCMTPNT,
|
||||
m.MEMBERNAM AS author
|
||||
m.MEMBERNAM AS author,
|
||||
m.MEMBERSEQ AS authorId
|
||||
FROM localcomt c
|
||||
LEFT JOIN netmember m ON c.MEMBERSEQ = m.MEMBERSEQ
|
||||
WHERE LOCBRDSEQ = #{LOCBRDSEQ} and LOCCMTPNT = 1
|
||||
@ -149,7 +151,8 @@
|
||||
SELECT
|
||||
c.LOCCMTSEQ,c.LOCBRDSEQ,c.LOCCMTPNT,c.LOCCMTRPY,
|
||||
c.LOCCMTUDT,c.LOCCMTPWD,c.LOCCMTRDT,c.LOCCMTPNT,
|
||||
m.MEMBERNAM AS author
|
||||
m.MEMBERNAM AS author,
|
||||
m.MEMBERSEQ AS authorId
|
||||
FROM localcomt c
|
||||
LEFT JOIN netmember m ON c.MEMBERSEQ = m.MEMBERSEQ
|
||||
WHERE LOCCMTPNT = #{LOCCMTPNT} and LOCCMTPNT != 1
|
||||
|
||||
@ -15,15 +15,15 @@
|
||||
</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
|
||||
FROM localvaca
|
||||
WHERE DATE_FORMAT(LOCVACUDT, '%Y-%m') = CONCAT(#{year}, '-', LPAD(#{month}, 2, '0'))
|
||||
</select>
|
||||
|
||||
<!-- 사용자가 사용한 연차 목록 조회 -->
|
||||
<select id="getUsedVacations" resultType="io.company.localhost.common.dto.MapDto">
|
||||
SELECT LOCVACUDT AS date, LOCVACTYP AS type, LOCVACRMM AS receiverId,
|
||||
<select id="selectUsedVacations" resultType="io.company.localhost.common.dto.MapDto">
|
||||
SELECT LOCVACSEQ AS id, LOCVACUDT AS date, LOCVACTYP AS type, LOCVACRMM AS receiverId,
|
||||
-- 반차(700101, 700102)는 0.5, 연차(700103)는 1로 계산
|
||||
SUM(CASE
|
||||
WHEN LOCVACTYP IN ('700101', '700102') THEN 0.5
|
||||
@ -32,16 +32,18 @@
|
||||
END) AS used_quota
|
||||
FROM localvaca
|
||||
WHERE MEMBERSEQ = #{userId}
|
||||
AND YEAR(LOCVACUDT) = #{year}
|
||||
AND DATE_FORMAT(LOCVACUDT, '%Y') = DATE_FORMAT(CURDATE(), '%Y')
|
||||
GROUP BY LOCVACUDT, LOCVACTYP, LOCVACRMM
|
||||
ORDER BY LOCVACUDT DESC
|
||||
</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
|
||||
FROM localvaca
|
||||
WHERE LOCVACRMM = #{userId}
|
||||
AND YEAR(LOCVACUDT) = #{year}
|
||||
AND DATE_FORMAT(LOCVACUDT, '%Y') = DATE_FORMAT(CURDATE(), '%Y')
|
||||
GROUP BY LOCVACUDT, LOCVACTYP, MEMBERSEQ
|
||||
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[
|
||||
SELECT
|
||||
nm.MEMBERSEQ AS employeeId,
|
||||
@ -111,14 +113,7 @@
|
||||
]]>
|
||||
</select>
|
||||
|
||||
<!-- 공통 코드 목록 조회 -->
|
||||
<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 id="selectSentVacationCount" resultType="io.company.localhost.common.dto.MapDto">
|
||||
SELECT COUNT(*) as count FROM localvaca WHERE MEMBERSEQ = #{userId} AND LOCVACRMM = #{receiverId}
|
||||
</select>
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
,#{votemMltiIs}
|
||||
)
|
||||
</insert>
|
||||
<select id="getVoteList" parameterType="map">
|
||||
<select id="selectVoteList" parameterType="map">
|
||||
select
|
||||
a.*
|
||||
,DATE_FORMAT(a.LOCVOTRDT, '%Y-%m-%d %H:%i') AS formatted_LOCVOTRDT
|
||||
@ -49,4 +49,11 @@
|
||||
LOCVOTDDT = now()
|
||||
WHERE LOCVOTSEQ = #{endVoteId}
|
||||
</update>
|
||||
<update id="updateRandomResult" parameterType="map">
|
||||
UPDATE
|
||||
localvote
|
||||
SET
|
||||
LOCVOTRES = #{LOCVOTCON}
|
||||
WHERE LOCVOTSEQ = #{voteid}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user