
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
package com.takensoft.cms.mber.web;
import com.takensoft.cms.mber.dto.JoinDTO;
import com.takensoft.cms.mber.dto.PasswordDTO;
import com.takensoft.cms.mber.service.MberService;
import com.takensoft.cms.mber.vo.MberVO;
import com.takensoft.common.exception.IdDuplicationException;
import com.takensoft.common.util.ResponseData;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.nio.charset.Charset;
import java.util.HashMap;
/**
* @author : takensoft
* @since : 2024.04.01
*
* 회원 정보 관련 컨트롤러
*/
@RestController
@RequiredArgsConstructor
@Slf4j
@RequestMapping(value = "/mbr")
public class MberController {
private final MberService mberService;
/**
* @author takensoft
* @since 2024.04.16
* @param
* @return
* @throws Exception
*
* 회원정보 상세 조회
*/
@PostMapping(value = "/findByMbr.json")
public ResponseEntity<?> findByMbr(@RequestBody HashMap<String, Object> params) throws Exception {
// 상세 조회
MberVO result = mberService.findByMbr(params);
// 응답 처리
HttpHeaders headers = new HttpHeaders();
headers.setContentType(new MediaType("application", "json", Charset.forName("UTF-8")));
ResponseData responseData = new ResponseData();
responseData.setStatus(HttpStatus.OK);
responseData.setMessage("정상적으로 회원정보 상세 조회가 처리되었습니다.");
responseData.setData(result);
return new ResponseEntity<>(responseData, headers, HttpStatus.OK);
}
/**
* @author takensoft
* @since 2024.04.15
* @param passwordDTO
* @return
* @throws Exception
*
* 비밀번호 변경
*/
@PostMapping(value = "/updatePassword.json")
public ResponseEntity<?> joinProc(@RequestBody @Valid PasswordDTO passwordDTO) throws Exception {
// 비밀 번호 비교
boolean isExistence = mberService.passwordCheck(passwordDTO);
// 응답 처리
HttpHeaders headers = new HttpHeaders();
headers.setContentType(new MediaType("application", "json", Charset.forName("UTF-8")));
ResponseData responseData = new ResponseData();
if(isExistence) {
responseData.setStatus(HttpStatus.OK);
responseData.setMessage("정상적으로 수정 처리되었습니다.");
return new ResponseEntity<>(responseData, headers, HttpStatus.OK);
} else {
responseData.setStatus(HttpStatus.INTERNAL_SERVER_ERROR);
responseData.setMessage("비밀번호를 확인하세요.");
return new ResponseEntity<>(responseData, headers, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
}