package com.yihu.hos.rest.controllers;


import com.yihu.hos.rest.services.crawler.DatapushService;
import com.yihu.hos.web.framework.model.Result;
import com.yihu.hos.web.framework.util.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 数据采集配置页面
 * Created by hzp on 2015/8/12.
 */
@RequestMapping("/crawler")
@Controller("dataPushController")
public class DataPushController extends BaseController {

    @Autowired
    DatapushService datapushService;

    /**************************** 推送数据 ************************************************/
    /*
    全流程推数据
     */
    @RequestMapping("datapush")
    @ResponseBody
    public Result datapush(String dataset,String data,String orgCode) {
        try {
            return datapushService.pushData(dataset, data,orgCode);
        }
        catch (Exception ex)
        {
            return Result.error(ex.getMessage());
        }
    }
}
