Search in sources :

Example 11 with ApiRest

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

the class ElemeController method getCategory.

@RequestMapping(value = "/getCategory")
@ResponseBody
public String getCategory() {
    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)不能为空!");
    } catch (Exception e) {
        LogUtils.error("查询商品分类详情失败", controllerSimpleName, "getCategory", 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 12 with ApiRest

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

the class ElemeController method addDeliveryTipByOrderId.

/**
 * 订单加小费
 *
 * @return
 */
@RequestMapping(value = "addDeliveryTipByOrderId")
@ResponseBody
public String addDeliveryTipByOrderId() {
    ApiRest apiRest = null;
    Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
    try {
        AddDeliveryTipByOrderIdModel addDeliveryTipByOrderIdModel = ApplicationHandler.instantiateObject(AddDeliveryTipByOrderIdModel.class, requestParameters);
        addDeliveryTipByOrderIdModel.validateAndThrow();
        apiRest = elemeService.addDeliveryTipByOrderId(addDeliveryTipByOrderIdModel);
    } catch (Exception e) {
        LogUtils.error("订单加小费失败", controllerSimpleName, "addDeliveryTipByOrderId", 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 13 with ApiRest

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

the class ElemeController method queryItemByPage.

/**
 * 分页获取店铺下的商品
 *
 * @return
 */
@RequestMapping(value = "/queryItemByPage")
@ResponseBody
public String queryItemByPage() {
    ApiRest apiRest = null;
    Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
    try {
        QueryItemByPageModel queryItemByPageModel = ApplicationHandler.instantiateObject(QueryItemByPageModel.class, requestParameters);
        queryItemByPageModel.validateAndThrow();
        Branch branch = elemeService.findBranch(queryItemByPageModel.getTenantId(), queryItemByPageModel.getBranchId());
        Map<String, Object> queryPage = new HashMap<String, Object>();
        queryPage.put("shopId", branch.getShopId());
        queryPage.put("offset", queryItemByPageModel.getOffset());
        queryPage.put("limit", queryItemByPageModel.getLimit());
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("queryPage", queryPage);
        apiRest = ElemeUtils.callElemeSystem(queryItemByPageModel.getTenantId().toString(), queryItemByPageModel.getBranchId().toString(), branch.getElemeAccountType(), "eleme.product.item.queryItemByPage", params);
    } catch (Exception e) {
        LogUtils.error("分页获取店铺下的商品失败", controllerSimpleName, "queryItemByPage", 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)

Example 14 with ApiRest

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

the class ElemeController method obtainElemeCallbackMessage.

@RequestMapping(value = "/obtainElemeCallbackMessage")
@ResponseBody
public String obtainElemeCallbackMessage() {
    ApiRest apiRest = null;
    Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
    try {
        ObtainElemeCallbackMessageModel obtainElemeCallbackMessageModel = ApplicationHandler.instantiateObject(ObtainElemeCallbackMessageModel.class, requestParameters);
        obtainElemeCallbackMessageModel.validateAndThrow();
        apiRest = elemeService.obtainElemeCallbackMessage(obtainElemeCallbackMessageModel);
    } catch (Exception e) {
        LogUtils.error("获取饿了么回调消息失败!", controllerSimpleName, "obtainElemeCallbackMessage", 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 15 with ApiRest

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

the class ElemeController method getDeliveryFeeForCrowd.

/**
 * 众包订单询价,获取配送费
 *
 * @return
 */
@RequestMapping(value = "getDeliveryFeeForCrowd")
@ResponseBody
public String getDeliveryFeeForCrowd() {
    ApiRest apiRest = null;
    Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
    try {
        GetDeliveryFeeForCrowdModel getDeliveryFeeForCrowdModel = ApplicationHandler.instantiateObject(GetDeliveryFeeForCrowdModel.class, requestParameters);
        getDeliveryFeeForCrowdModel.validateAndThrow();
        apiRest = elemeService.getDeliveryFeeForCrowd(getDeliveryFeeForCrowdModel);
    } catch (Exception e) {
        LogUtils.error("众包订单询价,获取配送费失败", controllerSimpleName, "getDeliveryFeeForCrowd", 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)

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