use of build.dream.common.erp.catering.domains.Branch in project erp-catering by liuyandong33.
the class BranchService method initializeBranch.
@Transactional(rollbackFor = Exception.class)
public ApiRest initializeBranch(InitializeBranchModel initializeBranchModel) {
Branch branch = new Branch();
branch.setTenantId(initializeBranchModel.getTenantId());
branch.setTenantCode(initializeBranchModel.getTenantCode());
String code = SerialNumberGenerator.nextSerialNumber(4, sequenceMapper.nextValue(initializeBranchModel.getTenantCode() + "_branch_count"));
branch.setCode(code);
branch.setName(initializeBranchModel.getName());
branch.setType(initializeBranchModel.getType());
branch.setStatus(initializeBranchModel.getStatus());
branch.setProvinceCode(initializeBranchModel.getProvinceCode());
branch.setProvinceName(initializeBranchModel.getProvinceName());
branch.setCityCode(initializeBranchModel.getCityCode());
branch.setCityName(initializeBranchModel.getCityName());
branch.setDistrictCode(initializeBranchModel.getDistrictCode());
branch.setDistrictName(initializeBranchModel.getDistrictName());
branch.setAddress(initializeBranchModel.getAddress());
branch.setLongitude(initializeBranchModel.getLongitude());
branch.setLatitude(initializeBranchModel.getLatitude());
branch.setLinkman(initializeBranchModel.getLinkman());
branch.setContactPhone(initializeBranchModel.getContactPhone());
branch.setElemeAccountType(Constants.ELEME_ACCOUNT_TYPE_CHAIN_ACCOUNT);
branch.setShopId(null);
branch.setSmartRestaurantStatus(initializeBranchModel.getSmartRestaurantStatus());
branch.setAppAuthToken(null);
branch.setPoiId(null);
branch.setPoiName(null);
BigInteger userId = initializeBranchModel.getUserId();
branch.setCreateUserId(userId);
branch.setLastUpdateUserId(userId);
branchMapper.insert(branch);
branchMapper.insertMergeUserBranch(userId, initializeBranchModel.getTenantId(), branch.getId());
ApiRest apiRest = new ApiRest();
apiRest.setData(branch);
apiRest.setClassName(Branch.class.getName());
apiRest.setMessage("初始化门店成功!");
apiRest.setSuccessful(true);
return apiRest;
}
use of build.dream.common.erp.catering.domains.Branch in project erp-catering by liuyandong33.
the class BranchService method obtainBranchInfo.
/**
* 获取门店信息
*
* @param obtainBranchInfoModel
* @return
*/
@Transactional(readOnly = true)
public ApiRest obtainBranchInfo(ObtainBranchInfoModel obtainBranchInfoModel) {
BigInteger tenantId = obtainBranchInfoModel.getTenantId();
BigInteger userId = obtainBranchInfoModel.getUserId();
Branch branch = branchMapper.findByTenantIdAndUserId(tenantId, userId);
Validate.notNull(branch, "门店不存在!");
ApiRest apiRest = new ApiRest();
apiRest.setData(branch);
apiRest.setClassName(Branch.class.getName());
apiRest.setMessage("获取门店信息成功!");
apiRest.setSuccessful(true);
return apiRest;
}
use of build.dream.common.erp.catering.domains.Branch 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);
}
use of build.dream.common.erp.catering.domains.Branch in project erp-catering by liuyandong33.
the class ElemeController method getShopCategories.
@RequestMapping(value = "/getShopCategories")
@ResponseBody
public String getShopCategories() {
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(BigInteger.valueOf(Long.valueOf(tenantId)), BigInteger.valueOf(Long.valueOf(branchId)));
Map<String, Object> params = new HashMap<String, Object>();
params.put("shopId", branch.getShopId());
apiRest = ElemeUtils.callElemeSystem(tenantId.toString(), branchId.toString(), branch.getElemeAccountType(), "eleme.product.category.getShopCategories", params);
} catch (Exception e) {
LogUtils.error("查询店铺商品分类失败", controllerSimpleName, "getShopCategories", 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 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);
}
Aggregations