Search in sources :

Example 6 with ApiRest

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

the class ElemeController method setOrderPackingFee.

/**
 * 设置订单餐盒费
 *
 * @return
 */
@RequestMapping(value = "/setOrderPackingFee")
@ResponseBody
public String setOrderPackingFee() {
    ApiRest apiRest = null;
    Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
    try {
        SetOrderPackingFeeModel setOrderPackingFeeModel = ApplicationHandler.instantiateObject(SetOrderPackingFeeModel.class, requestParameters);
        setOrderPackingFeeModel.validateAndThrow();
        Branch branch = elemeService.findBranch(setOrderPackingFeeModel.getTenantId(), setOrderPackingFeeModel.getBranchId());
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("shopId", branch.getShopId());
        params.put("status", setOrderPackingFeeModel.getStatus());
        ApplicationHandler.ifNotNullPut(params, "packingFee", setOrderPackingFeeModel.getPackingFee());
        ApiRest callElemeSystemApiRest = ElemeUtils.callElemeSystem(setOrderPackingFeeModel.getTenantId().toString(), setOrderPackingFeeModel.getBranchId().toString(), branch.getElemeAccountType(), "eleme.product.item.setOrderPackingFee", params);
        Validate.isTrue(callElemeSystemApiRest.isSuccessful(), callElemeSystemApiRest.getError());
        apiRest = new ApiRest();
        apiRest.setMessage("设置订单餐盒费成功!");
        apiRest.setSuccessful(true);
    } catch (Exception e) {
        LogUtils.error("设置订单餐盒费失败", controllerSimpleName, "setOrderPackingFee", e, requestParameters);
        apiRest = new ApiRest(e);
    }
    return GsonUtils.toJson(apiRest);
}
Also used : HashMap(java.util.HashMap) Branch(build.dream.common.erp.catering.domains.Branch) 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 7 with ApiRest

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

the class ElemeController method getDeliveryStateRecord.

/**
 * 获取订单配送记录
 *
 * @return
 */
@RequestMapping(value = "/getDeliveryStateRecord")
@ResponseBody
public String getDeliveryStateRecord() {
    ApiRest apiRest = null;
    Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
    try {
        GetDeliveryStateRecordModel getDeliveryStateRecordModel = ApplicationHandler.instantiateObject(GetDeliveryStateRecordModel.class, requestParameters);
        getDeliveryStateRecordModel.validateAndThrow();
        apiRest = elemeService.getDeliveryStateRecord(getDeliveryStateRecordModel);
    } catch (Exception e) {
        LogUtils.error("获取订单配送记录失败", controllerSimpleName, "getDeliveryStateRecord", e, requestParameters);
        apiRest = new ApiRest(e);
    }
    return GsonUtils.toJson(apiRest);
}
Also used : 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 8 with ApiRest

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

the class ElemeController method batchGetShopStatus.

/**
 * 查询店铺信息
 *
 * @return
 */
@RequestMapping(value = "batchGetShopStatus")
@ResponseBody
public String batchGetShopStatus() {
    ApiRest apiRest = null;
    Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
    try {
        BatchGetShopStatusModel batchGetShopStatusModel = ApplicationHandler.instantiateObject(BatchGetShopStatusModel.class, requestParameters);
        batchGetShopStatusModel.validateAndThrow();
        apiRest = elemeService.batchGetShopStatus(batchGetShopStatusModel);
    } catch (Exception e) {
        LogUtils.error("批量获取店铺简要失败", controllerSimpleName, "batchGetShopStatus", e, requestParameters);
        apiRest = new ApiRest(e);
    }
    return GsonUtils.toJson(apiRest);
}
Also used : 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 9 with ApiRest

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

the class ElemeController method replyReminder.

/**
 * 回复催单
 *
 * @return
 */
@RequestMapping(value = "/replyReminder")
@ResponseBody
public String replyReminder() {
    ApiRest apiRest = null;
    Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
    try {
        ReplyReminderModel replyReminderModel = ApplicationHandler.instantiateObject(ReplyReminderModel.class, requestParameters);
        replyReminderModel.validateAndThrow();
        apiRest = elemeService.replyReminder(replyReminderModel);
    } catch (Exception e) {
        LogUtils.error("回复催单失败", controllerSimpleName, "replyReminder", e, requestParameters);
        apiRest = new ApiRest(e);
    }
    return GsonUtils.toJson(apiRest);
}
Also used : 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 10 with ApiRest

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

the class ElemeController method setOrderPrepared.

/**
 * 非自配送餐厅标记已出餐
 *
 * @return
 */
@RequestMapping(value = "setOrderPrepared")
@ResponseBody
public String setOrderPrepared() {
    ApiRest apiRest = null;
    Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
    try {
        SetOrderPreparedModel setOrderPreparedModel = ApplicationHandler.instantiateObject(SetOrderPreparedModel.class, requestParameters);
        setOrderPreparedModel.validateAndThrow();
        apiRest = elemeService.setOrderPrepared(setOrderPreparedModel);
    } catch (Exception e) {
        LogUtils.error("非自配送餐厅标记已出餐失败", controllerSimpleName, "setOrderPrepared", e, requestParameters);
        apiRest = new ApiRest(e);
    }
    return GsonUtils.toJson(apiRest);
}
Also used : 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)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