/** * 商品限购,这也算一种 [ 库存不足 ] 的异常,还应该让客户知道,什么时候解除限制 * Created by helloztt on 2017/8/23. */ @Getter @Setter public class MainGoodLimitStockException extends MainGoodLowStockException { @Description("限购解除时间") private final Map<MainGood,LocalDateTime> relieveTime; public MainGoodLimitStockException(Map<MainGood,Integer> goodStock,Map<MainGood,LocalDateTime> relieveTime) { super(goodStock); this.relieveTime = relieveTime; } }
@RestResource(rel = "by-name", description = @Description("Find by name")) public Restaurant findFirstByName(@Param("name") String name); }
/** * 商品库存不足提醒,应该让用户知道,是哪个商品库存不够 * Created by helloztt on 2017/8/23. */ @AllArgsConstructor @Getter @Setter public class MainGoodLowStockException extends ServletException { @Description("限购商品") private final Map<MainGood,Integer> usableGoodStock; public JSONArray toData(){ JSONArray jsonArray = new JSONArray(); usableGoodStock.keySet().forEach(mainGood -> { JSONObject jsonObject = new JSONObject(); jsonObject.put("goodId",mainGood.getId()); jsonObject.put("stock",usableGoodStock.get(mainGood)); jsonArray.add(jsonObject); }); return jsonArray; } }
@RestResource(rel = "by-name", description = @Description("Find by name")) public Restaurant findFirstByName(@Param("name") String name); }
@RestResource(rel = "by-id", description = @Description("find payment by id")) Payment findPaymentById(@Param("id") String id); }
@RestResource(rel = "by-rid", description = @Description("Get all menuitems by restaurant id")) public List<MenuItem> findAllByRestaurantId(String rid);
@RestResource(rel = "by-rid", description = @Description("Get all menuitems by restaurant id")) public List<MenuItem> findAllByRestaurantId(String rid);
@RestResource(rel = "by-location", description = @Description("Find by location, comma separated, e.g. 'lat,long', and distance, e.g. '50km'") ) SupplyLocation findFirstByLocationNear(@Param("location") Point location);
@RestResource(rel = "by-name", description = @Description("Get menuitem by item name")) public MenuItem findByName(@Param("name") String name); }
@RestResource(rel = "save", description = @Description("Save order")) Order save(@Param("order") Order order); }
@RestResource(rel = "by-name", description = @Description("Get menuitem by item name")) public MenuItem findByName(@Param("name") String name); }
@RestResource(rel = "find-by-id", description = @Description("Find by id")) public Order findFirstById(@Param("id") String id);
@RestResource(rel = "save", description = @Description("Save order")) Order save(@Param("order") Order order); }
@RestResource(rel = "by-id", description = @Description("find payment by id")) Payment findPaymentById(@Param("id") String id); }
@RestResource(rel = "delete-by-id", description = @Description("Delete by id")) public void delete(@Param("id") String id);
@RestResource(rel = "by-id", description = @Description("Find order by id")) Order findOrderById(@Param("id") String id);
@RestResource(rel = "find-by-id", description = @Description("Find by id")) public Order findFirstById(@Param("id") String id);
@RestResource(rel = "by-id", description = @Description("Find order by id")) Order findOrderById(@Param("id") String id);
@RestResource(rel = "delete-by-id", description = @Description("Delete by id")) public void delete(@Param("id") String id);