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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations