use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.
the class ElemeController method getUnprocessOrders.
/**
* 查询店铺未处理订单
*
* @return
*/
@RequestMapping(value = "getUnprocessOrders")
@ResponseBody
public String getUnprocessOrders() {
ApiRest apiRest = null;
Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
try {
GetUnprocessOrdersModel getUnprocessOrdersModel = ApplicationHandler.instantiateObject(GetUnprocessOrdersModel.class, requestParameters);
getUnprocessOrdersModel.validateAndThrow();
apiRest = elemeService.getUnprocessOrders(getUnprocessOrdersModel);
} catch (Exception e) {
LogUtils.error("查询店铺未处理订单失败", controllerSimpleName, "getUnprocessOrders", 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 createCategoryWithChildren.
@RequestMapping(value = "/createCategoryWithChildren")
@ResponseBody
public String createCategoryWithChildren() {
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)不能为空!");
String categoryId = requestParameters.get("categoryId");
Validate.notNull(categoryId, ApplicationHandler.obtainParameterErrorMessage("categoryId"));
BigInteger bigIntegerTenantId = NumberUtils.createBigInteger(tenantId);
BigInteger bigIntegerBranchId = NumberUtils.createBigInteger(branchId);
BigInteger bigIntegerCategoryId = NumberUtils.createBigInteger(categoryId);
Branch branch = elemeService.findBranch(bigIntegerTenantId, bigIntegerBranchId);
GoodsCategory goodsCategory = elemeService.findGoodsCategoryInfo(bigIntegerTenantId, bigIntegerBranchId, bigIntegerCategoryId);
Map<String, Object> params = new HashMap<String, Object>();
params.put("shopId", branch.getShopId());
params.put("name", goodsCategory.getName());
params.put("parentId", goodsCategory.getParentId());
params.put("description", goodsCategory.getDescription());
apiRest = ElemeUtils.callElemeSystem(tenantId, branchId, branch.getElemeAccountType(), "eleme.product.category.createCategoryWithChildren", params);
} catch (Exception e) {
LogUtils.error("添加商品分类失败", controllerSimpleName, "createCategoryWithChildren", 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 GoodsController method deleteGoodsSpecification.
/**
* 删除菜品规格
*
* @return
*/
@RequestMapping(value = "/deleteGoodsSpecification")
@ResponseBody
public String deleteGoodsSpecification() {
ApiRest apiRest = null;
Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
try {
DeleteGoodsSpecificationModel deleteGoodsSpecificationModel = ApplicationHandler.instantiateObject(DeleteGoodsSpecificationModel.class, requestParameters);
deleteGoodsSpecificationModel.validateAndThrow();
apiRest = goodsService.deleteGoodsSpecification(deleteGoodsSpecificationModel);
} catch (Exception e) {
LogUtils.error("删除菜品规格失败!", controllerSimpleName, "deleteGoodsSpecification", 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 GoodsController method listGoodses.
@RequestMapping(value = "/listGoodses")
@ResponseBody
public String listGoodses() {
ApiRest apiRest = null;
Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
try {
ListGoodsesModel listGoodsesModel = ApplicationHandler.instantiateObject(ListGoodsesModel.class, requestParameters);
listGoodsesModel.validateAndThrow();
apiRest = goodsService.listGoodses(listGoodsesModel);
} catch (Exception e) {
LogUtils.error("查询菜品失败", controllerSimpleName, "listGoodses", 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 GoodsController method listCategories.
/**
* 查询菜品分类
*
* @return
*/
@RequestMapping(value = "/listCategories")
@ResponseBody
public String listCategories() {
ApiRest apiRest = null;
Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
try {
ListCategoriesModel listCategoriesModel = ApplicationHandler.instantiateObject(ListCategoriesModel.class, requestParameters);
listCategoriesModel.validateAndThrow();
apiRest = goodsService.listCategories(listCategoriesModel);
} catch (Exception e) {
LogUtils.error("查询菜品分类失败", controllerSimpleName, "listCategories", e, requestParameters);
apiRest = new ApiRest(e);
}
return GsonUtils.toJson(apiRest);
}
Aggregations