use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.
the class MeiTuanController method checkIsBinding.
/**
* 查询门店是否绑定美团
*
* @return
*/
@RequestMapping(value = "/checkIsBinding")
@ResponseBody
public String checkIsBinding() {
ApiRest apiRest = null;
Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
try {
CheckIsBindingModel checkIsBindingModel = ApplicationHandler.instantiateObject(CheckIsBindingModel.class, requestParameters);
checkIsBindingModel.validateAndThrow();
apiRest = meiTuanService.checkIsBinding(checkIsBindingModel);
} catch (Exception e) {
LogUtils.error("查询门店是否绑定美团失败!", controllerSimpleName, "checkIsBinding", e, requestParameters);
apiRest = new ApiRest(e);
}
return GsonUtils.toJson(apiRest);
}
use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.
the class MeiTuanController method obtainMeiTuanOrder.
/**
* 拉取美团订单
*
* @return
*/
@RequestMapping(value = "/obtainMeiTuanOrder")
@ResponseBody
public String obtainMeiTuanOrder() {
ApiRest apiRest = null;
Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
try {
ObtainMeiTuanOrderModel obtainMeiTuanOrderModel = ApplicationHandler.instantiateObject(ObtainMeiTuanOrderModel.class, requestParameters);
obtainMeiTuanOrderModel.validateAndThrow();
apiRest = meiTuanService.obtainMeiTuanOrder(obtainMeiTuanOrderModel);
} catch (Exception e) {
LogUtils.error("拉取美团订单失败!", controllerSimpleName, "pullMeiTuanOrder", e, requestParameters);
apiRest = new ApiRest(e);
}
return GsonUtils.toJson(apiRest);
}
use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.
the class MiniProgramController method obtainSessionWithJsCode.
@RequestMapping(value = "/obtainSessionWithJsCode")
@ResponseBody
public String obtainSessionWithJsCode() {
ApiRest apiRest = null;
Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
try {
ObtainSessionWithJsCodeModel obtainSessionWithJsCodeModel = ApplicationHandler.instantiateObject(ObtainSessionWithJsCodeModel.class, requestParameters);
obtainSessionWithJsCodeModel.validateAndThrow();
Map<String, String> obtainSessionRequestParameters = new HashMap<String, String>();
obtainSessionRequestParameters.put("appid", "wxc375e036b110a28f");
obtainSessionRequestParameters.put("secret", "415627f3ec7bf51497a98e94546affa7");
obtainSessionRequestParameters.put("js_code", obtainSessionWithJsCodeModel.getCode());
obtainSessionRequestParameters.put("grant_type", "authorization_code");
String obtainSessionResult = WebUtils.doGetWithRequestParameters("https://api.weixin.qq.com/sns/jscode2session", obtainSessionRequestParameters);
JSONObject obtainSessionResultJsonObject = JSONObject.fromObject(obtainSessionResult);
Validate.isTrue(!obtainSessionResultJsonObject.has("errcode"), obtainSessionResultJsonObject.optString("errmsg"));
apiRest = new ApiRest();
apiRest.setData(obtainSessionResultJsonObject);
apiRest.setMessage("处理成功!");
apiRest.setSuccessful(true);
} catch (Exception e) {
LogUtils.error("code换取session_key失败", controllerSimpleName, "obtainSessionWithJsCode", e, requestParameters);
apiRest = new ApiRest(e);
}
return GsonUtils.toJson(apiRest);
}
use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.
the class ActivityController method saveBuyGiveActivity.
/**
* 保存买A赠B活动
*
* @return
*/
@RequestMapping(value = "/saveBuyGiveActivity")
@ResponseBody
public String saveBuyGiveActivity() {
ApiRest apiRest = null;
Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
try {
SaveBuyGiveActivityModel saveBuyGiveActivityModel = ApplicationHandler.instantiateObject(SaveBuyGiveActivityModel.class, requestParameters);
String buyGiveActivityInfos = requestParameters.get("buyGiveActivityInfos");
saveBuyGiveActivityModel.setBuyGiveActivityInfos(buyGiveActivityInfos);
saveBuyGiveActivityModel.validateAndThrow();
apiRest = activityService.saveBuyGiveActivity(saveBuyGiveActivityModel);
} catch (Exception e) {
LogUtils.error("保存买A赠B活动失败", controllerSimpleName, "saveBuyGiveActivity", e, requestParameters);
apiRest = new ApiRest(e);
}
return GsonUtils.toJson(apiRest);
}
use of build.dream.common.api.ApiRest in project erp-catering by liuyandong33.
the class AnubisController method chainStoreQuery.
/**
* 查询门店信息
*
* @return
*/
@RequestMapping(value = "/chainStoreQuery")
@ResponseBody
public String chainStoreQuery() {
ApiRest apiRest = null;
Map<String, String> requestParameters = ApplicationHandler.getRequestParameters();
try {
List<String> chainStoreCodes = new ArrayList<String>();
chainStoreCodes.add("A001");
chainStoreCodes.add("A002");
Map<String, Object> data = new HashMap<String, Object>();
data.put("chain_store_code", chainStoreCodes);
String url = ConfigurationUtils.getConfiguration(Constants.ANUBIS_SERVICE_URL) + Constants.ANUBIS_CHAIN_STORE_QUERY_URI;
String appId = ConfigurationUtils.getConfiguration(Constants.ANUBIS_APP_ID);
apiRest = AnubisUtils.callAnubisSystem(url, appId, data);
} catch (Exception e) {
LogUtils.error("查询门店信息失败", controllerSimpleName, "chainStoreQuery", e, requestParameters);
apiRest = new ApiRest(e);
}
return GsonUtils.toJson(apiRest);
}
Aggregations