Search in sources :

Example 21 with ApiRest

use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.

the class ElemeController method setDeliveryTime.

/**
 * 查询店铺信息
 *
 * @return
 */
@RequestMapping(value = "setDeliveryTime")
@ResponseBody
public String setDeliveryTime() {
    ApiRest apiRest = null;
    Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
    try {
        SetDeliveryTimeModel setDeliveryTimeModel = ApplicationHandler.instantiateObject(SetDeliveryTimeModel.class, requestParameters);
        setDeliveryTimeModel.validateAndThrow();
        apiRest = elemeService.setDeliveryTime(setDeliveryTimeModel);
    } catch (Exception e) {
        LogUtils.error("设置送达时间失败", controllerSimpleName, "setDeliveryTime", e, requestParameters);
        apiRest = new ApiRest(e);
    }
    return GsonUtils.toJson(apiRest);
}
Also used : ApiRest(build.dream.common.api.ApiRest) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 22 with ApiRest

use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.

the class ElemeController method receivedOrderLite.

/**
 * 订单确认送达
 *
 * @return
 */
@RequestMapping(value = "/receivedOrderLite")
@ResponseBody
public String receivedOrderLite() {
    ApiRest apiRest = null;
    Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
    try {
        ReceivedOrderLiteModel receivedOrderLiteModel = ApplicationHandler.instantiateObject(ReceivedOrderLiteModel.class, requestParameters);
        receivedOrderLiteModel.validateAndThrow();
        apiRest = elemeService.receivedOrderLite(receivedOrderLiteModel);
    } catch (Exception e) {
        LogUtils.error("订单确认送达失败", controllerSimpleName, "receivedOrderLite", e, requestParameters);
        apiRest = new ApiRest(e);
    }
    return GsonUtils.toJson(apiRest);
}
Also used : ApiRest(build.dream.common.api.ApiRest) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 23 with ApiRest

use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.

the class ElemeController method getAllOrders.

/**
 * 查询全部订单
 *
 * @return
 */
@RequestMapping(value = "getAllOrders")
@ResponseBody
public String getAllOrders() {
    ApiRest apiRest = null;
    Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
    try {
        GetAllOrdersModel getAllOrdersModel = ApplicationHandler.instantiateObject(GetAllOrdersModel.class, requestParameters);
        getAllOrdersModel.validateAndThrow();
        apiRest = elemeService.getAllOrders(getAllOrdersModel);
    } catch (Exception e) {
        LogUtils.error("查询全部订单失败", controllerSimpleName, "getAllOrders", e, requestParameters);
        apiRest = new ApiRest(e);
    }
    return GsonUtils.toJson(apiRest);
}
Also used : ApiRest(build.dream.common.api.ApiRest) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 24 with ApiRest

use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.

the class ElemeController method cancelDelivery.

/**
 * 取消呼叫配送
 *
 * @return
 */
@RequestMapping(value = "cancelDelivery")
@ResponseBody
public String cancelDelivery() {
    ApiRest apiRest = null;
    Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
    try {
        CancelDeliveryModel cancelDeliveryModel = ApplicationHandler.instantiateObject(CancelDeliveryModel.class, requestParameters);
        cancelDeliveryModel.validateAndThrow();
        apiRest = elemeService.cancelDelivery(cancelDeliveryModel);
    } catch (Exception e) {
        LogUtils.error("取消呼叫配送失败", controllerSimpleName, "cancelDelivery", e, requestParameters);
        apiRest = new ApiRest(e);
    }
    return GsonUtils.toJson(apiRest);
}
Also used : ApiRest(build.dream.common.api.ApiRest) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 25 with ApiRest

use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.

the class ElemeController method getShopCategoriesWithChildren.

@RequestMapping(value = "/getShopCategoriesWithChildren")
@ResponseBody
public String getShopCategoriesWithChildren() {
    ApiRest apiRest = null;
    Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
    try {
        String tenantId = requestParameters.get("tenantId");
        Validate.notNull(tenantId, "参数(tenantId)不能为空!");
        String branchId = requestParameters.get("branchId");
        Validate.notNull(branchId, "参数(branchId)不能为空!");
        Branch branch = elemeService.findBranch(BigInteger.valueOf(Long.valueOf(tenantId)), BigInteger.valueOf(Long.valueOf(branchId)));
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("shopId", branch.getShopId());
        apiRest = ElemeUtils.callElemeSystem(tenantId, branchId, branch.getElemeAccountType(), "eleme.product.category.getShopCategoriesWithChildren", params);
    } catch (Exception e) {
        LogUtils.error("查询店铺商品分类失败", controllerSimpleName, "getShopCategoriesWithChildren", e, requestParameters);
        apiRest = new ApiRest(e);
    }
    return GsonUtils.toJson(apiRest);
}
Also used : HashMap(java.util.HashMap) Branch(build.dream.common.erp.catering.domains.Branch) ApiRest(build.dream.common.api.ApiRest) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

ApiRest (build.dream.common.api.ApiRest)187 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)101 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)101 BigInteger (java.math.BigInteger)78 HashMap (java.util.HashMap)68 IOException (java.io.IOException)59 JSONObject (net.sf.json.JSONObject)56 Transactional (org.springframework.transaction.annotation.Transactional)36 SearchModel (build.dream.common.utils.SearchModel)19 Branch (build.dream.common.erp.catering.domains.Branch)14 ArrayList (java.util.ArrayList)8 SimpleDateFormat (java.text.SimpleDateFormat)6 Map (java.util.Map)6 GoodsCategory (build.dream.common.erp.catering.domains.GoodsCategory)5 SaveBuyGiveActivityModel (build.dream.catering.models.activity.SaveBuyGiveActivityModel)2 SaveSpecialGoodsActivityModel (build.dream.catering.models.activity.SaveSpecialGoodsActivityModel)2 SaveDietOrderModel (build.dream.catering.models.dietorder.SaveDietOrderModel)2 Pos (build.dream.common.erp.catering.domains.Pos)2 Vip (build.dream.common.erp.catering.domains.Vip)2 UpdateModel (build.dream.common.utils.UpdateModel)2