Browse Source

Id , Hpno 일치하는 데이터 있을 시 비밀번호 변경하는 로직 추가

feature/auth
qkr7828(박재우) 2 years ago
parent
commit
83f52fdec0
  1. 20
      src/main/java/com/palnet/biz/api/acnt/crtfyhp/controller/AcntCrtfyhpController.java
  2. 29
      src/main/java/com/palnet/biz/api/acnt/crtfyhp/service/AcntCrtfyhpService.java
  3. 18
      src/main/java/com/palnet/biz/jpa/repository/pty/PtyCstmrQueryRepository.java

20
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;
}
}

29
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;
}
}

18
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;

Loading…
Cancel
Save