コード例 #1
0
  @RequestMapping(
      value = {"/get-qrcode/{openid}/", "/get-qrcode/{openid}"},
      method = RequestMethod.GET)
  public ResponseEntity<ApiResult> get(@PathVariable("openid") String openid) {

    ApiResult sendResult = new ApiResult();

    QrcodeEntity qrcode = qrcodeDao.get(openid);

    if (qrcode != null) sendResult.setData(qrcode);
    else {
      sendResult.setStatus(HttpStatus.BAD_REQUEST);
      sendResult.setMessage("invalid openid");
    }

    return new ResponseEntity<ApiResult>(sendResult, sendResult.getStatus());
  }
コード例 #2
0
  @RequestMapping(
      value = {"/orderlist/{status}", "/orderlist/{status}/"},
      method = {RequestMethod.POST})
  public ResponseEntity<ApiResult> flushOrder(
      @PathVariable("status") OrderStatus status,
      @RequestBody Map<String, String> params,
      HttpServletRequest request)
      throws DbException {

    ApiResult sendResult = new ApiResult();
    String token = (String) params.get("token");

    if (!myToken.equals(token)) {
      sendResult.setStatus(HttpStatus.BAD_REQUEST);
      sendResult.setMessage("非法请求!");
    } else sendResult.setData(orderDao.get(status));

    return new ResponseEntity<ApiResult>(sendResult, sendResult.getStatus());
  }
コード例 #3
0
  @RequestMapping(value = {"/flush-order", "/flush-order/"})
  public ResponseEntity<ApiResult> flushOrder(
      @RequestBody Map<String, Object> params, HttpServletRequest request)
      throws DbException, IllegalAccessException {

    String userId = (String) params.get("userid");
    String openId = (String) params.get("openid");
    String orderid = (String) params.get("orderid");

    DeliveryCompany deliveryCompany =
        DeliveryCompany.valueOf((String) params.get("delivery_company"));
    String deliveryNo = (String) params.get("delivery_no");

    ApiResult sendResult = new ApiResult();

    OrderEntity order = orderDao.get(orderid, userId);

    if (order != null && order.getOpenId().equals(openId)) {
      order.setDeliveryCompany(deliveryCompany);
      order.setDeliveryNo(deliveryNo);
      order.setStatus(OrderStatus.SENDED);

      orderDao.addEvent(OrderStatus.SENDED, order, null, null);
      orderDao.update(order);

      sendResult.setData(Common.processOrder(order, orderDao));
    } else {
      sendResult.setStatus(HttpStatus.BAD_REQUEST);
      sendResult.setMessage("非法请求!");
      sendResult.setData(orderid);
    }

    // sendResult.setData(orderDao.paymentCompleted(orderid, userId, openId, paymentInfo));
    // sendResult.setData("userId:" + userId + ", openId:" + openId + ", " + orderid + ", " +
    // paymentInfo);

    return new ResponseEntity<ApiResult>(sendResult, sendResult.getStatus());
  }
コード例 #4
0
  @RequestMapping(
      value = {"/unified-order/", "/unified-order"},
      method = RequestMethod.POST)
  public ResponseEntity<ApiResult> unifiedOrder(@RequestBody Map<String, String> params)
      throws Exception {

    String orderid = params.get("orderid");
    String openid = params.get("openid");

    OrderEntity order = orderDao.get(orderid, openid);

    ApiResult sendResult = new ApiResult();

    if (order == null) {
      sendResult.setStatus(HttpStatus.BAD_REQUEST);
      sendResult.setMessage("Invalid Params");
      return new ResponseEntity<ApiResult>(sendResult, sendResult.getStatus());
    }

    sendResult.setData(Common.UnifiedOrder(wchatServerHost, order));

    return new ResponseEntity<ApiResult>(sendResult, sendResult.getStatus());
  }