diff --git a/src/main/java/com/palnet/biz/api/acnt/crtfyhp/controller/AcntCrtfyhpController.java b/src/main/java/com/palnet/biz/api/acnt/crtfyhp/controller/AcntCrtfyhpController.java index a3c7f5a..b4fb9ba 100644 --- a/src/main/java/com/palnet/biz/api/acnt/crtfyhp/controller/AcntCrtfyhpController.java +++ b/src/main/java/com/palnet/biz/api/acnt/crtfyhp/controller/AcntCrtfyhpController.java @@ -8,6 +8,7 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -113,7 +114,7 @@ public class AcntCrtfyhpController { log.info("result>>>>>>>>>>>>>>>>>>>>>>>> {}",result); return result; - } + } @GetMapping(value = "/find/findUserId") public String findUserId(String memberName, String hpno) throws Exception{ String result = service.findUserId(memberName,hpno); @@ -122,5 +123,20 @@ public class AcntCrtfyhpController { return result; } - + @GetMapping(value = "/find/sendForPw") + public boolean certifNumPw(String userId, String hpno) throws Exception{ + boolean result = service.certifPw(userId, hpno); + + log.info("result>>>>>>>>>>>>>>>>>>>>>>>> {}",result); + + return result; + } + @PutMapping(value = "/find/updatePw") + public boolean updatePw(String userId, String hpno, String newPw) throws Exception{ + boolean result = service.updatePw(userId, hpno, newPw); + + log.info("result>>>>>>>>>>>>>>>>>>>>>>>> {}",result); + + return result; + } } diff --git a/src/main/java/com/palnet/biz/api/acnt/crtfyhp/service/AcntCrtfyhpService.java b/src/main/java/com/palnet/biz/api/acnt/crtfyhp/service/AcntCrtfyhpService.java index ce08b11..7d56657 100644 --- a/src/main/java/com/palnet/biz/api/acnt/crtfyhp/service/AcntCrtfyhpService.java +++ b/src/main/java/com/palnet/biz/api/acnt/crtfyhp/service/AcntCrtfyhpService.java @@ -91,6 +91,9 @@ public class AcntCrtfyhpService { @Autowired private PtyCrtfyhpBasRepository ptyCrtfyhpBasRepository; + @Autowired + private PtyCstmrBasRepository ptyCstmrBasRepository; + @Autowired private SuredataRepository sureDataRepository; @@ -212,10 +215,36 @@ public class AcntCrtfyhpService { } return certifNum; } + public String findUserId(String memberName, String hpno) throws Exception{ String name = EncryptUtils.encrypt(memberName); String phone = EncryptUtils.encrypt(hpno); String resultFindId = cstmrQuery.findUserId(name,phone); return resultFindId; } + + public boolean certifPw(String userId, String hpno) throws Exception{ + String phone = EncryptUtils.encrypt(hpno); + PtyCstmrBas certifNum = cstmrQuery.findUserPw(userId , phone); + boolean result = false; + if(certifNum != null) { + certifySend(hpno); + result = true; + } + return result; + } + + public boolean updatePw(String userId, String hpno, String newPw) throws Exception{ + String phone = EncryptUtils.encrypt(hpno); + PtyCstmrBas certifNum = cstmrQuery.findUserPw(userId , phone); + boolean result = false; + if(certifNum != null) { + String encryptPw = EncryptUtils.sha256Encrypt(newPw); + certifNum.setUserPswd(encryptPw); + certifNum.setPswdUpdtDt(DateUtils.nowDate()); + ptyCstmrBasRepository.save(certifNum); + result = true; + } + return result; + } } diff --git a/src/main/java/com/palnet/biz/jpa/repository/pty/PtyCstmrQueryRepository.java b/src/main/java/com/palnet/biz/jpa/repository/pty/PtyCstmrQueryRepository.java index 9b187f6..6c59ae4 100644 --- a/src/main/java/com/palnet/biz/jpa/repository/pty/PtyCstmrQueryRepository.java +++ b/src/main/java/com/palnet/biz/jpa/repository/pty/PtyCstmrQueryRepository.java @@ -85,7 +85,23 @@ public class PtyCstmrQueryRepository{ String userId = entity.getUserId(); return userId; } - + public PtyCstmrBas findUserPw(String id , String hpno) { + QPtyCstmrBas bas = QPtyCstmrBas.ptyCstmrBas; + QPtyCstmrDtl dtl = QPtyCstmrDtl.ptyCstmrDtl; + + BooleanBuilder builder = new BooleanBuilder(); + builder.and(bas.cstmrStatusCd.eq("A")); + builder.and(dtl.hpno.eq(hpno)); + builder.and(bas.userId.eq(id)); + PtyCstmrBas entity = query.select(bas) + .from(bas) + .leftJoin(dtl) + .on(bas.cstmrSno.eq(dtl.cstmrSno)) + .where(builder) + .fetchFirst(); + + return entity; + } public boolean findCstmrByHpno(String hpno) { boolean result = false;