Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 추상메서드
- 대덕인재개발원
- 자바
- 사용자예외클래스생성
- exception
- GRANT VIEW
- 다형성
- cursor문
- 환경설정
- 예외미루기
- abstract
- 자동차수리시스템
- 예외처리
- 인터페이스
- 메소드오버로딩
- 집합_SET
- 제네릭
- 정수형타입
- 객체 비교
- 참조형변수
- 컬렉션프레임워크
- 생성자오버로드
- 한국건설관리시스템
- EnhancedFor
- 오라클
- 컬렉션 타입
- Java
- NestedFor
- oracle
- 어윈 사용법
Archives
- Today
- Total
거니의 velog
7. 관리자 페이지 (4) : 주문내역 관리 본문
public int orderhistoRead() {
List<Map<String, Object>> orderhistoALL = adminReadDAO.orderhistoALL();
if(NullCheckUtil.isEmpty(orderhistoALL)) {
System.out.println("등록된 주문내역이 없습니다!");
}else {
int maxOrderNoLen = gapUtil.gapFullCnt(orderhistoALL, "ORDERNO");
int maxOrderCodeLen = gapUtil.gapFullCnt(orderhistoALL, "ORDERCODE");
int maxMenuNmLen = gapUtil.gapFullCnt(orderhistoALL, "MENUNM");
int maxOrderQtyLen = gapUtil.gapFullCnt(orderhistoALL, "ORDERQTY");
int maxOrderEtaLen = gapUtil.gapFullCnt(orderhistoALL, "ORDERETA");
int maxTotalPriceLen = gapUtil.gapFullCnt(orderhistoALL, "TOTALPRICE");
int maxOrderDateLen = gapUtil.gapFullCnt(orderhistoALL, "ORDERDATE");
int maxMemNmLen = gapUtil.gapFullCnt(orderhistoALL, "MEMNM");
int maxMemAddLen = gapUtil.gapFullCnt(orderhistoALL, "MEMADD");
int maxSelYnLen = gapUtil.gapFullCnt(orderhistoALL, "SELYN");
// 페이징 기능
int pageNumber = 1; // 현재 페이지 번호
int pageSize = 5; // 페이지당 표시할 데이터 수
int startIndex = (pageNumber - 1) * pageSize; // 시작 인덱스
int endIndex = Math.min(startIndex + pageSize, orderhistoALL.size()); // 끝 인덱스
int pageRowCnt = orderhistoALL.size(); // 로우 개수
int totalPageSize = pageRowCnt / pageSize; // 총 페이지 개수
if(pageRowCnt % pageSize != 0) { // 다음 페이지까지 로우가 남음
totalPageSize++;
}
System.out.println(" ───────────────────────────────────────────────────");
System.out.println(" 1. 전체목록 보기");
System.out.println(" 2. 페이지 목록 보기");
System.out.println(" 3. 부분 검색");
System.out.println(" ───────────────────────────────────────────────────");
System.out.print(" >> ");
int choice = ScanUtil.nextInt();
if(choice == 1) { // 전체 검색
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
System.out.println(" 총 주문 수 "+ pageRowCnt +" 개");
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
System.out.println("주문번호 주문코드 메뉴명 주문수량 배달예상시간 메뉴별총금액 주문날짜 주문자명 주문자주소 결제여부");
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
for(Map<String, Object> item : orderhistoALL) {
int memOrderNoLen = gapUtil.gapCnt(item, "ORDERNO");
int memOrderCodeLen = gapUtil.gapCnt(item, "ORDERCODE");
int memMenuNmLen = gapUtil.gapCnt(item, "MENUNM");
int memOrderQtyLen = gapUtil.gapCnt(item, "ORDERQTY");
int memOrderEtaLen = gapUtil.gapCnt(item, "ORDERETA");
int memTotalPriceLen = gapUtil.gapCnt(item, "TOTALPRICE");
int memOrderDateLen = gapUtil.gapCnt(item, "ORDERDATE");
int memMemNmLen = gapUtil.gapCnt(item, "MEMNM");
int memMemAddLen = gapUtil.gapCnt(item, "MEMADD");
int memSelYnLen = gapUtil.gapCnt(item, "SELYN");
StringBuilder memOrderNo = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERNO")), maxOrderNoLen, memOrderNoLen);
StringBuilder memOrderCode = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERCODE")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memMenuNm = gapUtil.gapFullSpace(String.valueOf(item.get("MENUNM")), maxMenuNmLen, memMenuNmLen);
StringBuilder memOrderQty = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERQTY")), maxOrderQtyLen, memOrderQtyLen);
StringBuilder memOrderEta = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERETA")), maxOrderEtaLen, memOrderEtaLen);
StringBuilder memTotalPrice = gapUtil.gapFullSpace(String.valueOf(item.get("TOTALPRICE")), maxTotalPriceLen, memTotalPriceLen);
StringBuilder memOrderDate = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERDATE")), maxOrderDateLen, memOrderDateLen);
StringBuilder memMemNm = gapUtil.gapFullSpace(String.valueOf(item.get("MEMNM")), maxMemNmLen, memMemNmLen);
StringBuilder memMemAdd = gapUtil.gapFullSpace(String.valueOf(item.get("MEMADD")), maxMemAddLen, memMemAddLen);
StringBuilder memSelYn = gapUtil.gapFullSpace(String.valueOf(item.get("SELYN")), maxSelYnLen, memSelYnLen);
System.out.printf("%-" + maxOrderNoLen + "s%-" + maxOrderCodeLen + "s%-" + maxMenuNmLen + "s%-" + maxOrderQtyLen + "s%" + maxOrderEtaLen + "s%" + maxTotalPriceLen + "s%" + maxOrderDateLen + "s%" + maxMemNmLen + "s%" + maxMemAddLen + "s%" + maxSelYnLen + "s\n", memOrderNo, memOrderCode, memMenuNm, memOrderQty, memOrderEta, memTotalPrice, memOrderDate, memMemNm, memMemAdd, memSelYn);
}
EnterUtil.enterNext(1);
}else if(choice == 2) { // 페이징 검색
System.out.println(" ───────────────────────────────────────────────────");
System.out.println(" 한 페이지에 몇 개의 데이터를 보시겠습니까?");
System.out.println(" ───────────────────────────────────────────────────");
System.out.print(" >> ");
pageSize = ScanUtil.nextInt();
startIndex = (pageNumber - 1) * pageSize;
endIndex = Math.min(startIndex + pageSize, orderhistoALL.size());
totalPageSize = pageRowCnt / pageSize; // 총 페이지 개수
if(pageRowCnt % pageSize != 0) { // 다음 페이지까지 로우가 남음
totalPageSize++;
}
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
System.out.println(" 총 주문 수 "+ pageRowCnt +" 개 : " + pageNumber + " / " + totalPageSize + " 페이지");
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
System.out.println("주문번호 주문코드 메뉴명 주문수량 배달예상시간 메뉴별총금액 주문날짜 주문자명 주문자주소 결제여부");
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
for(int i = startIndex; i < endIndex; i++) {
int memOrderNoLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("ORDERNO")));
int memOrderCodeLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("ORDERCODE")));
int memMenuNmLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("MENUNM")));
int memOrderQtyLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("ORDERQTY")));
int memOrderEtaLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("ORDERETA")));
int memTotalPriceLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("TOTALPRICE")));
int memOrderDateLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("ORDERDATE")));
int memMemNmLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("MEMNM")));
int memMemAddLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("MEMADD")));
int memSelYnLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("SELYN")));
StringBuilder memOrderNo = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("ORDERNO")), maxOrderNoLen, memOrderNoLen);
StringBuilder memOrderCode = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("ORDERCODE")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memMenuNm = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("MENUNM")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memOrderQty = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("ORDERQTY")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memOrderEta = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("ORDERETA")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memTotalPrice = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("TOTALPRICE")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memOrderDate = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("ORDERDATE")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memMemNm = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("MEMNM")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memMemAdd = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("MEMADD")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memSelYn = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("SELYN")), maxOrderCodeLen, memOrderCodeLen);
System.out.printf("%-" + maxOrderNoLen + "s%-" + maxOrderCodeLen + "s%-" + maxMenuNmLen + "s%-" + maxOrderQtyLen + "s%" + maxOrderEtaLen + "s%" + maxTotalPriceLen + "s%" + maxOrderDateLen + "s%" + maxMemNmLen + "s%" + maxMemAddLen + "s%" + maxSelYnLen + "s\n", memOrderNo, memOrderCode, memMenuNm, memOrderQty, memOrderEta, memTotalPrice, memOrderDate, memMemNm, memMemAdd, memSelYn);
}
while(true) {
System.out.println(" ───────────────────────────────────────────────────");
System.out.println(" 1. 원하는 페이지 보기");
System.out.println(" 0. 이전 화면");
System.out.println(" ───────────────────────────────────────────────────");
System.out.print(" >> ");
int pageListSelect = ScanUtil.nextInt();
if(pageListSelect == 1) {
System.out.println(" ───────────────────────────────────────────────────");
System.out.println(" 몇 페이지를 보시겠습니까?");
System.out.println(" ───────────────────────────────────────────────────");
System.out.print(" >> ");
pageNumber = ScanUtil.nextInt();
if(pageNumber > totalPageSize || pageNumber <= 0) {
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
System.out.println(" 총 주문 수 "+ pageRowCnt +" 개 : " + pageNumber + " / " + totalPageSize + " 페이지");
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
System.out.println("주문번호 주문코드 메뉴명 주문수량 배달예상시간 메뉴별총금액 주문날짜 주문자명 주문자주소 결제여부");
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
System.out.println("해당 페이지는 정보가 없습니다.");
}else {
startIndex = (pageNumber - 1) * pageSize;
endIndex = Math.min(startIndex + pageSize, orderhistoALL.size());
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
System.out.println(" 총 주문 수 "+ pageRowCnt +" 개 : " + pageNumber + " / " + totalPageSize + " 페이지");
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
System.out.println("주문번호 주문코드 메뉴명 주문수량 배달예상시간 메뉴별총금액 주문날짜 주문자명 주문자주소 결제여부");
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
for(int i = startIndex; i < endIndex; i++) {
int memOrderNoLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("ORDERNO")));
int memOrderCodeLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("ORDERCODE")));
int memMenuNmLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("MENUNM")));
int memOrderQtyLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("ORDERQTY")));
int memOrderEtaLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("ORDERETA")));
int memTotalPriceLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("TOTALPRICE")));
int memOrderDateLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("ORDERDATE")));
int memMemNmLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("MEMNM")));
int memMemAddLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("MEMADD")));
int memSelYnLen = gapUtil.gapCnt(String.valueOf(orderhistoALL.get(i).get("SELYN")));
StringBuilder memOrderNo = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("ORDERNO")), maxOrderNoLen, memOrderNoLen);
StringBuilder memOrderCode = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("ORDERCODE")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memMenuNm = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("MENUNM")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memOrderQty = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("ORDERQTY")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memOrderEta = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("ORDERETA")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memTotalPrice = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("TOTALPRICE")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memOrderDate = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("ORDERDATE")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memMemNm = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("MEMNM")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memMemAdd = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("MEMADD")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memSelYn = gapUtil.gapFullSpace(String.valueOf(orderhistoALL.get(i).get("SELYN")), maxOrderCodeLen, memOrderCodeLen);
System.out.printf("%-" + maxOrderNoLen + "s%-" + maxOrderCodeLen + "s%-" + maxMenuNmLen + "s%-" + maxOrderQtyLen + "s%" + maxOrderEtaLen + "s%" + maxTotalPriceLen + "s%" + maxOrderDateLen + "s%" + maxMemNmLen + "s%" + maxMemAddLen + "s%" + maxSelYnLen + "s\n", memOrderNo, memOrderCode, memMenuNm, memOrderQty, memOrderEta, memTotalPrice, memOrderDate, memMemNm, memMemAdd, memSelYn);
}
}
}else if(pageListSelect == 0) {
return View.ADMIN_ORDERHISTORY;
}
}
}else if(choice == 3) { // 부분 검색
System.out.println(" ───────────────────────────────────────────────────");
System.out.println(" 1. 주문내역코드로 검색");
System.out.println(" 2. 회원명으로 검색");
System.out.println(" 3. 메뉴명으로 검색");
System.out.println(" 4. 주문날짜로 검색");
System.out.println(" 5. 배달예상시간으로 검색");
System.out.println(" 6. 결제여부로 검색");
System.out.println(" ───────────────────────────────────────────────────");
System.out.print(" >> ");
int searchno = ScanUtil.nextInt();
if(searchno == 1) {
System.out.print("주문코드 >> ");
String orderOrdCodeStr = ScanUtil.nextLine();
List<Object> searchOrderCode = new ArrayList<>();
searchOrderCode.add(orderOrdCodeStr);
List<Map<String, Object>> orderInfo = adminReadDAO.orderSearchFromOrderCode(searchOrderCode);
if(NullCheckUtil.isEmpty(orderInfo)) {
System.out.println(" ───────────────────────────────────────────────────");
System.out.println("등록된 메뉴가 없습니다!");
System.out.println(" ───────────────────────────────────────────────────");
}else {
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
System.out.println("주문번호 주문코드 메뉴명 주문수량 배달예상시간 메뉴별총금액 주문날짜 주문자명 주문자주소 결제여부");
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
for(Map<String, Object> item : orderInfo) {
int memOrderNoLen = gapUtil.gapCnt(item, "ORDERNO");
int memOrderCodeLen = gapUtil.gapCnt(item, "ORDERCODE");
int memMenuNmLen = gapUtil.gapCnt(item, "MENUNM");
int memOrderQtyLen = gapUtil.gapCnt(item, "ORDERQTY");
int memOrderEtaLen = gapUtil.gapCnt(item, "ORDERETA");
int memTotalPriceLen = gapUtil.gapCnt(item, "TOTALPRICE");
int memOrderDateLen = gapUtil.gapCnt(item, "ORDERDATE");
int memMemNmLen = gapUtil.gapCnt(item, "MEMNM");
int memMemAddLen = gapUtil.gapCnt(item, "MEMADD");
int memSelYnLen = gapUtil.gapCnt(item, "SELYN");
StringBuilder memOrderNo = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERNO")), maxOrderNoLen, memOrderNoLen);
StringBuilder memOrderCode = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERCODE")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memMenuNm = gapUtil.gapFullSpace(String.valueOf(item.get("MENUNM")), maxMenuNmLen, memMenuNmLen);
StringBuilder memOrderQty = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERQTY")), maxOrderQtyLen, memOrderQtyLen);
StringBuilder memOrderEta = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERETA")), maxOrderEtaLen, memOrderEtaLen);
StringBuilder memTotalPrice = gapUtil.gapFullSpace(String.valueOf(item.get("TOTALPRICE")), maxTotalPriceLen, memTotalPriceLen);
StringBuilder memOrderDate = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERDATE")), maxOrderDateLen, memOrderDateLen);
StringBuilder memMemNm = gapUtil.gapFullSpace(String.valueOf(item.get("MEMNM")), maxMemNmLen, memMemNmLen);
StringBuilder memMemAdd = gapUtil.gapFullSpace(String.valueOf(item.get("MEMADD")), maxMemAddLen, memMemAddLen);
StringBuilder memSelYn = gapUtil.gapFullSpace(String.valueOf(item.get("SELYN")), maxSelYnLen, memSelYnLen);
System.out.printf("%-" + maxOrderNoLen + "s%-" + maxOrderCodeLen + "s%-" + maxMenuNmLen + "s%-" + maxOrderQtyLen + "s%" + maxOrderEtaLen + "s%" + maxTotalPriceLen + "s%" + maxOrderDateLen + "s%" + maxMemNmLen + "s%" + maxMemAddLen + "s%" + maxSelYnLen + "s\n", memOrderNo, memOrderCode, memMenuNm, memOrderQty, memOrderEta, memTotalPrice, memOrderDate, memMemNm, memMemAdd, memSelYn);
}
}
EnterUtil.enterNext(2);
}else if(searchno == 2) {
System.out.print("회원명 >> ");
String orderMemNmStr = ScanUtil.nextLine();
List<Object> searchMemNm = new ArrayList<>();
searchMemNm.add(orderMemNmStr);
List<Map<String, Object>> orderInfo = adminReadDAO.orderSearchFromMemNm(searchMemNm);
if(NullCheckUtil.isEmpty(orderInfo)) {
System.out.println(" ───────────────────────────────────────────────────");
System.out.println("등록된 메뉴가 없습니다!");
System.out.println(" ───────────────────────────────────────────────────");
}else {
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
System.out.println("주문번호 주문코드 메뉴명 주문수량 배달예상시간 메뉴별총금액 주문날짜 주문자명 주문자주소 결제여부");
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
for(Map<String, Object> item : orderInfo) {
int memOrderNoLen = gapUtil.gapCnt(item, "ORDERNO");
int memOrderCodeLen = gapUtil.gapCnt(item, "ORDERCODE");
int memMenuNmLen = gapUtil.gapCnt(item, "MENUNM");
int memOrderQtyLen = gapUtil.gapCnt(item, "ORDERQTY");
int memOrderEtaLen = gapUtil.gapCnt(item, "ORDERETA");
int memTotalPriceLen = gapUtil.gapCnt(item, "TOTALPRICE");
int memOrderDateLen = gapUtil.gapCnt(item, "ORDERDATE");
int memMemNmLen = gapUtil.gapCnt(item, "MEMNM");
int memMemAddLen = gapUtil.gapCnt(item, "MEMADD");
int memSelYnLen = gapUtil.gapCnt(item, "SELYN");
StringBuilder memOrderNo = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERNO")), maxOrderNoLen, memOrderNoLen);
StringBuilder memOrderCode = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERCODE")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memMenuNm = gapUtil.gapFullSpace(String.valueOf(item.get("MENUNM")), maxMenuNmLen, memMenuNmLen);
StringBuilder memOrderQty = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERQTY")), maxOrderQtyLen, memOrderQtyLen);
StringBuilder memOrderEta = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERETA")), maxOrderEtaLen, memOrderEtaLen);
StringBuilder memTotalPrice = gapUtil.gapFullSpace(String.valueOf(item.get("TOTALPRICE")), maxTotalPriceLen, memTotalPriceLen);
StringBuilder memOrderDate = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERDATE")), maxOrderDateLen, memOrderDateLen);
StringBuilder memMemNm = gapUtil.gapFullSpace(String.valueOf(item.get("MEMNM")), maxMemNmLen, memMemNmLen);
StringBuilder memMemAdd = gapUtil.gapFullSpace(String.valueOf(item.get("MEMADD")), maxMemAddLen, memMemAddLen);
StringBuilder memSelYn = gapUtil.gapFullSpace(String.valueOf(item.get("SELYN")), maxSelYnLen, memSelYnLen);
System.out.printf("%-" + maxOrderNoLen + "s%-" + maxOrderCodeLen + "s%-" + maxMenuNmLen + "s%-" + maxOrderQtyLen + "s%" + maxOrderEtaLen + "s%" + maxTotalPriceLen + "s%" + maxOrderDateLen + "s%" + maxMemNmLen + "s%" + maxMemAddLen + "s%" + maxSelYnLen + "s\n", memOrderNo, memOrderCode, memMenuNm, memOrderQty, memOrderEta, memTotalPrice, memOrderDate, memMemNm, memMemAdd, memSelYn);
}
}
EnterUtil.enterNext(2);
}else if(searchno == 3) {
System.out.print("메뉴명 >> ");
String orderMenuNmStr = ScanUtil.nextLine();
List<Object> searchMenuNm = new ArrayList<>();
searchMenuNm.add(orderMenuNmStr);
List<Map<String, Object>> orderInfo = adminReadDAO.orderSearchFromMenuNm(searchMenuNm);
if(NullCheckUtil.isEmpty(orderInfo)) {
System.out.println(" ───────────────────────────────────────────────────");
System.out.println("등록된 메뉴가 없습니다!");
System.out.println(" ───────────────────────────────────────────────────");
}else {
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
System.out.println("주문번호 주문코드 메뉴명 주문수량 배달예상시간 메뉴별총금액 주문날짜 주문자명 주문자주소 결제여부");
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
for(Map<String, Object> item : orderInfo) {
int memOrderNoLen = gapUtil.gapCnt(item, "ORDERNO");
int memOrderCodeLen = gapUtil.gapCnt(item, "ORDERCODE");
int memMenuNmLen = gapUtil.gapCnt(item, "MENUNM");
int memOrderQtyLen = gapUtil.gapCnt(item, "ORDERQTY");
int memOrderEtaLen = gapUtil.gapCnt(item, "ORDERETA");
int memTotalPriceLen = gapUtil.gapCnt(item, "TOTALPRICE");
int memOrderDateLen = gapUtil.gapCnt(item, "ORDERDATE");
int memMemNmLen = gapUtil.gapCnt(item, "MEMNM");
int memMemAddLen = gapUtil.gapCnt(item, "MEMADD");
int memSelYnLen = gapUtil.gapCnt(item, "SELYN");
StringBuilder memOrderNo = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERNO")), maxOrderNoLen, memOrderNoLen);
StringBuilder memOrderCode = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERCODE")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memMenuNm = gapUtil.gapFullSpace(String.valueOf(item.get("MENUNM")), maxMenuNmLen, memMenuNmLen);
StringBuilder memOrderQty = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERQTY")), maxOrderQtyLen, memOrderQtyLen);
StringBuilder memOrderEta = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERETA")), maxOrderEtaLen, memOrderEtaLen);
StringBuilder memTotalPrice = gapUtil.gapFullSpace(String.valueOf(item.get("TOTALPRICE")), maxTotalPriceLen, memTotalPriceLen);
StringBuilder memOrderDate = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERDATE")), maxOrderDateLen, memOrderDateLen);
StringBuilder memMemNm = gapUtil.gapFullSpace(String.valueOf(item.get("MEMNM")), maxMemNmLen, memMemNmLen);
StringBuilder memMemAdd = gapUtil.gapFullSpace(String.valueOf(item.get("MEMADD")), maxMemAddLen, memMemAddLen);
StringBuilder memSelYn = gapUtil.gapFullSpace(String.valueOf(item.get("SELYN")), maxSelYnLen, memSelYnLen);
System.out.printf("%-" + maxOrderNoLen + "s%-" + maxOrderCodeLen + "s%-" + maxMenuNmLen + "s%-" + maxOrderQtyLen + "s%" + maxOrderEtaLen + "s%" + maxTotalPriceLen + "s%" + maxOrderDateLen + "s%" + maxMemNmLen + "s%" + maxMemAddLen + "s%" + maxSelYnLen + "s\n", memOrderNo, memOrderCode, memMenuNm, memOrderQty, memOrderEta, memTotalPrice, memOrderDate, memMemNm, memMemAdd, memSelYn);
}
}
EnterUtil.enterNext(2);
}else if(searchno == 4) {
System.out.print("주문연도 (YYYY) 입력 >> ");
int orderYearStr = ScanUtil.nextInt();
System.out.print("주문월 (MM) 입력 >> ");
int orderMonthStr = ScanUtil.nextInt();
System.out.print("주문일 (DD) 입력 >> ");
int orderDayStr = ScanUtil.nextInt();
String orderDateStr = orderYearStr + "-" + orderMonthStr + "-" + orderDayStr;
List<Object> searchOrderDate = new ArrayList<>();
searchOrderDate.add(orderDateStr);
List<Map<String, Object>> orderInfo = adminReadDAO.orderSearchFromOrderDate(searchOrderDate);
if(NullCheckUtil.isEmpty(orderInfo)) {
System.out.println(" ───────────────────────────────────────────────────");
System.out.println("등록된 메뉴가 없습니다!");
System.out.println(" ───────────────────────────────────────────────────");
}else {
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
System.out.println("주문번호 주문코드 메뉴명 주문수량 배달예상시간 메뉴별총금액 주문날짜 주문자명 주문자주소 결제여부");
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
for(Map<String, Object> item : orderInfo) {
int memOrderNoLen = gapUtil.gapCnt(item, "ORDERNO");
int memOrderCodeLen = gapUtil.gapCnt(item, "ORDERCODE");
int memMenuNmLen = gapUtil.gapCnt(item, "MENUNM");
int memOrderQtyLen = gapUtil.gapCnt(item, "ORDERQTY");
int memOrderEtaLen = gapUtil.gapCnt(item, "ORDERETA");
int memTotalPriceLen = gapUtil.gapCnt(item, "TOTALPRICE");
int memOrderDateLen = gapUtil.gapCnt(item, "ORDERDATE");
int memMemNmLen = gapUtil.gapCnt(item, "MEMNM");
int memMemAddLen = gapUtil.gapCnt(item, "MEMADD");
int memSelYnLen = gapUtil.gapCnt(item, "SELYN");
StringBuilder memOrderNo = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERNO")), maxOrderNoLen, memOrderNoLen);
StringBuilder memOrderCode = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERCODE")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memMenuNm = gapUtil.gapFullSpace(String.valueOf(item.get("MENUNM")), maxMenuNmLen, memMenuNmLen);
StringBuilder memOrderQty = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERQTY")), maxOrderQtyLen, memOrderQtyLen);
StringBuilder memOrderEta = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERETA")), maxOrderEtaLen, memOrderEtaLen);
StringBuilder memTotalPrice = gapUtil.gapFullSpace(String.valueOf(item.get("TOTALPRICE")), maxTotalPriceLen, memTotalPriceLen);
StringBuilder memOrderDate = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERDATE")), maxOrderDateLen, memOrderDateLen);
StringBuilder memMemNm = gapUtil.gapFullSpace(String.valueOf(item.get("MEMNM")), maxMemNmLen, memMemNmLen);
StringBuilder memMemAdd = gapUtil.gapFullSpace(String.valueOf(item.get("MEMADD")), maxMemAddLen, memMemAddLen);
StringBuilder memSelYn = gapUtil.gapFullSpace(String.valueOf(item.get("SELYN")), maxSelYnLen, memSelYnLen);
System.out.printf("%-" + maxOrderNoLen + "s%-" + maxOrderCodeLen + "s%-" + maxMenuNmLen + "s%-" + maxOrderQtyLen + "s%" + maxOrderEtaLen + "s%" + maxTotalPriceLen + "s%" + maxOrderDateLen + "s%" + maxMemNmLen + "s%" + maxMemAddLen + "s%" + maxSelYnLen + "s\n", memOrderNo, memOrderCode, memMenuNm, memOrderQty, memOrderEta, memTotalPrice, memOrderDate, memMemNm, memMemAdd, memSelYn);
}
}
EnterUtil.enterNext(2);
}else if(searchno == 5) {
System.out.print("얼마 이상 배달시간을 예상하세요? (XX분 단위로 입력) >> ");
int orderOrderEtaInt = ScanUtil.nextInt();
List<Object> searchOrderEta = new ArrayList<>();
searchOrderEta.add(orderOrderEtaInt);
List<Map<String, Object>> orderInfo = adminReadDAO.orderSearchFromOrderEta(searchOrderEta);
if(NullCheckUtil.isEmpty(orderInfo)) {
System.out.println(" ───────────────────────────────────────────────────");
System.out.println("등록된 메뉴가 없습니다!");
System.out.println(" ───────────────────────────────────────────────────");
}else {
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
System.out.println("주문번호 주문코드 메뉴명 주문수량 배달예상시간 메뉴별총금액 주문날짜 주문자명 주문자주소 결제여부");
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
for(Map<String, Object> item : orderInfo) {
int memOrderNoLen = gapUtil.gapCnt(item, "ORDERNO");
int memOrderCodeLen = gapUtil.gapCnt(item, "ORDERCODE");
int memMenuNmLen = gapUtil.gapCnt(item, "MENUNM");
int memOrderQtyLen = gapUtil.gapCnt(item, "ORDERQTY");
int memOrderEtaLen = gapUtil.gapCnt(item, "ORDERETA");
int memTotalPriceLen = gapUtil.gapCnt(item, "TOTALPRICE");
int memOrderDateLen = gapUtil.gapCnt(item, "ORDERDATE");
int memMemNmLen = gapUtil.gapCnt(item, "MEMNM");
int memMemAddLen = gapUtil.gapCnt(item, "MEMADD");
int memSelYnLen = gapUtil.gapCnt(item, "SELYN");
StringBuilder memOrderNo = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERNO")), maxOrderNoLen, memOrderNoLen);
StringBuilder memOrderCode = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERCODE")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memMenuNm = gapUtil.gapFullSpace(String.valueOf(item.get("MENUNM")), maxMenuNmLen, memMenuNmLen);
StringBuilder memOrderQty = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERQTY")), maxOrderQtyLen, memOrderQtyLen);
StringBuilder memOrderEta = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERETA")), maxOrderEtaLen, memOrderEtaLen);
StringBuilder memTotalPrice = gapUtil.gapFullSpace(String.valueOf(item.get("TOTALPRICE")), maxTotalPriceLen, memTotalPriceLen);
StringBuilder memOrderDate = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERDATE")), maxOrderDateLen, memOrderDateLen);
StringBuilder memMemNm = gapUtil.gapFullSpace(String.valueOf(item.get("MEMNM")), maxMemNmLen, memMemNmLen);
StringBuilder memMemAdd = gapUtil.gapFullSpace(String.valueOf(item.get("MEMADD")), maxMemAddLen, memMemAddLen);
StringBuilder memSelYn = gapUtil.gapFullSpace(String.valueOf(item.get("SELYN")), maxSelYnLen, memSelYnLen);
System.out.printf("%-" + maxOrderNoLen + "s%-" + maxOrderCodeLen + "s%-" + maxMenuNmLen + "s%-" + maxOrderQtyLen + "s%" + maxOrderEtaLen + "s%" + maxTotalPriceLen + "s%" + maxOrderDateLen + "s%" + maxMemNmLen + "s%" + maxMemAddLen + "s%" + maxSelYnLen + "s\n", memOrderNo, memOrderCode, memMenuNm, memOrderQty, memOrderEta, memTotalPrice, memOrderDate, memMemNm, memMemAdd, memSelYn);
}
}
EnterUtil.enterNext(2);
}else if(searchno == 6) {
System.out.print("결제 여부 (y / n) >> ");
String orderSelYnStr = ScanUtil.nextLine();
orderSelYnStr = orderSelYnStr.toUpperCase();
List<Object> searchSelYn = new ArrayList<>();
searchSelYn.add(orderSelYnStr);
List<Map<String, Object>> orderInfo = adminReadDAO.orderSearchFromSelYn(searchSelYn);
if(NullCheckUtil.isEmpty(orderInfo)) {
System.out.println(" ───────────────────────────────────────────────────");
System.out.println("등록된 메뉴가 없습니다!");
System.out.println(" ───────────────────────────────────────────────────");
}else {
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
System.out.println("주문번호 주문코드 메뉴명 주문수량 배달예상시간 메뉴별총금액 주문날짜 주문자명 주문자주소 결제여부");
System.out.println(" ──────────────────────────────────────────────────────────────────────────────────────────────────");
for(Map<String, Object> item : orderInfo) {
int memOrderNoLen = gapUtil.gapCnt(item, "ORDERNO");
int memOrderCodeLen = gapUtil.gapCnt(item, "ORDERCODE");
int memMenuNmLen = gapUtil.gapCnt(item, "MENUNM");
int memOrderQtyLen = gapUtil.gapCnt(item, "ORDERQTY");
int memOrderEtaLen = gapUtil.gapCnt(item, "ORDERETA");
int memTotalPriceLen = gapUtil.gapCnt(item, "TOTALPRICE");
int memOrderDateLen = gapUtil.gapCnt(item, "ORDERDATE");
int memMemNmLen = gapUtil.gapCnt(item, "MEMNM");
int memMemAddLen = gapUtil.gapCnt(item, "MEMADD");
int memSelYnLen = gapUtil.gapCnt(item, "SELYN");
StringBuilder memOrderNo = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERNO")), maxOrderNoLen, memOrderNoLen);
StringBuilder memOrderCode = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERCODE")), maxOrderCodeLen, memOrderCodeLen);
StringBuilder memMenuNm = gapUtil.gapFullSpace(String.valueOf(item.get("MENUNM")), maxMenuNmLen, memMenuNmLen);
StringBuilder memOrderQty = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERQTY")), maxOrderQtyLen, memOrderQtyLen);
StringBuilder memOrderEta = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERETA")), maxOrderEtaLen, memOrderEtaLen);
StringBuilder memTotalPrice = gapUtil.gapFullSpace(String.valueOf(item.get("TOTALPRICE")), maxTotalPriceLen, memTotalPriceLen);
StringBuilder memOrderDate = gapUtil.gapFullSpace(String.valueOf(item.get("ORDERDATE")), maxOrderDateLen, memOrderDateLen);
StringBuilder memMemNm = gapUtil.gapFullSpace(String.valueOf(item.get("MEMNM")), maxMemNmLen, memMemNmLen);
StringBuilder memMemAdd = gapUtil.gapFullSpace(String.valueOf(item.get("MEMADD")), maxMemAddLen, memMemAddLen);
StringBuilder memSelYn = gapUtil.gapFullSpace(String.valueOf(item.get("SELYN")), maxSelYnLen, memSelYnLen);
System.out.printf("%-" + maxOrderNoLen + "s%-" + maxOrderCodeLen + "s%-" + maxMenuNmLen + "s%-" + maxOrderQtyLen + "s%" + maxOrderEtaLen + "s%" + maxTotalPriceLen + "s%" + maxOrderDateLen + "s%" + maxMemNmLen + "s%" + maxMemAddLen + "s%" + maxSelYnLen + "s\n", memOrderNo, memOrderCode, memMenuNm, memOrderQty, memOrderEta, memTotalPrice, memOrderDate, memMemNm, memMemAdd, memSelYn);
}
}
EnterUtil.enterNext(2);
}
}
}
return View.ADMIN_ORDERHISTORY;
}
'대덕인재개발원 > 대덕인재개발원_1st project' 카테고리의 다른 글
9. 관리자 페이지 (6) : 라이더 관리 (0) | 2023.08.19 |
---|---|
8. 관리자 페이지 (5) : 메뉴 관리 (0) | 2023.08.19 |
6. 관리자 페이지 (3) : 가게 리스트 관리 (0) | 2023.08.19 |
5. 관리자 페이지 (2) : 회원정보 관리 (0) | 2023.08.19 |
4. 관리자 페이지 (1) : 관리자 로그인 (0) | 2023.08.19 |