Search in sources :

Example 26 with ApiRest

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);
}
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 27 with 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);
}
Also used : HashMap(java.util.HashMap) Branch(build.dream.common.erp.catering.domains.Branch) GoodsCategory(build.dream.common.erp.catering.domains.GoodsCategory) BigInteger(java.math.BigInteger) 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 28 with 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);
}
Also used : ApiRest(build.dream.common.api.ApiRest) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 29 with 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);
}
Also used : ApiRest(build.dream.common.api.ApiRest) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 30 with 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);
}
Also used : ApiRest(build.dream.common.api.ApiRest) 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