Search in sources :

Example 1 with GoodsCategory

use of build.dream.common.erp.catering.domains.GoodsCategory 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 2 with GoodsCategory

use of build.dream.common.erp.catering.domains.GoodsCategory in project erp-catering by liuyandong33.

the class ElemeController method updateCategory.

@RequestMapping(value = "/updateCategory")
@ResponseBody
public String updateCategory() {
    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("categoryId", goodsCategory.getId());
        params.put("name", goodsCategory.getName());
        params.put("description", goodsCategory.getDescription());
        apiRest = ElemeUtils.callElemeSystem(tenantId, branchId, branch.getElemeAccountType(), "eleme.product.category.updateCategory", params);
    } catch (Exception e) {
        LogUtils.error("更新商品分类失败", controllerSimpleName, "updateCategory", 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 3 with GoodsCategory

use of build.dream.common.erp.catering.domains.GoodsCategory in project erp-catering by liuyandong33.

the class ElemeController method updateCategoryWithChildren.

@RequestMapping(value = "/updateCategoryWithChildren")
@ResponseBody
public String updateCategoryWithChildren() {
    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("categoryId", goodsCategory.getId());
        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.updateCategoryWithChildren", params);
    } catch (Exception e) {
        LogUtils.error("更新商品分类失败", controllerSimpleName, "updateCategoryWithChildren", 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 4 with GoodsCategory

use of build.dream.common.erp.catering.domains.GoodsCategory in project erp-catering by liuyandong33.

the class ElemeController method removeCategory.

@RequestMapping(value = "/removeCategory")
@ResponseBody
public String removeCategory() {
    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("categoryId", goodsCategory.getId());
        apiRest = ElemeUtils.callElemeSystem(tenantId, branchId, branch.getElemeAccountType(), "eleme.product.category.removeCategory", params);
    } catch (Exception e) {
        LogUtils.error("删除商品分类失败", controllerSimpleName, "removeCategory", 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 5 with GoodsCategory

use of build.dream.common.erp.catering.domains.GoodsCategory in project erp-catering by liuyandong33.

the class ElemeController method createCategory.

@RequestMapping(value = "/createCategory")
@ResponseBody
public String createCategory() {
    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("description", goodsCategory.getDescription());
        apiRest = ElemeUtils.callElemeSystem(tenantId, branchId, branch.getElemeAccountType(), "eleme.product.category.createCategory", params);
    } catch (Exception e) {
        LogUtils.error("添加商品分类失败", controllerSimpleName, "createCategory", 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)

Aggregations

ApiRest (build.dream.common.api.ApiRest)5 Branch (build.dream.common.erp.catering.domains.Branch)5 GoodsCategory (build.dream.common.erp.catering.domains.GoodsCategory)5 IOException (java.io.IOException)5 BigInteger (java.math.BigInteger)5 HashMap (java.util.HashMap)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)5