Exemplo n.º 1
0
 @POST
 @Produces(MediaType.TEXT_PLAIN)
 @Consumes(MediaType.APPLICATION_JSON)
 @Path("/fetch")
 public String fetch(Criteria criteria) {
   System.out.println(criteria.toString("xml"));
   System.out.println(i18n.prop("msg_bobas_operation_successful"));
   return "ok.";
 }
Exemplo n.º 2
0
  @POST
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.APPLICATION_JSON)
  @Path("/fetchSalesOrder")
  public OperationResult<SalesOrder> fetchSalesOrder(
      Criteria criteria, @QueryParam("token") String token) {
    System.out.println(String.format("fetch by %s.", token));
    System.out.println(criteria.toString("xml"));

    OperationResult<SalesOrder> operationResult = new OperationResult<SalesOrder>();
    SalesOrder order = new SalesOrder();
    order.setDocEntry(1);
    order.setCustomerCode("C00001");
    order.setDeliveryDate(DateTime.getToday());
    order.setDocumentStatus(emDocumentStatus.Released);
    order.setDocumentTotal(new Decimal("99.99"));
    order.setCycle(new Time(1.05, emTimeUnit.hour));

    order.getUserFields().addUserField("U_OrderType", DbFieldType.db_Alphanumeric);
    order.getUserFields().addUserField("U_OrderId", DbFieldType.db_Numeric);
    order.getUserFields().addUserField("U_OrderDate", DbFieldType.db_Date);
    order.getUserFields().addUserField("U_OrderTotal", DbFieldType.db_Decimal);
    order.getUserFields().setValue("U_OrderType", "S0000");
    order.getUserFields().setValue("U_OrderId", 5768);
    order.getUserFields().setValue("U_OrderDate", DateTime.getToday());
    order.getUserFields().setValue("U_OrderTotal", new Decimal("999.888"));

    ISalesOrderItem orderItem = order.getSalesOrderItems().create();
    orderItem.setItemCode("A00001");
    orderItem.setQuantity(new Decimal(10));
    orderItem.setPrice(new Decimal(99.99));
    orderItem = order.getSalesOrderItems().create();
    orderItem.setItemCode("A00002");
    orderItem.setQuantity(10);
    orderItem.setPrice(199.99);

    // order.setDocumentUser(new User());
    // 此处json序列化存在问题,可能是jersey导致
    // order.setTeamUsers(new User[] { new User(), new User() });
    operationResult.addResultObjects(order);
    return operationResult;
  }