Search in sources :

Example 66 with ApiRest

use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.

the class ElemeService method setDeliveryTime.

/**
 * 设置送达时间
 *
 * @param setDeliveryTimeModel
 * @return
 * @throws IOException
 */
public ApiRest setDeliveryTime(SetDeliveryTimeModel setDeliveryTimeModel) throws IOException {
    BigInteger tenantId = setDeliveryTimeModel.getTenantId();
    BigInteger branchId = setDeliveryTimeModel.getBranchId();
    Branch branch = findBranch(tenantId, branchId);
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("shopId", branch.getShopId());
    params.put("deliveryBasicMins", setDeliveryTimeModel.getDeliveryBasicMins());
    params.put("deliveryAdjustMins", setDeliveryTimeModel.getDeliveryAdjustMins());
    ApiRest callElemeSystemApiRest = ElemeUtils.callElemeSystem(tenantId.toString(), branchId.toString(), branch.getElemeAccountType(), "eleme.shop.setDeliveryTime", params);
    Validate.isTrue(callElemeSystemApiRest.isSuccessful(), callElemeSystemApiRest.getError());
    return new ApiRest(callElemeSystemApiRest.getData(), "设置送达时间成功!");
}
Also used : HashMap(java.util.HashMap) BigInteger(java.math.BigInteger) JSONObject(net.sf.json.JSONObject) ApiRest(build.dream.common.api.ApiRest)

Example 67 with ApiRest

use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.

the class ElemeService method batchGetRefundOrders.

/**
 * 批量获取订单退款信息
 *
 * @param batchGetRefundOrdersModel
 * @return
 * @throws IOException
 */
public ApiRest batchGetRefundOrders(BatchGetRefundOrdersModel batchGetRefundOrdersModel) throws IOException {
    BigInteger tenantId = batchGetRefundOrdersModel.getTenantId();
    BigInteger branchId = batchGetRefundOrdersModel.getBranchId();
    Branch branch = findBranch(tenantId, branchId);
    List<ElemeOrder> elemeOrders = findAllElemeOrders(tenantId, branchId, batchGetRefundOrdersModel.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.mgetRefundOrders", params);
    Validate.isTrue(callElemeSystemApiRest.isSuccessful(), callElemeSystemApiRest.getError());
    return new ApiRest(callElemeSystemApiRest.getData(), "批量获取订单退款信息成功!");
}
Also used : HashMap(java.util.HashMap) BigInteger(java.math.BigInteger) JSONObject(net.sf.json.JSONObject) ApiRest(build.dream.common.api.ApiRest)

Example 68 with ApiRest

use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.

the class ElemeService method callDelivery.

/**
 * 呼叫配送
 *
 * @param callDeliveryModel
 * @return
 * @throws IOException
 */
public ApiRest callDelivery(CallDeliveryModel callDeliveryModel) throws IOException {
    BigInteger tenantId = callDeliveryModel.getTenantId();
    BigInteger branchId = callDeliveryModel.getBranchId();
    BigInteger elemeOrderId = callDeliveryModel.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());
    ApplicationHandler.ifNotNullPut(params, "fee", callDeliveryModel.getFee());
    ApiRest callElemeSystemApiRest = ElemeUtils.callElemeSystem(tenantId.toString(), branchId.toString(), branch.getElemeAccountType(), "eleme.order.callDelivery", params);
    Validate.isTrue(callElemeSystemApiRest.isSuccessful(), callElemeSystemApiRest.getError());
    return new ApiRest(callElemeSystemApiRest.getData(), "呼叫配送成功!");
}
Also used : HashMap(java.util.HashMap) BigInteger(java.math.BigInteger) JSONObject(net.sf.json.JSONObject) ApiRest(build.dream.common.api.ApiRest)

Example 69 with ApiRest

use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.

the class ElemeService method querySupportedCompensationOrders.

/**
 * 批量查询订单是否支持索赔
 *
 * @param querySupportedCompensationOrdersModel
 * @return
 * @throws IOException
 */
public ApiRest querySupportedCompensationOrders(QuerySupportedCompensationOrdersModel querySupportedCompensationOrdersModel) throws IOException {
    BigInteger tenantId = querySupportedCompensationOrdersModel.getTenantId();
    BigInteger branchId = querySupportedCompensationOrdersModel.getBranchId();
    Branch branch = findBranch(tenantId, branchId);
    List<ElemeOrder> elemeOrders = findAllElemeOrders(tenantId, branchId, querySupportedCompensationOrdersModel.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.querySupportedCompensationOrders", params);
    Validate.isTrue(callElemeSystemApiRest.isSuccessful(), callElemeSystemApiRest.getError());
    return new ApiRest(callElemeSystemApiRest.getData(), "批量查询订单是否支持索赔成功!");
}
Also used : HashMap(java.util.HashMap) BigInteger(java.math.BigInteger) JSONObject(net.sf.json.JSONObject) ApiRest(build.dream.common.api.ApiRest)

Example 70 with ApiRest

use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.

the class ElemeService method getDeliveryFeeForCrowd.

/**
 * 众包订单询价,获取配送费
 *
 * @param getDeliveryFeeForCrowdModel
 * @return
 * @throws IOException
 */
public ApiRest getDeliveryFeeForCrowd(GetDeliveryFeeForCrowdModel getDeliveryFeeForCrowdModel) throws IOException {
    BigInteger tenantId = getDeliveryFeeForCrowdModel.getTenantId();
    BigInteger branchId = getDeliveryFeeForCrowdModel.getBranchId();
    Branch branch = findBranch(tenantId, branchId);
    ElemeOrder elemeOrder = findElemeOrder(tenantId, branchId, getDeliveryFeeForCrowdModel.getElemeOrderId());
    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.getDeliveryFeeForCrowd", params);
    Validate.isTrue(callElemeSystemApiRest.isSuccessful(), callElemeSystemApiRest.getError());
    return new ApiRest(callElemeSystemApiRest.getData(), "众包订单询价,获取配送费成功!");
}
Also used : HashMap(java.util.HashMap) BigInteger(java.math.BigInteger) JSONObject(net.sf.json.JSONObject) ApiRest(build.dream.common.api.ApiRest)

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