From 83f52fdec0dd4895793d637e7b62d6ce63214e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?qkr7828=28=EB=B0=95=EC=9E=AC=EC=9A=B0=29?= Date: Fri, 2 Sep 2022 16:56:57 +0900 Subject: [PATCH] =?UTF-8?q?Id=20,=20Hpno=20=EC=9D=BC=EC=B9=98=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=9E=88=EC=9D=84=20?= =?UTF-8?q?=EC=8B=9C=20=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=ED=95=98=EB=8A=94=20=EB=A1=9C=EC=A7=81=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AcntCrtfyhpController.java | 20 +++++++++++-- .../crtfyhp/service/AcntCrtfyhpService.java | 29 +++++++++++++++++++ .../pty/PtyCstmrQueryRepository.java | 18 +++++++++++- 3 files changed, 64 insertions(+), 3 deletions(-) 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;