use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.
the class ElemeService method doBindingStore.
@Transactional(rollbackFor = Exception.class)
public ApiRest doBindingStore(DoBindingStoreModel doBindingStoreModel) throws IOException {
BigInteger tenantId = doBindingStoreModel.getTenantId();
BigInteger branchId = doBindingStoreModel.getBranchId();
BigInteger shopId = doBindingStoreModel.getShopId();
BigInteger userId = doBindingStoreModel.getUserId();
String lastUpdateRemark = "门店(" + branchId + ")绑定饿了么(" + shopId + "),清除绑定关系!";
UpdateModel updateModel = new UpdateModel(true);
updateModel.setTableName("branch");
updateModel.addContentValue("shop_id", null);
updateModel.addContentValue("last_update_user_id", userId);
updateModel.addContentValue("last_update_remark", lastUpdateRemark);
updateModel.addSearchCondition("shop_id", Constants.SQL_OPERATION_SYMBOL_EQUALS, shopId);
universalMapper.universalUpdate(updateModel);
SearchModel searchModel = new SearchModel(true);
searchModel.addSearchCondition("id", Constants.SQL_OPERATION_SYMBOL_EQUALS, branchId);
searchModel.addSearchCondition("tenant_id", Constants.SQL_OPERATION_SYMBOL_EQUALS, tenantId);
Branch branch = branchMapper.find(searchModel);
Validate.notNull(branch, "门店不存在!");
branch.setShopId(doBindingStoreModel.getShopId());
branchMapper.update(branch);
Map<String, String> saveElemeBranchMappingRequestParameters = new HashMap<String, String>();
saveElemeBranchMappingRequestParameters.put("tenantId", tenantId.toString());
saveElemeBranchMappingRequestParameters.put("branchId", branchId.toString());
saveElemeBranchMappingRequestParameters.put("shopId", shopId.toString());
saveElemeBranchMappingRequestParameters.put("userId", userId.toString());
ApiRest saveElemeBranchMappingApiRest = ProxyUtils.doPostWithRequestParameters(Constants.SERVICE_NAME_OUT, "eleme", "saveElemeBranchMapping", saveElemeBranchMappingRequestParameters);
Validate.isTrue(saveElemeBranchMappingApiRest.isSuccessful(), saveElemeBranchMappingApiRest.getError());
ApiRest apiRest = new ApiRest();
apiRest.setMessage("饿了么门店绑定成功!");
apiRest.setSuccessful(true);
return apiRest;
}
use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.
the class ElemeService method cancelOrderLite.
/**
* 取消订单
*
* @param cancelOrderLiteModel
* @return
* @throws IOException
*/
public ApiRest cancelOrderLite(CancelOrderLiteModel cancelOrderLiteModel) throws IOException {
BigInteger tenantId = cancelOrderLiteModel.getTenantId();
BigInteger branchId = cancelOrderLiteModel.getBranchId();
BigInteger elemeOrderId = cancelOrderLiteModel.getElemeOrderId();
Branch branch = findBranch(tenantId, branchId);
ElemeOrder elemeOrder = findElemeOrder(tenantId, branchId, elemeOrderId);
Map<String, Object> params = new HashMap<String, Object>();
params.put("orderId", elemeOrder.getOrderId());
params.put("type", cancelOrderLiteModel.getType());
ApplicationHandler.ifNotNullPut(params, "remark", cancelOrderLiteModel.getRemark());
ApiRest callElemeSystemApiRest = ElemeUtils.callElemeSystem(tenantId.toString(), branchId.toString(), branch.getElemeAccountType(), "eleme.order.cancelOrderLite", params);
Validate.isTrue(callElemeSystemApiRest.isSuccessful(), callElemeSystemApiRest.getError());
return new ApiRest(callElemeSystemApiRest.getData(), "取消订单成功!");
}
use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.
the class ElemeService method getUser.
/**
* 获取商户账号信息
*
* @param getUserModel
* @return
* @throws IOException
*/
public ApiRest getUser(GetUserModel getUserModel) throws IOException {
BigInteger tenantId = getUserModel.getTenantId();
BigInteger branchId = getUserModel.getBranchId();
Branch branch = findBranch(tenantId, branchId);
ApiRest callElemeSystemApiRest = ElemeUtils.callElemeSystem(tenantId.toString(), branchId.toString(), branch.getElemeAccountType(), "eleme.user.getUser", null);
Validate.isTrue(callElemeSystemApiRest.isSuccessful(), callElemeSystemApiRest.getError());
return new ApiRest(callElemeSystemApiRest.getData(), "获取商户账号信息成功!");
}
use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.
the class ElemeService method queryCompensationOrders.
/**
* 批量查询索赔结果
*
* @param queryCompensationOrdersModel
* @return
* @throws IOException
*/
public ApiRest queryCompensationOrders(QueryCompensationOrdersModel queryCompensationOrdersModel) throws IOException {
BigInteger tenantId = queryCompensationOrdersModel.getTenantId();
BigInteger branchId = queryCompensationOrdersModel.getBranchId();
Branch branch = findBranch(tenantId, branchId);
List<ElemeOrder> elemeOrders = findAllElemeOrders(tenantId, branchId, queryCompensationOrdersModel.getElemeOrderIds());
List<String> orderIds = obtainOrderIds(elemeOrders);
Map<String, Object> params = new HashMap<String, Object>();
params.put("orderIds", orderIds);
ApiRest callElemeSystemApiRest = ElemeUtils.callElemeSystem(tenantId.toString(), branchId.toString(), branch.getElemeAccountType(), "eleme.order.queryCompensationOrders", params);
Validate.isTrue(callElemeSystemApiRest.isSuccessful(), callElemeSystemApiRest.getError());
return new ApiRest(callElemeSystemApiRest.getData(), "批量查询索赔结果成功!");
}
use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.
the class ElemeService method cancelDelivery.
/**
* 取消呼叫配送
*
* @param cancelDeliveryModel
* @return
* @throws IOException
*/
public ApiRest cancelDelivery(CancelDeliveryModel cancelDeliveryModel) throws IOException {
BigInteger tenantId = cancelDeliveryModel.getTenantId();
BigInteger branchId = cancelDeliveryModel.getBranchId();
BigInteger elemeOrderId = cancelDeliveryModel.getElemeOrderId();
Branch branch = findBranch(tenantId, branchId);
ElemeOrder elemeOrder = findElemeOrder(tenantId, branchId, elemeOrderId);
Map<String, Object> params = new HashMap<String, Object>();
params.put("orderId", elemeOrder.getOrderId());
ApiRest callElemeSystemApiRest = ElemeUtils.callElemeSystem(tenantId.toString(), branchId.toString(), branch.getElemeAccountType(), "eleme.order.cancelDelivery", params);
Validate.isTrue(callElemeSystemApiRest.isSuccessful(), callElemeSystemApiRest.getError());
return new ApiRest(callElemeSystemApiRest.getData(), "取消呼叫配送成功!");
}
Aggregations