diff --git a/src/main/java/dao/AccountDao.java b/src/main/java/dao/AccountDao.java index 7a0971f0..113e722d 100644 --- a/src/main/java/dao/AccountDao.java +++ b/src/main/java/dao/AccountDao.java @@ -19,6 +19,38 @@ public class AccountDao { public static AccountDao getInstance() { return dao; } + + public AccountDto selectAccountByUserId(String userId) { + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + + Account account = null; + + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement("SELECT * FROM account WHERE user_id = ?"); + pstmt.setString(1, userId); + rs = pstmt.executeQuery(); + + while (rs.next()) { + account = Account.builder() + .id(rs.getLong("id")) + .userId(rs.getString("user_id")) + .accountNum(rs.getString("account_num")) + .balance(rs.getLong("balance")) + .bankName(rs.getString("bank_name")) + .isStopped(rs.getInt("is_stopped")) + .build(); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + dbUtil.close(rs, pstmt, conn); + } + return new AccountDto(account); + } + public AccountDto selectAccountByCardId(Long cardId) { Connection conn = null; PreparedStatement pstmt = null; @@ -64,6 +96,23 @@ public AccountDto selectAccountByCardId(Long cardId) { } return dto; } + + public void updateAccountByAccountId(Long accountId, Long balance) throws SQLException { + Connection conn = null; + PreparedStatement pstmt = null; + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement("UPDATE account SET balance = ? WHERE account_id = ?"); + pstmt.setLong(1, balance); + pstmt.setLong(2, accountId); + pstmt.executeUpdate(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + dbUtil.close(pstmt, conn); + } + } + public void updateBalance(Long accountId, Long money) throws SQLException { Connection conn = null; @@ -100,6 +149,8 @@ public void updateBalance(Long accountId, Long money) throws SQLException { } } + + public List selectAccount(String userId) { Connection conn = null; PreparedStatement pstmt = null; diff --git a/src/main/java/dao/CardDao.java b/src/main/java/dao/CardDao.java index 3013476d..931e8197 100644 --- a/src/main/java/dao/CardDao.java +++ b/src/main/java/dao/CardDao.java @@ -1,6 +1,7 @@ package dao; import java.sql.Connection; + import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -10,10 +11,12 @@ import db.DBUtil; import domain.Card; import domain.Product; +import dto.CardDto; import dto.CardResponseDto; import dto.CardHistoryResponseDto; import dto.CardInsertDto; import dto.CheckCardDaoToServiceDto; +import dto.CreditCardDaoToServiceDto; import dto.ProductDto; import exception.BusinessException; import exception.ErrorCode; @@ -25,6 +28,259 @@ public class CardDao { public static CardDao getInstance() { return dao; } + + + // 하나의 카드 발급 내역 조회 + public CardDto selectOneCardByCardId(Long cardId) { + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + + Card card = null; + + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement ( + "select * from card where id=?"); + pstmt.setLong(1, cardId); + + rs = pstmt.executeQuery(); + + if (rs.next()) { + card = Card.builder() + .id(rs.getLong("id")) + .productId(rs.getLong("product_id")) + .accountId(rs.getLong("")) + .issuedDate(rs.getString("issued_date")) + .cardType(rs.getString("card_type")) + .validity(rs.getString("validity")) + .agency(rs.getString("agency")) + .issuer(rs.getString("issuer")) + .isStopped(rs.getInt("is_stopped")) + .cardNum(rs.getString("card_num")) + .totalPayment(rs.getLong("total_payment")) + .build(); + } + + } catch (Exception e) { + e.printStackTrace(); + System.out.println("카드 정보가 존재하지 않음."); + } finally { + try { + dbUtil.close(rs); + dbUtil.close(pstmt); + } catch (Exception e) { + e.printStackTrace(); + } + } + + return new CardDto(card); + } + + // 정지되지 않은 모든 신용카드 발급 내역 조회 + public ArrayList selectAllNonStopedCreditCard() { + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + + ArrayList cardList = new ArrayList<>(); + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement ("select * from card where is_stopped=0 and card_type like '신용%' order by id"); + rs = pstmt.executeQuery(); + + + + while (rs.next()) { + Card card = Card.builder() + .id(rs.getLong("id")) + .productId(rs.getLong("product_id")) + .accountId(rs.getLong("account_id")) + .issuedDate(rs.getString("issued_date")) + .cardType(rs.getString("card_type")) + .validity(rs.getString("validity")) + .agency(rs.getString("agency")) + .issuer(rs.getString("issuer")) + .isStopped(rs.getInt("is_stopped")) + .cardNum(rs.getString("card_num")) + .totalPayment(rs.getLong("total_payment")) + .build(); + + cardList.add(new CardDto(card)); + } + + } catch (Exception e) { + e.printStackTrace(); + System.out.println("카드 정보가 존재하지 않음."); + } finally { + try { + dbUtil.close(rs); + dbUtil.close(pstmt); + dbUtil.close(conn); + } catch (Exception e) { + e.printStackTrace(); + } + } + + return cardList; + } + + // 카드의 현재 월 총 결제 액수 업데이트 + public void updateTotalPaymentByCardId(Long totalPayment, Long cardId) throws SQLException{ + Connection conn = null; + PreparedStatement pstmt = null; + int rs = 0; + + try { + conn = dbUtil.getConnection(); + pstmt.getConnection().prepareStatement("update card set total_payment=? where id=?"); + pstmt.setLong(1,totalPayment); + pstmt.setLong(2, cardId); + + rs = pstmt.executeUpdate(); + + } catch (Exception e) { + e.printStackTrace(); + System.out.println("해당 카드의 데이터가 존재하지않습니다."); + } finally { + try { + pstmt.close(); + dbUtil.close(pstmt); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + + + // 카드의 정지 업데이트 + public void updateIsStoppedByCardId(Long cardId, int isStopped) throws SQLException{ + Connection conn = null; + PreparedStatement pstmt = null; + int rs = 0; + + try { + conn = dbUtil.getConnection(); + pstmt.getConnection().prepareStatement("update card set is_stopped=? where id=?"); + pstmt.setLong(1, isStopped); + pstmt.setLong(2, cardId); + + rs = pstmt.executeUpdate(); + + } catch (Exception e) { + e.printStackTrace(); + System.out.println("해당 카드의 데이터가 존재하지않습니다."); + } finally { + try { + pstmt.close(); + dbUtil.close(pstmt); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + + // 제휴관련 데이터까지 가져오는 카드정보 조회 + public CreditCardDaoToServiceDto selectCreditCardByProductId(Long productId) { + Connection conn = null; + PreparedStatement pstmt = null; + Card card = null; + CreditCardDaoToServiceDto dto = null; + ResultSet rs = null; + try { + Class.forName("com.mysql.cj.jdbc.Driver"); + } catch (ClassNotFoundException e) { + throw new RuntimeException("Cannot find the driver in the classpath!", e); + } + + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement( + "SELECT c.id,c.product_id,c.card_type,c.validity,c.agency,c.issuer,c.is_stopped,c.card_num, c.account_id,sc.discount, p.category_id FROM card c JOIN product p ON c.product_id = p.id JOIN sale_category sc ON p.category_id = sc.id WHERE c.product_id =?;"); + pstmt.setLong(1, productId); + + rs = pstmt.executeQuery(); + if (rs.next()) { + card = new Card().builder() + .id(rs.getLong("id")) + .productId(rs.getLong("product_id")) + .cardNum(rs.getString("card_num")) + .cardType(rs.getString("card_type")) + .validity(rs.getString("validity")) + .agency(rs.getString("agency")) + .issuer(rs.getString("issuer")) + .isStopped(rs.getInt("is_stopped")) + .build(); + + dto = new CreditCardDaoToServiceDto(card, rs.getLong("account_id"), rs.getLong("discount"), rs.getLong("category_id")); + + } else { + throw new BusinessException(ErrorCode.UNABLE_CARDNUM, "존재하지 않는 카드번호입니다."); + } + + } catch (BusinessException | SQLException e) { + System.out.println("찾을 수 없는 카드거나 계좌입니다: " + e.getMessage()); + } + + finally { + try { + dbUtil.close(rs); + dbUtil.close(pstmt); + } catch (Exception e) { + e.printStackTrace(); + } + } + return dto; + } + + + // 해당 계좌에 연결된 모든 카드 목록 조회 + public ArrayList selectAllCardByAccountId(Long accountId) { + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + + ArrayList cardList = new ArrayList<>(); + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement ("select * from card where accountId=?;"); + rs = pstmt.executeQuery(); + + while (rs.next()) { + Card card = Card.builder() + .id(rs.getLong("id")) + .productId(rs.getLong("product_id")) + .accountId(rs.getLong("accpimt_id")) + .issuedDate(rs.getString("issued_date")) + .cardType(rs.getString("card_type")) + .validity(rs.getString("validity")) + .agency(rs.getString("agency")) + .issuer(rs.getString("issuer")) + .isStopped(rs.getInt("is_stopped")) + .cardNum(rs.getString("card_num")) + .totalPayment(rs.getLong("total_payment")) + .build(); + + cardList.add(new CardDto(card)); + } + + } catch (Exception e) { + e.printStackTrace(); + System.out.println("카드 정보가 존재하지 않음."); + } finally { + try { + dbUtil.close(rs); + dbUtil.close(pstmt); + dbUtil.close(conn); + } catch (Exception e) { + e.printStackTrace(); + } + } + return cardList; + } + public static ArrayList showPayCardList() throws SQLException { Connection conn = null; PreparedStatement pstmt = null; diff --git a/src/main/java/dao/CardHistoryDao.java b/src/main/java/dao/CardHistoryDao.java index 17c5b755..02baaeed 100644 --- a/src/main/java/dao/CardHistoryDao.java +++ b/src/main/java/dao/CardHistoryDao.java @@ -17,6 +17,8 @@ import dto.AccountDto; import dto.CheckCardDaoToServiceDto; import dto.CheckCardHistoryDto; +import dto.CreditCardHistoryCreateDto; +import dto.CreditCardHistoryDto; import dto.CardHistoryResponseDto; import exception.BusinessException; @@ -40,17 +42,18 @@ public ArrayList showPayCardList() throws SQLException { while (rs.next()) { cardHistory = CardHistory.builder() .id(rs.getLong("id")) - .cardId(rs.getLong("card_id")) - .userId(rs.getString("user_id")) - .franchisee(rs.getString("franchisee")) - .payment(rs.getInt("payment")) - .balance(rs.getInt("balance")) - .date(rs.getString("date")) - .fCategory(rs.getInt("f_category")) - .isIns(rs.getInt("is_ins")) - .insMonth(rs.getInt("ins_month")) - .cardType(rs.getString("card_type")) - .build(); + .cardId(rs.getLong("card_id")) + .userId(rs.getString("user_id")) + .franchisee(rs.getString("franchisee")) + .payment(rs.getLong("payment")) + .balance(rs.getLong("balance")) + .isSuccess(rs.getInt("is_success")) + .date(rs.getTimestamp("date").toLocalDateTime()) + .fCategory(rs.getLong("f_category")) + .isIns(rs.getInt("is_ins")) + .insMonth(rs.getInt("ins_month")) + .cardType(rs.getString("card_type")) + .build(); cardPayList.add(CardHistoryResponseDto.of(cardHistory)); } } catch(Exception e) { @@ -62,6 +65,139 @@ public ArrayList showPayCardList() throws SQLException { } + // 신용카드 결제내역 반환 + public ArrayList selectAllNonInstallmentCrditCardHistoryByCardId(Long cardId) throws SQLException { + ArrayList list = new ArrayList<>(); + + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + + try { + conn = dbUtil.getConnection(); + // 해당 월 명세서는 다음달로 넘어가는 자정에 생성하므로 + // 조건에 맞는 이전달 모든 결제 목록을 가져온다. + pstmt = conn.prepareStatement("SELECT * FROM card_history WHERE is_success=1 and card_id=? and is_ins=0 and DATE_FORMAT(date, '%Y-%m') = CASE WHEN MONTH(CURDATE()) = 1 THEN CONCAT(YEAR(CURDATE()) - 1, '-12') ELSE DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 1 MONTH), '%Y-%m') END;"); + pstmt.setLong(1,cardId); + rs = pstmt.executeQuery();//select실행 + + while (rs.next()) { + CardHistory creditCardHistory = CardHistory.builder() + .id(rs.getLong("id")) + .cardId(rs.getLong("card_id")) + .userId(rs.getString("user_id")) + .franchisee(rs.getString("franchisee")) + .payment(rs.getLong("payment")) + .balance(rs.getLong("balance")) + .isSuccess(rs.getInt("is_success")) + .date(rs.getTimestamp("date").toLocalDateTime()) + .fCategory(rs.getLong("f_category")) + .isIns(rs.getInt("is_ins")) + .insMonth(rs.getInt("ins_month")) + .cardType(rs.getString("card_type")) + .build(); + + + + list.add(new CreditCardHistoryDto(creditCardHistory)); + + } + }catch (Exception e) { + e.printStackTrace(); + System.out.println("카드 사용내역 데이터가 존재하지 않습니다."); + }finally { + try { + dbUtil.close(rs, pstmt, conn); + } catch (Exception e) { + e.printStackTrace(); + } + } + return list; + } + + + // 신용카드 DB에 카드 결제 내역 저장 + public void insertCreditCardHistory(CreditCardHistoryCreateDto creditCardHistoryCreateDto) throws SQLException { + Connection conn = null; + PreparedStatement pstmt = null; + + CardHistory creditCardHistory = creditCardHistoryCreateDto.toEntity(); + + try { + //3. sql문 실행 + conn = dbUtil.getConnection(); + StringBuilder d = new StringBuilder(); + d.append("insert into card_history (card_id, user_id, franchisee, payment, balance, is_success, date, f_category, is_ins, ins_month, card_type) \n"); + d.append("values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); + pstmt = conn.prepareStatement(d.toString()); + pstmt.setLong(1, creditCardHistory.getCardId()); + pstmt.setString(2, creditCardHistory.getUserId()); + pstmt.setString(3, creditCardHistory.getFranchisee()); + pstmt.setLong(4, creditCardHistory.getPayment()); + pstmt.setLong(5, creditCardHistory.getBalance()); + pstmt.setInt(6, creditCardHistory.getIsSuccess()); + pstmt.setTimestamp(7, Timestamp.valueOf(creditCardHistory.getDate())); + pstmt.setLong(8, creditCardHistory.getFCategory()); + pstmt.setInt(9, creditCardHistory.getIsIns()); + pstmt.setInt(10, creditCardHistory.getInsMonth()); + pstmt.setString(11, creditCardHistory.getCardType()); + + pstmt.executeUpdate();//insert실행 + System.out.println("신용카드 사용내역 insert 실행"); + } finally { + dbUtil.close(pstmt, conn); + } + } + + + // 신용카드 결제내역 반환 + public ArrayList selectAllCrditCardHistory() throws SQLException { + ArrayList list = new ArrayList<>(); + + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement("select * from card_history where card_type like '신용%';"); + rs = pstmt.executeQuery();//select실행 + + while(rs.next()) { + CardHistory creditCardHistory = CardHistory.builder() + .id(rs.getLong("id")) + .cardId(rs.getLong("card_id")) + .userId(rs.getString("user_id")) + .franchisee(rs.getString("franchisee")) + .payment(rs.getLong("payment")) + .balance(rs.getLong("balance")) + .isSuccess(rs.getInt("is_success")) + .date(rs.getTimestamp("date").toLocalDateTime()) + .fCategory(rs.getLong("f_category")) + .isIns(rs.getInt("is_ins")) + .insMonth(rs.getInt("ins_month")) + .cardType(rs.getString("card_type")) + .build(); + + + + list.add(new CreditCardHistoryDto(creditCardHistory)); + + } + }catch (Exception e) { + e.printStackTrace(); + System.out.println("데이터가 존재하지 않습니다."); + }finally { + try { + dbUtil.close(rs, pstmt, conn); + } catch (Exception e) { + e.printStackTrace(); + } + } + return list; + } + + public ArrayList showSearchUidCardList(String keyword) throws SQLException { Connection conn = null; PreparedStatement pstmt = null; @@ -79,17 +215,18 @@ public ArrayList showSearchUidCardList(String keyword) t cardHistory = CardHistory.builder() .id(rs.getLong("id")) - .cardId(rs.getLong("card_id")) - .userId(rs.getString("user_id")) - .franchisee(rs.getString("franchisee")) - .payment(rs.getInt("payment")) - .balance(rs.getInt("balance")) - .date(rs.getString("date")) - .fCategory(rs.getInt("f_category")) - .isIns(rs.getInt("is_ins")) - .insMonth(rs.getInt("ins_month")) - .cardType(rs.getString("card_type")) - .build(); + .cardId(rs.getLong("card_id")) + .userId(rs.getString("user_id")) + .franchisee(rs.getString("franchisee")) + .payment(rs.getLong("payment")) + .balance(rs.getLong("balance")) + .isSuccess(rs.getInt("is_success")) + .date(rs.getTimestamp("date").toLocalDateTime()) + .fCategory(rs.getLong("f_category")) + .isIns(rs.getInt("is_ins")) + .insMonth(rs.getInt("ins_month")) + .cardType(rs.getString("card_type")) + .build(); searchUidCardPayList.add(CardHistoryResponseDto.of(cardHistory)); } @@ -117,17 +254,18 @@ public ArrayList showSearchUserCardList(String userId, l while (rs.next()) { cardHistory = CardHistory.builder() .id(rs.getLong("id")) - .cardId(rs.getLong("card_id")) - .userId(rs.getString("user_id")) - .franchisee(rs.getString("franchisee")) - .payment(rs.getInt("payment")) - .balance(rs.getInt("balance")) - .date(rs.getString("date")) - .fCategory(rs.getInt("f_category")) - .isIns(rs.getInt("is_ins")) - .insMonth(rs.getInt("ins_month")) - .cardType(rs.getString("card_type")) - .build(); + .cardId(rs.getLong("card_id")) + .userId(rs.getString("user_id")) + .franchisee(rs.getString("franchisee")) + .payment(rs.getLong("payment")) + .balance(rs.getLong("balance")) + .isSuccess(rs.getInt("is_success")) + .date(rs.getTimestamp("date").toLocalDateTime()) + .fCategory(rs.getLong("f_category")) + .isIns(rs.getInt("is_ins")) + .insMonth(rs.getInt("ins_month")) + .cardType(rs.getString("card_type")) + .build(); // CardHistoryResponseDto data = new CardHistoryResponseDto(); // data.setId(rs.getLong("id")); // data.setCardId(rs.getLong("card_id")); @@ -170,17 +308,18 @@ public ArrayList showSearchCardList(long keyword) throws while (rs.next()) { cardHistory = CardHistory.builder() .id(rs.getLong("id")) - .cardId(rs.getLong("card_id")) - .userId(rs.getString("user_id")) - .franchisee(rs.getString("franchisee")) - .payment(rs.getInt("payment")) - .balance(rs.getInt("balance")) - .date(rs.getString("date")) - .fCategory(rs.getInt("f_category")) - .isIns(rs.getInt("is_ins")) - .insMonth(rs.getInt("ins_month")) - .cardType(rs.getString("card_type")) - .build(); + .cardId(rs.getLong("card_id")) + .userId(rs.getString("user_id")) + .franchisee(rs.getString("franchisee")) + .payment(rs.getLong("payment")) + .balance(rs.getLong("balance")) + .isSuccess(rs.getInt("is_success")) + .date(rs.getTimestamp("date").toLocalDateTime()) + .fCategory(rs.getLong("f_category")) + .isIns(rs.getInt("is_ins")) + .insMonth(rs.getInt("ins_month")) + .cardType(rs.getString("card_type")) + .build(); searchCardPayList.add(CardHistoryResponseDto.of(cardHistory)); } @@ -210,17 +349,18 @@ public ArrayList showMonthlyCardList(String option) thro while (rs.next()) { cardHistory = CardHistory.builder() .id(rs.getLong("id")) - .cardId(rs.getLong("card_id")) - .userId(rs.getString("user_id")) - .franchisee(rs.getString("franchisee")) - .payment(rs.getInt("payment")) - .balance(rs.getInt("balance")) - .date(rs.getString("date")) - .fCategory(rs.getInt("f_category")) - .isIns(rs.getInt("is_ins")) - .insMonth(rs.getInt("ins_month")) - .cardType(rs.getString("card_type")) - .build(); + .cardId(rs.getLong("card_id")) + .userId(rs.getString("user_id")) + .franchisee(rs.getString("franchisee")) + .payment(rs.getLong("payment")) + .balance(rs.getLong("balance")) + .isSuccess(rs.getInt("is_success")) + .date(rs.getTimestamp("date").toLocalDateTime()) + .fCategory(rs.getLong("f_category")) + .isIns(rs.getInt("is_ins")) + .insMonth(rs.getInt("ins_month")) + .cardType(rs.getString("card_type")) + .build(); monthlyCardPayList.add(CardHistoryResponseDto.of(cardHistory)); } diff --git a/src/main/java/dao/InstallmentDao.java b/src/main/java/dao/InstallmentDao.java new file mode 100644 index 00000000..fe5cba60 --- /dev/null +++ b/src/main/java/dao/InstallmentDao.java @@ -0,0 +1,119 @@ +package dao; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.time.LocalDate; +import java.util.ArrayList; + +import db.DBUtil; +import domain.Installment; +import dto.InstallmentCreateDto; +import dto.InstallmentDto; +import dto.InstallmentUpdateDto; + +public class InstallmentDao { + static DBUtil dbUtil = DBUtil.getInstance(); + + // 할부 결제 추가 + public void insertInstallment(InstallmentCreateDto data) throws SQLException { + Connection conn = null; + PreparedStatement pstmt = null; + + try { + conn = dbUtil.getConnection(); + StringBuilder d = new StringBuilder(); + + d.append( + "insert into installment(user_id, card_id, ins_month, remain_month, payment, is_inspayed, payment_date) \n"); + d.append("?,?,?,?,?,?,?"); + + pstmt.getConnection().prepareStatement(d.toString()); + pstmt.setString(1,data.getUserId()); + pstmt.setLong(2,data.getCardId()); + pstmt.setInt(3,data.getInsMonth()); + pstmt.setInt(4,data.getRemainMonth()); + pstmt.setLong(5,data.getPayment()); + pstmt.setInt(6,data.getIsInspayed()); + pstmt.setTimestamp(7,Timestamp.valueOf(data.getPaymentDate().atStartOfDay())); + + pstmt.executeUpdate(); + System.out.println("할부 테이블에 insert실행하였습니다."); + } finally { + dbUtil.close(pstmt,conn); + } + } + + // 할부 내역 업데이트 (매월 정기 결제일에 진행) + public void updateInstallment(InstallmentUpdateDto installmentUpdateDto) throws SQLException { + Connection conn = null; + PreparedStatement pstmt = null; + + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement("update installment set reamin_month = ?, is_inspayed=? where id=?"); + pstmt.setInt(1, installmentUpdateDto.getRemainMonth()); + pstmt.setInt(2, installmentUpdateDto.getIsInspayed()); + pstmt.setLong(3, installmentUpdateDto.getId()); + + pstmt.executeUpdate(); + + } catch (Exception e) { + e.printStackTrace(); + System.out.println("존재하지 않는 할부 내역입니다."); + } finally { + try { + dbUtil.close(pstmt,conn); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + // cardId로 해당카드로 결제한 모든 할부내역 반환 + public ArrayList selectAllNonIsInspayedInstallmentByCardId(Long cardId) throws SQLException { + ArrayList list = new ArrayList<>(); + + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement("select * from installment where id=? and remain_month >0"); + pstmt.setLong(1, cardId); + rs = pstmt.executeQuery();//select실행 + + while(rs.next()) { + Installment installment = Installment.builder() + .id(rs.getLong("id")) + .userId(rs.getString("user_id")) + .cardID(rs.getLong("card_id")) + .insMonth(rs.getInt("ins_month")) + .remainMonth(rs.getInt("remain_month")) + .payment(rs.getLong("payment")) + .isInspayed(rs.getInt("is_inspayed")) + .paymentDate(rs.getTimestamp("payment_date").toLocalDateTime().toLocalDate()) + .build(); + + list.add(new InstallmentDto(installment)); + } + + } catch (Exception e) { + e.printStackTrace(); + System.out.println("cardId :" + cardId + " 에 해당하는 데이터가 존재하지 않습니다."); + } finally { + try { + dbUtil.close(rs, pstmt, conn); + } catch (Exception e) { + e.printStackTrace(); + } + } + + return list; + } + + +} \ No newline at end of file diff --git a/src/main/java/dao/MonthlyCreditDao.java b/src/main/java/dao/MonthlyCreditDao.java new file mode 100644 index 00000000..7f6c05e0 --- /dev/null +++ b/src/main/java/dao/MonthlyCreditDao.java @@ -0,0 +1,282 @@ +package dao; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; + +import dto.MonthlyCreditDto; +import dto.MonthlyCreditUpdateDto; +import domain.MonthlyCredit; +import dto.MonthlyCreditCreateDto; +import db.DBUtil; + +public class MonthlyCreditDao { + + static DBUtil dbUtil = DBUtil.getInstance(); + + public void insertMonthlyCredit(MonthlyCreditCreateDto monthlyCreditCreateDto) throws SQLException { + Connection conn = null; + PreparedStatement pstmt = null; + + MonthlyCredit monthlyCredit = monthlyCreditCreateDto.toEntity(); + + try { + //3. sql문 실행 + conn = dbUtil.getConnection(); + StringBuilder d = new StringBuilder(); + d.append("insert into monthly_credit (user_id, card_id, discount, total, pay, is_payed, delay_days, delay_price, start_date, end_date, title) \n"); + d.append("values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); + pstmt = conn.prepareStatement(d.toString()); + pstmt.setString(1, monthlyCredit.getUserId()); + pstmt.setLong(2, monthlyCredit.getCardId()); + pstmt.setLong(3, monthlyCredit.getDiscount()); + pstmt.setLong(4, monthlyCredit.getTotal()); + pstmt.setLong(5, monthlyCredit.getPay()); + pstmt.setInt(6, monthlyCredit.getIsPayed()); + pstmt.setInt(7, monthlyCredit.getDelayDays()); + pstmt.setLong(8, monthlyCredit.getDelayPrice()); + pstmt.setTimestamp(9, Timestamp.valueOf(monthlyCredit.getStartDate().atStartOfDay())); + pstmt.setTimestamp(10, Timestamp.valueOf(monthlyCredit.getEndDate().atStartOfDay())); + pstmt.setString(11, monthlyCredit.getTitle()); + pstmt.executeUpdate();//insert실행 + } finally { + dbUtil.close(pstmt, conn); + } + } + + public MonthlyCreditDto selectMonthlyCrditByMonthlyCreditId(Long monthlyCreditId) throws SQLException { + //ArrayList monthlyCreditList = new ArrayList<>(); + + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + + MonthlyCredit monthlyCredit = null; + + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement("select * from monthly_credit where id=?"); + pstmt.setLong(1,monthlyCreditId); + rs = pstmt.executeQuery();//select실행 + + if(rs.next()) { + monthlyCredit = MonthlyCredit.builder() + .id(rs.getLong("id")) + .userId(rs.getString("user_id")) + .cardId(rs.getLong("card_id")) + .discount(rs.getLong("discount")) + .total(rs.getLong("total")) + .pay(rs.getLong("pay")) + .isPayed(rs.getInt("is_payed")) + .delayDays(rs.getInt("delay_days")) + .delayPrice(rs.getLong("delay_price")) + .startDate(rs.getTimestamp("start_date").toLocalDateTime().toLocalDate()) + .endDate(rs.getTimestamp("end_date").toLocalDateTime().toLocalDate()) + .title(rs.getString("title")) + .build(); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("존재하지않음"); + } + + finally { + try { + pstmt.close(); + dbUtil.close(pstmt); + } catch (Exception e) { + e.printStackTrace(); + } + } + + //return monthlyCreditList; + return new MonthlyCreditDto(monthlyCredit); + } + + public ArrayList selectAllMonthlyCreditByCardId(Long cardId) throws SQLException { + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + + MonthlyCredit monthlyCredit = null; + ArrayList monthlyCreditList = new ArrayList<>(); + + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement("select * from monthly_credit where id=?"); + pstmt.setLong(1,cardId); + rs = pstmt.executeQuery();//select실행 + + while(rs.next()) { + monthlyCredit = MonthlyCredit.builder() + .id(rs.getLong("id")) + .userId(rs.getString("user_id")) + .cardId(rs.getLong("card_id")) + .discount(rs.getLong("discount")) + .total(rs.getLong("total")) + .pay(rs.getLong("pay")) + .isPayed(rs.getInt("is_payed")) + .delayDays(rs.getInt("delay_days")) + .delayPrice(rs.getLong("delay_price")) + .startDate(rs.getTimestamp("start_date").toLocalDateTime().toLocalDate()) + .endDate(rs.getTimestamp("end_date").toLocalDateTime().toLocalDate()) + .title(rs.getString("title")) + .build(); + + monthlyCreditList.add(new MonthlyCreditDto(monthlyCredit)); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("존재하지않음"); + } + + finally { + try { + pstmt.close(); + dbUtil.close(pstmt); + } catch (Exception e) { + e.printStackTrace(); + } + } + + //return monthlyCreditList; + return monthlyCreditList; + } + + // 연체되지 않고 납부완료되지 않은 명세서 리스트 반환 + public ArrayList selectAllNonDelayMonthlyCredit() throws SQLException { + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + + MonthlyCredit monthlyCredit = null; + ArrayList monthlyCreditList = new ArrayList<>(); + + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement("select * from monthly_credit where delay_days = 0, is_payed=0"); + rs = pstmt.executeQuery();//select실행 + + while(rs.next()) { + monthlyCredit = MonthlyCredit.builder() + .id(rs.getLong("id")) + .userId(rs.getString("user_id")) + .cardId(rs.getLong("card_id")) + .discount(rs.getLong("discount")) + .total(rs.getLong("total")) + .pay(rs.getLong("pay")) + .isPayed(rs.getInt("is_payed")) + .delayDays(rs.getInt("delay_days")) + .delayPrice(rs.getLong("delay_price")) + .startDate(rs.getTimestamp("start_date").toLocalDateTime().toLocalDate()) + .endDate(rs.getTimestamp("end_date").toLocalDateTime().toLocalDate()) + .title(rs.getString("title")) + .build(); + + monthlyCreditList.add(new MonthlyCreditDto(monthlyCredit)); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("존재하지않음"); + } + + finally { + try { + pstmt.close(); + dbUtil.close(pstmt); + } catch (Exception e) { + e.printStackTrace(); + } + } + + //return monthlyCreditList; + return monthlyCreditList; + } + + + // 연체되고 납부완료되지 않은 명세서 리스트 반환 + public ArrayList selectAllDelayMonthlyCredit() throws SQLException { + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + + MonthlyCredit monthlyCredit = null; + ArrayList monthlyCreditList = new ArrayList<>(); + + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement("select * from monthly_credit where delay_days > 0 and is_payed=0;"); + rs = pstmt.executeQuery();//select실행 + + while(rs.next()) { + monthlyCredit = MonthlyCredit.builder() + .id(rs.getLong("id")) + .userId(rs.getString("user_id")) + .cardId(rs.getLong("card_id")) + .discount(rs.getLong("discount")) + .total(rs.getLong("total")) + .pay(rs.getLong("pay")) + .isPayed(rs.getInt("is_payed")) + .delayDays(rs.getInt("delay_days")) + .delayPrice(rs.getLong("delay_price")) + .startDate(rs.getTimestamp("start_date").toLocalDateTime().toLocalDate()) + .endDate(rs.getTimestamp("end_date").toLocalDateTime().toLocalDate()) + .title(rs.getString("title")) + .build(); + + monthlyCreditList.add(new MonthlyCreditDto(monthlyCredit)); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("존재하지않음"); + } + + finally { + try { + pstmt.close(); + dbUtil.close(pstmt); + } catch (Exception e) { + e.printStackTrace(); + } + } + + //return monthlyCreditList; + return monthlyCreditList; + } + + // 명세서 정산 업데이트 + public void updateMonthlyCreditByMonthlyCreditId(MonthlyCreditUpdateDto monthlyCreditUpdateDto) throws SQLException { + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement("update monthly_credit set " + + "is_payed=?, delay_days=?, delay_price=?, end_date=? where id=?"); + pstmt.setInt(1,monthlyCreditUpdateDto.getIsPayed()); + pstmt.setInt(1,monthlyCreditUpdateDto.getDelayDays()); + pstmt.setLong(1,monthlyCreditUpdateDto.getDelayPrice()); + pstmt.setTimestamp(1,Timestamp.valueOf(monthlyCreditUpdateDto.getEndDate().atStartOfDay())); + pstmt.setLong(1,monthlyCreditUpdateDto.getId()); + rs = pstmt.executeQuery();//select실행 + + + } catch (Exception e) { + e.printStackTrace(); + System.out.println("해당 명세서가 존재하지 않습니다."); + } + + finally { + try { + pstmt.close(); + dbUtil.close(pstmt); + } catch (Exception e) { + e.printStackTrace(); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/dao/ProductDao.java b/src/main/java/dao/ProductDao.java index 3a9f2ee4..c84e0ae5 100644 --- a/src/main/java/dao/ProductDao.java +++ b/src/main/java/dao/ProductDao.java @@ -12,6 +12,7 @@ import domain.Account; import domain.Product; import dto.AccountDto; +import dto.ProductDto; import dto.ProductRequestDto; import dto.ProductResponseDto; import exception.BusinessException; @@ -27,6 +28,39 @@ public static ProductDao getInstance() { return dao; } + + public static ProductDto selectProductByProductId(Long productId) throws SQLException { + Product product=null; + + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement("select * from product where id=?"); + pstmt.setLong(1,productId); + rs = pstmt.executeQuery();//select실행 + + while(rs.next()) { + product = Product.builder() + .id(rs.getLong("id")) + .cardName(rs.getString("card_name")) + .cardType(rs.getString("card_type")) + .cardLimit(rs.getLong("card_limit")) + .categoryId(rs.getLong("category_id")) + .build(); + + } + }finally { + dbUtil.close(rs, pstmt, conn); + } + + return new ProductDto(product); + } + + + public Long selectOneProduct(final Long idx) throws SQLException{ Long result = null; diff --git a/src/main/java/dao/UserDao.java b/src/main/java/dao/UserDao.java index 2d36fe1f..fd226f8e 100644 --- a/src/main/java/dao/UserDao.java +++ b/src/main/java/dao/UserDao.java @@ -1,6 +1,7 @@ package dao; import java.sql.Connection; + import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -9,6 +10,7 @@ import db.DBUtil; import domain.User; +import dto.UserDto; import dto.UserRequestDto; import dto.UserResponseDto; @@ -162,4 +164,151 @@ public int checkUserBlock(String id) { return isBlocked; } + + + // 카드id로 카드 존재 여부 확인 + public UserDto selectUserByUserId(Long userId) throws SQLException { + System.out.println("카드 존재 여부 확인 dao 진입"); + + User user = null; + + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + + + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement("select * from user where id=?;"); + pstmt.setLong(1, userId); + + rs = pstmt.executeQuery(); + if (rs.next()) { + user = User.builder() + .id(rs.getString("user_name")) + .userBirth(rs.getString("user_birth")) + .credit(rs.getInt("credit")) + .adminBlock(rs.getInt("admin_block")) + .delayBlock(rs.getInt("delay_block")) + .gender(rs.getString("gender")) + .build(); + + + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("유저가 존재하지 않습니다."); + }finally { + try { + dbUtil.close(rs, pstmt, conn); + } catch (Exception e) { + e.printStackTrace(); + } + + } + return new UserDto(user); + } + + // 모든 고객 목록 반환 + public ArrayList selectAllUser() throws SQLException { + ArrayList userList = new ArrayList<>(); + + User user = null; + + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + + + try { + conn = dbUtil.getConnection(); + + pstmt = conn.prepareStatement("select * from user;"); + rs = pstmt.executeQuery(); + + while (rs.next()) { + user = User.builder() + .id(rs.getString("user_name")) + .userBirth(rs.getString("user_birth")) + .credit(rs.getInt("credit")) + .adminBlock(rs.getInt("admin_block")) + .delayBlock(rs.getInt("delay_block")) + .gender(rs.getString("gender")) + .build(); + + userList.add(new UserDto(user)); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("유저가 존재하지 않습니다."); + }finally { + try { + dbUtil.close(rs, pstmt, conn); + } catch (Exception e) { + e.printStackTrace(); + } + + } + return userList; + } + + // 연체로 브랙리스트처리된 모든 고객목록 반환 + public ArrayList selectAllNonBlockUser() throws SQLException { + ArrayList userList = new ArrayList<>(); + + User user = null; + + Connection conn = null; + PreparedStatement pstmt = null; + ResultSet rs = null; + + + try { + conn = dbUtil.getConnection(); + + pstmt = conn.prepareStatement("select * from user where delay_block=1;"); + rs = pstmt.executeQuery(); + + while (rs.next()) { + user = User.builder() + .id(rs.getString("user_name")) + .userBirth(rs.getString("user_birth")) + .credit(rs.getInt("credit")) + .adminBlock(rs.getInt("admin_block")) + .delayBlock(rs.getInt("delay_block")) + .gender(rs.getString("gender")) + .build(); + + userList.add(new UserDto(user)); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("유저가 존재하지 않습니다."); + }finally { + try { + dbUtil.close(rs, pstmt, conn); + } catch (Exception e) { + e.printStackTrace(); + } + + } + return userList; + } + + public void updateDelayBlockUserByUserId(String userId, int delayBlock) throws SQLException { + Connection conn = null; + PreparedStatement pstmt = null; + try { + conn = dbUtil.getConnection(); + pstmt = conn.prepareStatement("UPDATE user SET delay_block = ? WHERE id = ?"); + pstmt.setInt(1, delayBlock); + pstmt.setString(2, userId); + pstmt.executeUpdate(); + + } catch (Exception e) { + e.printStackTrace(); + } finally { + dbUtil.close(pstmt, conn); + } + } } diff --git a/src/main/java/db/DBUtil.java b/src/main/java/db/DBUtil.java index 983b3235..87d35d73 100644 --- a/src/main/java/db/DBUtil.java +++ b/src/main/java/db/DBUtil.java @@ -16,9 +16,9 @@ public class DBUtil { String driverName = "com.mysql.cj.jdbc.Driver"; - private static final String DB_URL = "jdbc:mysql://cardsystemdatabase.cdvfrfzlq3nb.us-east-1.rds.amazonaws.com:3306/cardsystemdatabase"; - private static final String DB_USERNAME = "admin"; - private static final String DB_PASSWORD = "12341234"; + private static final String DB_URL = "jdbc:mysql://localhost:3306/jsptest?serverTimezone=UTC"; + private static final String DB_USERNAME = "root"; + private static final String DB_PASSWORD = "cjswo159"; // String dbName = System.getProperty("cardsystemdatabase"); // String userName = System.getProperty("admin"); // String password = System.getProperty("12341234"); diff --git a/src/main/java/domain/CardHistory.java b/src/main/java/domain/CardHistory.java index 9284b820..0a6f907f 100644 --- a/src/main/java/domain/CardHistory.java +++ b/src/main/java/domain/CardHistory.java @@ -1,5 +1,7 @@ package domain; +import java.time.LocalDateTime; + import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; @@ -10,16 +12,16 @@ @NoArgsConstructor @Builder public class CardHistory { - private long id; - private long cardId; + private Long id; + private Long cardId; private String userId; private String franchisee; - private long payment; - private long balance; - private int isSuccess; - private String date; - private long fCategory; - private int isIns; + private Long payment; + private Long balance; + private Integer isSuccess; + private LocalDateTime date; + private Long fCategory; + private Integer isIns; private int insMonth; private String cardType; } diff --git a/src/main/java/domain/Installment.java b/src/main/java/domain/Installment.java new file mode 100644 index 00000000..d8af08b8 --- /dev/null +++ b/src/main/java/domain/Installment.java @@ -0,0 +1,25 @@ +package domain; + +import java.time.LocalDate; + + +import lombok.NoArgsConstructor; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; + + +@Getter +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class Installment { + private Long id; + private String userId; + private Long cardID; + private int insMonth; + private int remainMonth; + private Long payment; + private Integer isInspayed; + private LocalDate paymentDate; +} \ No newline at end of file diff --git a/src/main/java/domain/MonthlyCredit.java b/src/main/java/domain/MonthlyCredit.java new file mode 100644 index 00000000..3ba55a37 --- /dev/null +++ b/src/main/java/domain/MonthlyCredit.java @@ -0,0 +1,31 @@ +package domain; + +import java.time.LocalDate; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class MonthlyCredit { + private Long id; + private String userId; + private Long cardId; + private Long discount; + private Long total; + private Long pay; + private Integer isPayed; + private int delayDays; + private Long delayPrice; + private LocalDate startDate; + private LocalDate endDate; + private String title; + +} \ No newline at end of file diff --git a/src/main/java/dto/AccountDto.java b/src/main/java/dto/AccountDto.java index 843f382e..1e822756 100644 --- a/src/main/java/dto/AccountDto.java +++ b/src/main/java/dto/AccountDto.java @@ -16,18 +16,15 @@ public class AccountDto { private Long id; + private String userId; private String accountNum; private Long balance; private String bankName; private Integer isStopped; - public void makeBalance(Long payment) { - this.balance += payment; - } - - public AccountDto(Account account) { this.id = account.getId(); + this.userId = account.getUserId(); this.accountNum = account.getAccountNum(); this.balance = account.getBalance(); this.bankName = account.getBankName(); diff --git a/src/main/java/dto/CardDto.java b/src/main/java/dto/CardDto.java new file mode 100644 index 00000000..5606fe31 --- /dev/null +++ b/src/main/java/dto/CardDto.java @@ -0,0 +1,39 @@ +package dto; + +import domain.Account; +import domain.Card; +import lombok.Getter; +import lombok.Setter; + + +@Getter +@Setter +public class CardDto { + + private Long id; + private Long productId; + private Long accountId; + + private String issuedDate; + private String cardType; + private String validity; + private String agency; + private String issuer; + private Integer isStopped; + private String cardNum; + private Long totalPayment; + + public CardDto(Card card) { + this.id = card.getId(); + this.productId = card.getProductId(); + this.accountId = card.getAccountId(); + this.issuedDate = card.getIssuedDate(); + this.cardType = card.getCardType(); + this.validity = card.getValidity(); + this.agency = card.getValidity(); + this.issuer = card.getIssuer(); + this.isStopped = card.getIsStopped(); + this.cardNum = card.getCardNum(); + this.totalPayment = card.getTotalPayment(); + } +} \ No newline at end of file diff --git a/src/main/java/dto/CreditCardDaoToServiceDto.java b/src/main/java/dto/CreditCardDaoToServiceDto.java new file mode 100644 index 00000000..f26bd934 --- /dev/null +++ b/src/main/java/dto/CreditCardDaoToServiceDto.java @@ -0,0 +1,40 @@ +package dto; + + +import domain.Card; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class CreditCardDaoToServiceDto { + + + private Long id; + private Long cardId; + private String cardType; + private String validity; + private String agency; + private String issuer; + private Integer isStopped; + private String cardNum; + private Long accountId; + private Long discount; + private Long categoryId; + + public CreditCardDaoToServiceDto(Card creditCard,Long accountId,Long discount, Long categoryId) + { + this.cardId=creditCard.getId(); + this.cardType=creditCard.getCardType(); + this.validity=creditCard.getValidity(); + this.agency=creditCard.getAgency(); + this.issuer=creditCard.getIssuer(); + this.isStopped=creditCard.getIsStopped(); + this.cardNum=creditCard.getCardNum(); + this.accountId=accountId; + this.discount=discount; + this.categoryId = categoryId; + } + + +} \ No newline at end of file diff --git a/src/main/java/dto/CreditCardHistoryCreateDto.java b/src/main/java/dto/CreditCardHistoryCreateDto.java new file mode 100644 index 00000000..2a5cff00 --- /dev/null +++ b/src/main/java/dto/CreditCardHistoryCreateDto.java @@ -0,0 +1,60 @@ +package dto; + +import java.time.LocalDateTime; + + +import lombok.Getter; +import lombok.Setter; +import domain.CardHistory; + +@Getter +@Setter +public class CreditCardHistoryCreateDto { + + private Long cardId; + private String userId; + private String franchisee; + private Long payment; + private Long balance; + private Integer isSuccess; + private LocalDateTime date=LocalDateTime.now(); + private Long fCategory; + private Integer isIns; + private int insMonth; + private String cardType; + + public CreditCardHistoryCreateDto(Long cardId,String userId,String franchisee,Long payment,Long balance, + Integer isSuccess,LocalDateTime date,Long fCategory,Integer isIns,int insMonth,String cardType) + { + this.cardId=cardId; + this.userId=userId; + this.franchisee=franchisee; + this.payment=payment; + this.balance=balance; + this.isSuccess=isSuccess; + this.date=date; + this.fCategory=fCategory; + this.isIns=isIns; + this.insMonth=insMonth; + this.cardType=cardType; + } + + + public CardHistory toEntity() { + + return CardHistory.builder() + .id(null) + .cardId(this.cardId) + .userId(this.userId) + .franchisee(this.franchisee) + .payment(this.payment) + .balance(this.balance) + .isSuccess(this.isSuccess) + .date(this.date) + .fCategory(this.fCategory) + .isIns(this.isIns) + .insMonth(this.insMonth) + .cardType(this.cardType) + .build(); + } +} \ No newline at end of file diff --git a/src/main/java/dto/CreditCardHistoryDto.java b/src/main/java/dto/CreditCardHistoryDto.java new file mode 100644 index 00000000..e51e194d --- /dev/null +++ b/src/main/java/dto/CreditCardHistoryDto.java @@ -0,0 +1,43 @@ +package dto; + +import java.time.LocalDateTime; + +import lombok.Getter; +import lombok.Setter; +import domain.CardHistory; + +@Getter +@Setter +public class CreditCardHistoryDto { + private Long id; + private Long cardId; + private String userId; + private String franchisee; + private Long payment; + private Long balance; + private Integer isSuccess; + private LocalDateTime date; + private Long fCategory; + private Integer isIns; + private int insMonth; + private String cardType; + + + public CreditCardHistoryDto(CardHistory creditCardHistory) { + + this.id = creditCardHistory.getId(); + this.cardId = creditCardHistory.getCardId(); + this.userId = creditCardHistory.getUserId(); + this.franchisee = creditCardHistory.getFranchisee(); + this.payment = creditCardHistory.getPayment(); + this.balance = creditCardHistory.getBalance(); + this.isSuccess = creditCardHistory.getIsSuccess(); + this.date = creditCardHistory.getDate(); + this.fCategory = creditCardHistory.getFCategory(); + this.isIns = creditCardHistory.getIsIns(); + this.insMonth = creditCardHistory.getInsMonth(); + this.cardType = creditCardHistory.getCardType(); + + + } +} \ No newline at end of file diff --git a/src/main/java/dto/CreditCardRequestDto.java b/src/main/java/dto/CreditCardRequestDto.java new file mode 100644 index 00000000..56667c87 --- /dev/null +++ b/src/main/java/dto/CreditCardRequestDto.java @@ -0,0 +1,22 @@ +package dto; + +import java.time.LocalDateTime; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class CreditCardRequestDto { + private Long cardId; + private String userId; + private String franchisee; + private Long payment; + private Long fCategory; + private int insMonth; + private LocalDateTime date; +} \ No newline at end of file diff --git a/src/main/java/dto/CreditCardResponseDto.java b/src/main/java/dto/CreditCardResponseDto.java new file mode 100644 index 00000000..1659e053 --- /dev/null +++ b/src/main/java/dto/CreditCardResponseDto.java @@ -0,0 +1,45 @@ +package dto; + +import java.time.LocalDateTime; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class CreditCardResponseDto { + private int statusCode; + private String statusMsg; + + // cardHistory에서 받아오기 + private Long cardId; + private String userId; + private String franchisee; + private Long payment; + private Long balance; + private Integer isSuccess; + + private LocalDateTime date; + private Long fCategory; + private Integer isIns; + private int insMonth; + private String cardType; + + public CreditCardResponseDto(CreditCardHistoryCreateDto history, int statusCode, String statusMsg) { + this.cardId = history.getCardId(); + this.userId = history.getUserId(); + this.franchisee = history.getFranchisee(); + this.payment = history.getPayment(); + this.balance = history.getBalance(); + this.isSuccess = history.getIsSuccess(); + this.date = history.getDate(); + this.fCategory = history.getFCategory(); + this.isIns = history.getIsIns(); + this.insMonth = history.getInsMonth(); + this.cardType = history.getCardType(); + this.statusCode = statusCode; + this.statusMsg = statusMsg; + + } + +} \ No newline at end of file diff --git a/src/main/java/dto/InstallmentCreateDto.java b/src/main/java/dto/InstallmentCreateDto.java new file mode 100644 index 00000000..870e7adc --- /dev/null +++ b/src/main/java/dto/InstallmentCreateDto.java @@ -0,0 +1,38 @@ +package dto; + +import java.time.LocalDate; + +import domain.Installment; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@AllArgsConstructor +@NoArgsConstructor +@Getter +@Setter +public class InstallmentCreateDto { + + String userId; + Long cardId; + int insMonth; + int remainMonth; + Long payment; + Integer isInspayed; + LocalDate paymentDate; + + + public Installment toEntity() { + return Installment.builder() + .userId(this.userId) + .cardID(this.cardId) + .insMonth(this.insMonth) + .remainMonth(this.remainMonth) + .payment(this.payment) + .isInspayed(this.isInspayed) + .payment(this.payment) + .build(); + } + +} \ No newline at end of file diff --git a/src/main/java/dto/InstallmentDto.java b/src/main/java/dto/InstallmentDto.java new file mode 100644 index 00000000..801d6ace --- /dev/null +++ b/src/main/java/dto/InstallmentDto.java @@ -0,0 +1,37 @@ +package dto; + +import java.time.LocalDate; + +import domain.Installment; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + + +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter +public class InstallmentDto { + private Long id; + String userId; + Long cardId; + int insMonth; + int remainMonth; + Long payment; + Integer isInspayed; + LocalDate paymentDate; + + + public InstallmentDto(Installment installment) { + this.id = installment.getId(); + this.userId = installment.getUserId(); + this.cardId = installment.getCardID(); + this.insMonth = installment.getInsMonth(); + this.remainMonth = installment.getRemainMonth(); + this.payment = installment.getPayment(); + this.isInspayed = installment.getIsInspayed(); + this.paymentDate = installment.getPaymentDate(); + } +} \ No newline at end of file diff --git a/src/main/java/dto/InstallmentUpdateDto.java b/src/main/java/dto/InstallmentUpdateDto.java new file mode 100644 index 00000000..cb51c137 --- /dev/null +++ b/src/main/java/dto/InstallmentUpdateDto.java @@ -0,0 +1,20 @@ +package dto; + +import java.time.LocalDate; + +import domain.Installment; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + + +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter +public class InstallmentUpdateDto { + Long id; + int remainMonth; + Integer isInspayed; +} \ No newline at end of file diff --git a/src/main/java/dto/MonthlyCreditCreateDto.java b/src/main/java/dto/MonthlyCreditCreateDto.java new file mode 100644 index 00000000..5bc1f858 --- /dev/null +++ b/src/main/java/dto/MonthlyCreditCreateDto.java @@ -0,0 +1,47 @@ +package dto; + +import java.time.LocalDate; + +import domain.MonthlyCredit; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class MonthlyCreditCreateDto { + + private String userId; + private Long cardId; + private Long discount; + private Long total; + private Long pay; + private Integer isPayed; + private int delayDays; + private Long delayPrice; + private LocalDate startDate; + private LocalDate endDate; + private String title; + + public MonthlyCredit toEntity() { + + return MonthlyCredit.builder() + .id(null) + .userId(this.userId) + .cardId(this.cardId) + .discount(this.discount) + .total(this.total) + .pay(this.pay) + .isPayed(this.isPayed) + .delayDays(this.delayDays) + .delayPrice(this.delayPrice) + .startDate(this.startDate) + .endDate(this.endDate) + .title(this.title) + .build(); + } +} \ No newline at end of file diff --git a/src/main/java/dto/MonthlyCreditDto.java b/src/main/java/dto/MonthlyCreditDto.java new file mode 100644 index 00000000..babbf5a1 --- /dev/null +++ b/src/main/java/dto/MonthlyCreditDto.java @@ -0,0 +1,40 @@ +package dto; + +import java.time.LocalDate; + +import domain.MonthlyCredit; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class MonthlyCreditDto { + private Long id; + private String userId; + private Long cardId; + private Long discount; + private Long total; + private Long pay; + private Integer isPayed; + private int delayDays; + private Long delayPrice; + private LocalDate startDate; + private LocalDate endDate; + private String title; + + + public MonthlyCreditDto(MonthlyCredit entity) { + this.id = entity.getId(); + this.userId = entity.getUserId(); + this.cardId = entity.getCardId(); + this.discount = entity.getDiscount(); + this.total = entity.getTotal(); + this.pay = entity.getPay(); + this.isPayed = entity.getIsPayed(); + this.delayDays = entity.getDelayDays(); + this.delayPrice = entity.getDelayPrice(); + this.startDate = entity.getStartDate(); + this.endDate = entity.getEndDate(); + this.title = entity.getTitle(); + } +} \ No newline at end of file diff --git a/src/main/java/dto/MonthlyCreditUpdateDto.java b/src/main/java/dto/MonthlyCreditUpdateDto.java new file mode 100644 index 00000000..1db6c74d --- /dev/null +++ b/src/main/java/dto/MonthlyCreditUpdateDto.java @@ -0,0 +1,20 @@ +package dto; + +import java.time.LocalDate; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class MonthlyCreditUpdateDto{ + + Long id; + Integer isPayed; + int delayDays; + Long delayPrice; + LocalDate endDate; + +} \ No newline at end of file diff --git a/src/main/java/dto/UserDto.java b/src/main/java/dto/UserDto.java new file mode 100644 index 00000000..8a175cc0 --- /dev/null +++ b/src/main/java/dto/UserDto.java @@ -0,0 +1,27 @@ +package dto; + +import domain.User; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class UserDto { + private String id; + private String userName; + private String userBirth; + private int credit; + private Integer adminBlock; + private Integer delayBlock; + private String gender; + + public UserDto(User user) { + this.id = id; + this.userName = userName; + this.userBirth = userBirth; + this.credit = credit; + this.adminBlock = adminBlock; + this.delayBlock = delayBlock; + this.gender = gender; + } +} \ No newline at end of file diff --git a/src/main/java/service/CreditCardService.java b/src/main/java/service/CreditCardService.java new file mode 100644 index 00000000..70b12981 --- /dev/null +++ b/src/main/java/service/CreditCardService.java @@ -0,0 +1,104 @@ +package service; + +import dao.CardDao; +import dao.CardHistoryDao; +import dao.InstallmentDao; +import dao.ProductDao; +import dto.CardDto; +import dto.CreditCardHistoryCreateDto; +import dto.CreditCardHistoryDto; +import dto.CreditCardRequestDto; +import dto.CreditCardResponseDto; +import dto.InstallmentCreateDto; +import dto.ProductDto; +import exception.BusinessException; +import lombok.AllArgsConstructor; + +@AllArgsConstructor +public class CreditCardService { + + + public final CardHistoryDao cardHistoryDao; + public final ProductDao productDao; + public final InstallmentDao installmentDao; + public final CardDao cardDao; + + // 신용 카드 결제 플로우 + // 할부 로직 처리 + /* + * 카드 정지여부 확인 + * 할부 개월수에 따른 각 월 한도체크 후 결제 가능여부 확인 -> 현재달만 체크하면된다. why? 이후의 달들이 현재의 달보다 많은 금액이 쌓여있을 수 없다. + * 결제하여 카드사용내역에 결제내열 저장 + * 할부를 했다면 할부에 할부내역 저장 + */ + public CreditCardResponseDto payCreditCard(CreditCardRequestDto creditCardRequestDto) throws Exception { + + CreditCardHistoryCreateDto creditCardHistoryCreateDto = null; + InstallmentCreateDto installmentCreateDto = null; + // 결제한 카드 id + Long cardId = creditCardRequestDto.getCardId(); + // 카드정보 get + CardDto cardDto = cardDao.selectOneCardByCardId(cardId); + // 카드상품정보 get + ProductDto productDto = productDao.selectProductByProductId(cardDto.getProductId()); + + // 상태코드, 상태 메시지 + int statusCode = 0; + String statusMsg = null; + + // 할부 개월 수 + int insMonth = 0; + // 이번달 총 결제액 + 결제금액 + Long totalPayment = cardDto.getTotalPayment() + creditCardRequestDto.getPayment(); + + + try { + + insMonth = creditCardRequestDto.getInsMonth(); + + // 카드 정지여부 확인 + if (cardDto.getIsStopped() == 1) { + throw new Exception("정지된 카드입니다."); + } + // 카드 한도 확인 + if (totalPayment > productDto.getCardLimit()) { + throw new Exception("결제 금액이 한도를 초과합니다."); + } + + + // 카드 결제 내역 Dto로 정리 + creditCardHistoryCreateDto = new CreditCardHistoryCreateDto(creditCardRequestDto.getCardId(), creditCardRequestDto.getUserId(), creditCardRequestDto.getFranchisee(), + creditCardRequestDto.getPayment(), null, 1, creditCardRequestDto.getDate(), creditCardRequestDto.getFCategory(), 1, 0, + cardDto.getCardType()); + + // 카드사용내역 디비 테이블에 저장 + cardHistoryDao.insertCreditCardHistory(creditCardHistoryCreateDto); + + // 할부 결제를 진행했을때 + if (insMonth != 0) { + installmentCreateDto = new InstallmentCreateDto(creditCardRequestDto.getUserId(), creditCardRequestDto.getCardId(), creditCardRequestDto.getInsMonth(), + creditCardRequestDto.getInsMonth(), creditCardRequestDto.getPayment(), 0, creditCardRequestDto.getDate().toLocalDate()); + // 할부 테이블 디비에 할부내역 저장 + installmentDao.insertInstallment(installmentCreateDto); + } + + // cards 테이블의 total_payment 갱신 + cardDao.updateTotalPaymentByCardId(totalPayment, cardId); + + statusCode = 200; + statusMsg = "결제성공"; + + } catch (BusinessException e) { + System.out.println("에러발생: " + e.getMessage()); + creditCardHistoryCreateDto = new CreditCardHistoryCreateDto(creditCardRequestDto.getCardId(), creditCardRequestDto.getUserId(), creditCardRequestDto.getFranchisee(), + creditCardRequestDto.getPayment(), null, 0, creditCardRequestDto.getDate(), creditCardRequestDto.getFCategory(), 1, 0, + cardDto.getCardType()); + cardHistoryDao.insertCreditCardHistory(creditCardHistoryCreateDto); + statusCode = e.getErrorCode().getStatusCode(); + statusMsg = e.getMessage(); + } + + return new CreditCardResponseDto(creditCardHistoryCreateDto, statusCode, statusMsg); + } + +} \ No newline at end of file diff --git a/src/main/java/service/DelayPaymentService.java b/src/main/java/service/DelayPaymentService.java new file mode 100644 index 00000000..87bcda9d --- /dev/null +++ b/src/main/java/service/DelayPaymentService.java @@ -0,0 +1,120 @@ +package service; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.ArrayList; + +import dao.AccountDao; +import dao.CardDao; +import dao.CardHistoryDao; +import dao.InstallmentDao; +import dao.MonthlyCreditDao; +import dao.UserDao; +import dto.AccountDto; +import dto.CardDto; +import dto.InstallmentDto; +import dto.InstallmentUpdateDto; +import dto.MonthlyCreditDto; +import dto.MonthlyCreditUpdateDto; +import dto.UserDto; +import exception.BusinessException; +import lombok.AllArgsConstructor; + +@AllArgsConstructor +public class DelayPaymentService { + + public final MonthlyCreditDao monthlyCreditDao; + public final AccountDao accountDao; + public final UserDao userDao; + public final CardDao cardDao; + public final CardHistoryDao cardHistoryDao; + public final InstallmentDao installmentDao; + + + public void DelayCalculation() throws Exception { + + System.out.println("월 명세서 작성 함수 입장!!"); + try { + + AccountDto accountDto = null; + ArrayList monthlyCreditList = null; + ArrayList installmentList = null; + ArrayList userList = null; + ArrayList cardList = null; + + MonthlyCreditUpdateDto monthlyCreditUpdateDto = null; + InstallmentUpdateDto installmentUpdateDto = null; + + LocalDate date = LocalDateTime.now().toLocalDate(); + String month = date.getMonth().toString(); + + + // 신용카드 월별명세서 테이블에서 연체되고 완납되지 않은 데이터들을 가져온다. + monthlyCreditList = monthlyCreditDao.selectAllDelayMonthlyCredit(); + + // 연제되고 완납되지 않은 모든 신용카드 월별명세서 정산 + for (int i=0; i= monthlyCreditList.get(i).getPay()) { + // 계좌에서 월 명세서 지불 처리 + accountDao.updateAccountByAccountId(accountDto.getId(), accountDto.getBalance() - monthlyCreditList.get(i).getPay()); + // 해당 카드의 월 명세서에 납부 완료 처리 + monthlyCreditUpdateDto = new MonthlyCreditUpdateDto(monthlyCreditList.get(i).getId(), 1, monthlyCreditList.get(i).getDelayDays(), 0L, date); + monthlyCreditDao.updateMonthlyCreditByMonthlyCreditId(monthlyCreditUpdateDto); + // 해당 카드의 할부 목록 업데이트 + for(int j = 0; j cardList = null; + ArrayList monthlyCreditList = null; + ArrayList creditCardHistoryList = null; + ArrayList installmentList = null; + + + CreditCardDaoToServiceDto creditCardDaoToServiceDto = null; + MonthlyCreditCreateDto monthlyCreditCreateDto = null; + MonthlyCreditUpdateDto monthlyCreditUpdateDto = null; + InstallmentUpdateDto installmentUpdateDto = null; + + LocalDate date = LocalDateTime.now().toLocalDate(); + String month = date.getMonth().toString(); + + System.out.println("월 명세서 작성 함수 입장!!"); + try { + // 정지되지 않은 신용카드 목록을 가져온다. + cardList = cardDao.selectAllNonStopedCreditCard(); + + // 각 카드의 월별 명세서 생성하여 신용카드 월별명세서에 추가 + for (int i=0; i= monthlyCreditList.get(i).getPay()) { + // 계좌에서 월 명세서 지불 처리 + accountDao.updateAccountByAccountId(accountDto.getId(), accountDto.getBalance() - monthlyCreditList.get(i).getPay()); + // 해당 카드의 월 명세서에 납부 완료 처리 + monthlyCreditUpdateDto = new MonthlyCreditUpdateDto(monthlyCreditList.get(i).getId(), 1, 0, 0L, date); + monthlyCreditDao.updateMonthlyCreditByMonthlyCreditId(monthlyCreditUpdateDto); + // 해당 카드의 할부 목록 업데이트 + for(int j = 0; j연체->먀일정산스케줄->정산완료시 매일정산스케줄 탈출 + Runnable run1 = new Runnable() { + public MonthlyCreditDao monthlyCreditDao = new MonthlyCreditDao(); + public AccountDao accountDao = new AccountDao(); + public UserDao userDao = new UserDao(); + public CardDao cardDao = new CardDao(); + public CardHistoryDao cardHistoryDao = new CardHistoryDao(); + public InstallmentDao installmentDao = new InstallmentDao(); + public MonthlyCreditService monthlyCreditService = new MonthlyCreditService(monthlyCreditDao, accountDao, userDao, cardDao, cardHistoryDao, installmentDao); + + @Override + public void run() { + System.out.println("월명세서 런함수 입장!! "); + + try { + System.out.println("월명세서 런함수 try 입장!! "); + monthlyCreditService.MonthlyCalculation(); + System.out.println("월명세서 런함수 try 퇴장!! "); + } catch (Exception e) { + System.out.println("월정산 스케줄링에서 에러발생: " + e.getMessage()); + e.printStackTrace(); + } + + } + }; + + Runnable run2 = new Runnable() { + + public MonthlyCreditDao monthlyCreditDao = new MonthlyCreditDao(); + public AccountDao accountDao = new AccountDao(); + public UserDao userDao = new UserDao(); + public CardDao cardDao = new CardDao(); + public CardHistoryDao cardHistoryDao = new CardHistoryDao(); + public InstallmentDao installmentDao = new InstallmentDao(); + + public DelayPaymentService delayPaymentService = new DelayPaymentService(monthlyCreditDao, accountDao, userDao, cardDao, cardHistoryDao, installmentDao); + + @Override + public void run() { + + try { + System.out.println("연체 일명세서 런함수 try 입장!! "); + delayPaymentService.DelayCalculation(); + System.out.println("연체 일명세서 런함수 try 입장!! "); + } catch (Exception e) { + System.out.println("연체 일정산 스케줄링에서 에러발생: " + e.getMessage()); + e.printStackTrace(); + } + } + }; +} \ No newline at end of file diff --git a/target/classes/dao/AccountDao.class b/target/classes/dao/AccountDao.class deleted file mode 100644 index d4de9098..00000000 Binary files a/target/classes/dao/AccountDao.class and /dev/null differ diff --git a/target/classes/dao/CardDao.class b/target/classes/dao/CardDao.class deleted file mode 100644 index d77a2f74..00000000 Binary files a/target/classes/dao/CardDao.class and /dev/null differ diff --git a/target/classes/dao/CardHistoryDao.class b/target/classes/dao/CardHistoryDao.class deleted file mode 100644 index da681fb7..00000000 Binary files a/target/classes/dao/CardHistoryDao.class and /dev/null differ diff --git a/target/classes/dao/ProductDao.class b/target/classes/dao/ProductDao.class deleted file mode 100644 index bd798ad1..00000000 Binary files a/target/classes/dao/ProductDao.class and /dev/null differ diff --git a/target/classes/dao/UserDao.class b/target/classes/dao/UserDao.class deleted file mode 100644 index af604a8e..00000000 Binary files a/target/classes/dao/UserDao.class and /dev/null differ diff --git a/target/classes/db/DBUtil.class b/target/classes/db/DBUtil.class deleted file mode 100644 index f7e6d0d7..00000000 Binary files a/target/classes/db/DBUtil.class and /dev/null differ diff --git a/target/classes/domain/Account$AccountBuilder.class b/target/classes/domain/Account$AccountBuilder.class deleted file mode 100644 index 96409936..00000000 Binary files a/target/classes/domain/Account$AccountBuilder.class and /dev/null differ diff --git a/target/classes/domain/Account.class b/target/classes/domain/Account.class deleted file mode 100644 index a2729808..00000000 Binary files a/target/classes/domain/Account.class and /dev/null differ diff --git a/target/classes/domain/Card$CardBuilder.class b/target/classes/domain/Card$CardBuilder.class deleted file mode 100644 index 47698602..00000000 Binary files a/target/classes/domain/Card$CardBuilder.class and /dev/null differ diff --git a/target/classes/domain/Card.class b/target/classes/domain/Card.class deleted file mode 100644 index 1d46c9d3..00000000 Binary files a/target/classes/domain/Card.class and /dev/null differ diff --git a/target/classes/domain/CheckCardHistory.class b/target/classes/domain/CheckCardHistory.class deleted file mode 100644 index 3eacb21a..00000000 Binary files a/target/classes/domain/CheckCardHistory.class and /dev/null differ diff --git a/target/classes/domain/Product$ProductBuilder.class b/target/classes/domain/Product$ProductBuilder.class deleted file mode 100644 index cdb2a934..00000000 Binary files a/target/classes/domain/Product$ProductBuilder.class and /dev/null differ diff --git a/target/classes/domain/Product.class b/target/classes/domain/Product.class deleted file mode 100644 index c87019fe..00000000 Binary files a/target/classes/domain/Product.class and /dev/null differ diff --git a/target/classes/domain/User$UserBuilder.class b/target/classes/domain/User$UserBuilder.class deleted file mode 100644 index 46fbeaeb..00000000 Binary files a/target/classes/domain/User$UserBuilder.class and /dev/null differ diff --git a/target/classes/domain/User.class b/target/classes/domain/User.class deleted file mode 100644 index f49054ad..00000000 Binary files a/target/classes/domain/User.class and /dev/null differ diff --git a/target/classes/dto/AccountDto$AccountDtoBuilder.class b/target/classes/dto/AccountDto$AccountDtoBuilder.class deleted file mode 100644 index 7f764734..00000000 Binary files a/target/classes/dto/AccountDto$AccountDtoBuilder.class and /dev/null differ diff --git a/target/classes/dto/AccountDto.class b/target/classes/dto/AccountDto.class deleted file mode 100644 index 386d83d5..00000000 Binary files a/target/classes/dto/AccountDto.class and /dev/null differ diff --git a/target/classes/dto/AccountRequestDto$AccountRequestDtoBuilder.class b/target/classes/dto/AccountRequestDto$AccountRequestDtoBuilder.class deleted file mode 100644 index 483e9413..00000000 Binary files a/target/classes/dto/AccountRequestDto$AccountRequestDtoBuilder.class and /dev/null differ diff --git a/target/classes/dto/AccountRequestDto.class b/target/classes/dto/AccountRequestDto.class deleted file mode 100644 index afba9345..00000000 Binary files a/target/classes/dto/AccountRequestDto.class and /dev/null differ diff --git a/target/classes/dto/AccountResponseDto$AccountResponseDtoBuilder.class b/target/classes/dto/AccountResponseDto$AccountResponseDtoBuilder.class deleted file mode 100644 index 6c852d7d..00000000 Binary files a/target/classes/dto/AccountResponseDto$AccountResponseDtoBuilder.class and /dev/null differ diff --git a/target/classes/dto/AccountResponseDto.class b/target/classes/dto/AccountResponseDto.class deleted file mode 100644 index c481570a..00000000 Binary files a/target/classes/dto/AccountResponseDto.class and /dev/null differ diff --git a/target/classes/dto/CardInsertDto.class b/target/classes/dto/CardInsertDto.class deleted file mode 100644 index 042468fe..00000000 Binary files a/target/classes/dto/CardInsertDto.class and /dev/null differ diff --git a/target/classes/dto/CardRequestDto.class b/target/classes/dto/CardRequestDto.class deleted file mode 100644 index c064370a..00000000 Binary files a/target/classes/dto/CardRequestDto.class and /dev/null differ diff --git a/target/classes/dto/CardResponseDto$CardResponseDtoBuilder.class b/target/classes/dto/CardResponseDto$CardResponseDtoBuilder.class deleted file mode 100644 index ce4dd161..00000000 Binary files a/target/classes/dto/CardResponseDto$CardResponseDtoBuilder.class and /dev/null differ diff --git a/target/classes/dto/CardResponseDto.class b/target/classes/dto/CardResponseDto.class deleted file mode 100644 index 4db152b4..00000000 Binary files a/target/classes/dto/CardResponseDto.class and /dev/null differ diff --git a/target/classes/dto/CheckCardDaoToServiceDto.class b/target/classes/dto/CheckCardDaoToServiceDto.class deleted file mode 100644 index 664cf64a..00000000 Binary files a/target/classes/dto/CheckCardDaoToServiceDto.class and /dev/null differ diff --git a/target/classes/dto/CheckCardHistoryDto.class b/target/classes/dto/CheckCardHistoryDto.class deleted file mode 100644 index e4184c3d..00000000 Binary files a/target/classes/dto/CheckCardHistoryDto.class and /dev/null differ diff --git a/target/classes/dto/CheckCardRequestDto.class b/target/classes/dto/CheckCardRequestDto.class deleted file mode 100644 index 4562b80a..00000000 Binary files a/target/classes/dto/CheckCardRequestDto.class and /dev/null differ diff --git a/target/classes/dto/CheckCardResponseDto.class b/target/classes/dto/CheckCardResponseDto.class deleted file mode 100644 index 1995e62c..00000000 Binary files a/target/classes/dto/CheckCardResponseDto.class and /dev/null differ diff --git a/target/classes/dto/ProductCreateDto$ProductCreateDtoBuilder.class b/target/classes/dto/ProductCreateDto$ProductCreateDtoBuilder.class deleted file mode 100644 index 20ac975f..00000000 Binary files a/target/classes/dto/ProductCreateDto$ProductCreateDtoBuilder.class and /dev/null differ diff --git a/target/classes/dto/ProductCreateDto.class b/target/classes/dto/ProductCreateDto.class deleted file mode 100644 index 81676772..00000000 Binary files a/target/classes/dto/ProductCreateDto.class and /dev/null differ diff --git a/target/classes/dto/ProductDto$ProductDtoBuilder.class b/target/classes/dto/ProductDto$ProductDtoBuilder.class deleted file mode 100644 index 11d3697a..00000000 Binary files a/target/classes/dto/ProductDto$ProductDtoBuilder.class and /dev/null differ diff --git a/target/classes/dto/ProductDto.class b/target/classes/dto/ProductDto.class deleted file mode 100644 index fba9874b..00000000 Binary files a/target/classes/dto/ProductDto.class and /dev/null differ diff --git a/target/classes/dto/ProductRequestDto$ProductRequestDtoBuilder.class b/target/classes/dto/ProductRequestDto$ProductRequestDtoBuilder.class deleted file mode 100644 index 8a279c6f..00000000 Binary files a/target/classes/dto/ProductRequestDto$ProductRequestDtoBuilder.class and /dev/null differ diff --git a/target/classes/dto/ProductRequestDto.class b/target/classes/dto/ProductRequestDto.class deleted file mode 100644 index b45a037d..00000000 Binary files a/target/classes/dto/ProductRequestDto.class and /dev/null differ diff --git a/target/classes/dto/ProductResponseDto$ProductResponseDtoBuilder.class b/target/classes/dto/ProductResponseDto$ProductResponseDtoBuilder.class deleted file mode 100644 index 4015441c..00000000 Binary files a/target/classes/dto/ProductResponseDto$ProductResponseDtoBuilder.class and /dev/null differ diff --git a/target/classes/dto/ProductResponseDto.class b/target/classes/dto/ProductResponseDto.class deleted file mode 100644 index b1124c3b..00000000 Binary files a/target/classes/dto/ProductResponseDto.class and /dev/null differ diff --git a/target/classes/dto/UserRequestDto$UserRequestDtoBuilder.class b/target/classes/dto/UserRequestDto$UserRequestDtoBuilder.class deleted file mode 100644 index 4f992292..00000000 Binary files a/target/classes/dto/UserRequestDto$UserRequestDtoBuilder.class and /dev/null differ diff --git a/target/classes/dto/UserRequestDto.class b/target/classes/dto/UserRequestDto.class deleted file mode 100644 index cc5199e4..00000000 Binary files a/target/classes/dto/UserRequestDto.class and /dev/null differ diff --git a/target/classes/dto/UserResponseDto$UserResponseDtoBuilder.class b/target/classes/dto/UserResponseDto$UserResponseDtoBuilder.class deleted file mode 100644 index 8b32dd23..00000000 Binary files a/target/classes/dto/UserResponseDto$UserResponseDtoBuilder.class and /dev/null differ diff --git a/target/classes/dto/UserResponseDto.class b/target/classes/dto/UserResponseDto.class deleted file mode 100644 index 211c7ef3..00000000 Binary files a/target/classes/dto/UserResponseDto.class and /dev/null differ diff --git a/target/classes/exception/BusinessException.class b/target/classes/exception/BusinessException.class deleted file mode 100644 index 4374f088..00000000 Binary files a/target/classes/exception/BusinessException.class and /dev/null differ diff --git a/target/classes/exception/ErrorCode.class b/target/classes/exception/ErrorCode.class deleted file mode 100644 index 0281655c..00000000 Binary files a/target/classes/exception/ErrorCode.class and /dev/null differ diff --git a/target/classes/redis/RedissonExam.class b/target/classes/redis/RedissonExam.class deleted file mode 100644 index 973d7a03..00000000 Binary files a/target/classes/redis/RedissonExam.class and /dev/null differ diff --git a/target/classes/service/AccountService.class b/target/classes/service/AccountService.class deleted file mode 100644 index bbf11b77..00000000 Binary files a/target/classes/service/AccountService.class and /dev/null differ diff --git a/target/classes/service/CardService.class b/target/classes/service/CardService.class deleted file mode 100644 index d86f02d7..00000000 Binary files a/target/classes/service/CardService.class and /dev/null differ diff --git a/target/classes/service/CheckCardService.class b/target/classes/service/CheckCardService.class deleted file mode 100644 index 966780eb..00000000 Binary files a/target/classes/service/CheckCardService.class and /dev/null differ diff --git a/target/classes/service/InsertCardService.class b/target/classes/service/InsertCardService.class deleted file mode 100644 index 7cc44831..00000000 Binary files a/target/classes/service/InsertCardService.class and /dev/null differ diff --git a/target/classes/service/ProductService.class b/target/classes/service/ProductService.class deleted file mode 100644 index b843dd7b..00000000 Binary files a/target/classes/service/ProductService.class and /dev/null differ diff --git a/target/classes/service/UserService.class b/target/classes/service/UserService.class deleted file mode 100644 index a31a04e4..00000000 Binary files a/target/classes/service/UserService.class and /dev/null differ diff --git a/target/classes/servlet/AccountServlet.class b/target/classes/servlet/AccountServlet.class deleted file mode 100644 index 2e0d402b..00000000 Binary files a/target/classes/servlet/AccountServlet.class and /dev/null differ diff --git a/target/classes/servlet/CardServlet.class b/target/classes/servlet/CardServlet.class deleted file mode 100644 index 31c14b78..00000000 Binary files a/target/classes/servlet/CardServlet.class and /dev/null differ diff --git a/target/classes/servlet/CheckCardHistoryServlet.class b/target/classes/servlet/CheckCardHistoryServlet.class deleted file mode 100644 index 1eacb4c5..00000000 Binary files a/target/classes/servlet/CheckCardHistoryServlet.class and /dev/null differ diff --git a/target/classes/servlet/InsertCardServlet.class b/target/classes/servlet/InsertCardServlet.class deleted file mode 100644 index 3606ecbb..00000000 Binary files a/target/classes/servlet/InsertCardServlet.class and /dev/null differ diff --git a/target/classes/servlet/ProductServlet.class b/target/classes/servlet/ProductServlet.class deleted file mode 100644 index b6466315..00000000 Binary files a/target/classes/servlet/ProductServlet.class and /dev/null differ diff --git a/target/classes/servlet/UserServlet.class b/target/classes/servlet/UserServlet.class deleted file mode 100644 index 074c55c1..00000000 Binary files a/target/classes/servlet/UserServlet.class and /dev/null differ diff --git a/target/m2e-wtp/web-resources/META-INF/maven/testpro/testpro/pom.properties b/target/m2e-wtp/web-resources/META-INF/maven/testpro/testpro/pom.properties index 3a9ca7b8..f6381ff4 100644 --- a/target/m2e-wtp/web-resources/META-INF/maven/testpro/testpro/pom.properties +++ b/target/m2e-wtp/web-resources/META-INF/maven/testpro/testpro/pom.properties @@ -1,6 +1,6 @@ #Generated by Maven Integration for Eclipse -#Mon Jul 03 02:38:04 KST 2023 -m2e.projectLocation=C\:\\newoned\\Server +#Mon Jul 03 09:32:41 KST 2023 +m2e.projectLocation=C\:\\Users\\82107\\Desktop\\\uCD5C\uC885 \uCE74\uB4DC\uD2B8\uB798\uCEE4\uD504\uB85C\uC81D\uD2B8\\Server m2e.projectName=Server groupId=testpro artifactId=testpro diff --git a/webapp/WEB-INF/web.xml b/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..db35b015 --- /dev/null +++ b/webapp/WEB-INF/web.xml @@ -0,0 +1,15 @@ + + + Server + + index.html + index.htm + index.jsp + default.html + default.htm + default.jsp + + + servlet.listener.Scheduler + + \ No newline at end of file