use of build.dream.common.erp.catering.domains.Branch in project erp-catering by liuyandong33.
the class ElemeController method getShopSalesItems.
/**
* 查询店铺活动商品
*
* @return
*/
@RequestMapping(value = "/getShopSalesItems")
@ResponseBody
public String getShopSalesItems() {
ApiRest apiRest = null;
Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
try {
GetShopSalesItemsModel getShopSalesItemsModel = ApplicationHandler.instantiateObject(GetShopSalesItemsModel.class, requestParameters);
getShopSalesItemsModel.validateAndThrow();
Branch branch = elemeService.findBranch(getShopSalesItemsModel.getTenantId(), getShopSalesItemsModel.getBranchId());
Map<String, Object> params = new HashMap<String, Object>();
params.put("shopId", branch.getShopId());
ApiRest callElemeSystemApiRest = ElemeUtils.callElemeSystem(getShopSalesItemsModel.getTenantId().toString(), getShopSalesItemsModel.getBranchId().toString(), branch.getElemeAccountType(), "eleme.product.item.getShopSalesItems", params);
Validate.isTrue(callElemeSystemApiRest.isSuccessful(), callElemeSystemApiRest.getError());
apiRest = new ApiRest();
apiRest.setData(callElemeSystemApiRest.getData());
apiRest.setMessage("查询店铺活动商品成功!");
apiRest.setSuccessful(true);
} catch (Exception e) {
LogUtils.error("查询店铺活动商品失败", controllerSimpleName, "getShopSalesItems", e, requestParameters);
apiRest = new ApiRest(e);
}
return GsonUtils.toJson(apiRest);
}
use of build.dream.common.erp.catering.domains.Branch 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);
}
use of build.dream.common.erp.catering.domains.Branch in project erp-catering by liuyandong33.
the class ElemeController method getCategoryWithChildren.
@RequestMapping(value = "/getCategoryWithChildren")
@ResponseBody
public String getCategoryWithChildren() {
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)不能为空!");
Branch branch = elemeService.findBranch(NumberUtils.createBigInteger(tenantId), NumberUtils.createBigInteger(branchId));
Map<String, Object> params = new HashMap<String, Object>();
params.put("shopId", branch.getShopId());
apiRest = ElemeUtils.callElemeSystem(tenantId, branchId, branch.getElemeAccountType(), "eleme.product.category.getShopCategoriesWithChildren", params);
} catch (Exception e) {
LogUtils.error("查询商品分类详情失败", controllerSimpleName, "getCategoryWithChildren", e, requestParameters);
apiRest = new ApiRest(e);
}
return GsonUtils.toJson(apiRest);
}
use of build.dream.common.erp.catering.domains.Branch 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);
}
Aggregations