7주문

주문 알람 웹소켓

  1. 주문 요청 서버 코드

        // 메시지 알림
          StoreOrderAlarmResponseDto responseDto = StoreOrderAlarmResponseDto.fromEntity(orders);
          // 메시지 페이로드 구성
          Map<String, Object> payload = new HashMap<>();
          payload.put("type", "ORDER_RECEIVED"); // 이벤트 타입
          payload.put("message", "새로운 주문이 접수되었습니다.");
          payload.put("data", responseDto); // DTO를 데이터에 포함
    
          String orderTopic = String.format("/topic/storeOrder/" + orders.getOrderId());
          messageTemplate.convertAndSend(orderTopic, responseDto);
          log.info("사장님 알람 전송" + payload);

    웹소켓 페이로드 json

    • 웹소켓 토픽: /topic/storeOrder/{orderId}

    • 전송된 메시지: payload 객체(JSON).

    {
      "orderId":1,
      "totalMenuCount": 3,
      "menuNames": {
        "Pizza": "2",
        "Burger": "1"
      },
      "totalPrice": 4500
    }

    위 내용이 알람이 갈 때 함께 갑니다!!

주문 현황 페이지 get

GET /api/order/store/order-list/{storeId}

상세 조회, 전체 리스트가 한번에 보내집니다.

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Description

name

string

Name of the user

age

number

Age of the user

Response

주문 수

POST /api/order/{orderId}/accept

주문 알람 창의 승락 버튼을 누르면 post 요청이 갑니다.

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

RequestBody

Name
Type
Description

string

가게 아이디

long

주문 아이디

int

주문 조리 예상시간 ex 15분 이면 15 숫자만

Response

주문 거절

POST /api/order/{orderId}/decline

<Description of the endpoint>

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

RequestBody

Name
Type
Description

string

가게 아이디

long

주문 아이디

string

Response

200

Last updated