|
|
@@ -25,100 +25,109 @@ public class TsfGiftcardService {
|
|
|
|
|
|
@Autowired
|
|
|
private TsfGiftcardDao giftcardDao;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private Yes24Giftcard yes24Gift;
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 상품권정보 조회
|
|
|
*
|
|
|
* @param GiftCard
|
|
|
* @author sowon
|
|
|
* @since 2021. 3. 12
|
|
|
- */
|
|
|
+ */
|
|
|
public GiftCard getGiftcardInfo(GiftCard giftcard) {
|
|
|
-
|
|
|
+
|
|
|
// 고객번호 설정
|
|
|
int custNo = TsfSession.getInfo().getCustNo();
|
|
|
giftcard.setCustNo(custNo);
|
|
|
-
|
|
|
- return giftcardDao.getGiftcardInfo(giftcard);
|
|
|
+
|
|
|
+ return giftcardDao.getGiftcardInfo(giftcard);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 상품권 사용 정보 조회
|
|
|
*
|
|
|
* @param GiftCard
|
|
|
* @author sowon
|
|
|
* @since 2021. 3. 12
|
|
|
- */
|
|
|
- public Collection<GiftCard> getGiftcardUseList(GiftCard giftcard){
|
|
|
+ */
|
|
|
+ public Collection<GiftCard> getGiftcardUseList(GiftCard giftcard) {
|
|
|
// 고객번호 설정
|
|
|
int custNo = TsfSession.getInfo().getCustNo();
|
|
|
giftcard.setCustNo(custNo);
|
|
|
giftcard.setMonthLength(giftcard.getMonth().length());
|
|
|
-
|
|
|
+
|
|
|
return giftcardDao.getGiftcardUseList(giftcard);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 상품권 보유 조회
|
|
|
*
|
|
|
* @param GiftCard
|
|
|
* @author sowon
|
|
|
* @since 2021. 3. 12
|
|
|
- */
|
|
|
- public Collection<GiftCard> getGiftcardOwnList(GiftCard giftcard){
|
|
|
+ */
|
|
|
+ public Collection<GiftCard> getGiftcardOwnList(GiftCard giftcard) {
|
|
|
// 고객번호 설정
|
|
|
int custNo = TsfSession.getInfo().getCustNo();
|
|
|
giftcard.setCustNo(custNo);
|
|
|
-
|
|
|
+
|
|
|
return giftcardDao.getGiftcardOwnList(giftcard);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 상품권 저장
|
|
|
*
|
|
|
* @param GiftCard
|
|
|
* @author sowon
|
|
|
- * @throws Exception
|
|
|
+ * @throws Exception
|
|
|
* @since 2021. 3. 15
|
|
|
- */
|
|
|
- public void getGiftcardUseConfirm(GiftCard giftcard) throws Exception{
|
|
|
+ */
|
|
|
+ public void getGiftcardUseConfirm(GiftCard giftcard) throws Exception {
|
|
|
// 고객번호 설정
|
|
|
int custNo = TsfSession.getInfo().getCustNo();
|
|
|
- giftcard.setCustNo(custNo);
|
|
|
-
|
|
|
String ip = TsfSession.getIpAddress();
|
|
|
- String pubNo = giftcard.getGfcdNo();
|
|
|
-// String result =yes24Gift.soapDataTransfer(pubNo,ip,custNo);
|
|
|
-
|
|
|
- String result ="00|승인금액|사용시작일|사용종료일|승인번호";
|
|
|
- String[] param = result.split("|");
|
|
|
- String cfcdNo = param[3];
|
|
|
- System.out.println(cfcdNo);
|
|
|
-
|
|
|
-// if(result.equals("01")) {
|
|
|
-// throw new IllegalArgumentException("존재하지 않는 상품권입니다.");
|
|
|
-// }else if(result.equals("02")) {
|
|
|
-// throw new IllegalArgumentException("이미 등록된 상품권입니다.");
|
|
|
-// }else if(result.equals("03")) {
|
|
|
-// throw new IllegalArgumentException("삭제된 상품권입니다.");
|
|
|
-// }else if(result.equals("04")) {
|
|
|
-// throw new IllegalArgumentException("기간이 만료된 상품권입니다.");
|
|
|
-// }else if(result.equals("99")) {
|
|
|
-// throw new IllegalArgumentException("시스템 오류입니다.");
|
|
|
-// }else {
|
|
|
-//
|
|
|
-// String[] param = result.split("|");
|
|
|
-//
|
|
|
-//
|
|
|
-// }
|
|
|
-
|
|
|
+ giftcard.setCustNo(custNo);
|
|
|
+ giftcard.setIpAddr(ip); // 아이피주소
|
|
|
|
|
|
|
|
|
+ String pubNo = giftcard.getGfcdNo();
|
|
|
+ String result =yes24Gift.soapDataTransfer(pubNo,ip,custNo);
|
|
|
+
|
|
|
+ if (result.equals("01")) {
|
|
|
+ giftcard.setResultVal(result); //승인금액
|
|
|
+ giftcardDao.saveGiftcardApi(giftcard);
|
|
|
+ throw new IllegalArgumentException("존재하지 않는 상품권입니다.");
|
|
|
+ } else if (result.equals("02")) {
|
|
|
+ giftcard.setResultVal(result); //승인금액
|
|
|
+ giftcardDao.saveGiftcardApi(giftcard);
|
|
|
+ throw new IllegalArgumentException("이미 등록된 상품권입니다.");
|
|
|
+ } else if (result.equals("03")) {
|
|
|
+ giftcard.setResultVal(result); //승인금액
|
|
|
+ giftcardDao.saveGiftcardApi(giftcard);
|
|
|
+ throw new IllegalArgumentException("삭제된 상품권입니다.");
|
|
|
+ } else if (result.equals("04")) {
|
|
|
+ giftcard.setResultVal(result); //승인금액
|
|
|
+ giftcardDao.saveGiftcardApi(giftcard);
|
|
|
+ throw new IllegalArgumentException("기간이 만료된 상품권입니다.");
|
|
|
+ } else if (result.equals("99")) {
|
|
|
+ giftcard.setResultVal(result); //승인금액
|
|
|
+ giftcardDao.saveGiftcardApi(giftcard);
|
|
|
+ throw new IllegalArgumentException("시스템 오류입니다.");
|
|
|
+ } else {
|
|
|
+ String[] param = result.split("[|]");
|
|
|
+ //System.out.println(param[0]); -- 승인번호 00
|
|
|
+ giftcard.setResultVal(result); //승인금액
|
|
|
+ giftcardDao.saveGiftcardApi(giftcard);
|
|
|
+
|
|
|
+ // tb_cust_giftcard에 등록
|
|
|
+ giftcard.setChgGfcdAmt(Integer.parseInt(param[1])); // 승인금액
|
|
|
+
|
|
|
+ giftcard.setUseStDate(param[2]);
|
|
|
+ giftcard.setUseExpDate(param[3]);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
|
|
|
}
|