package com.qiankun.controller;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.qiankun.controller.base.BaseController;
import com.qiankun.service.UserService;
 
@Controller
public class WebSiteController extends BaseController<Object>{
 
    @Autowired
    private ApplicationContext applicationContext;
    
    @RequestMapping("/index")
    public ModelAndView index() throws Exception {
        ModelAndView t_view = new ModelAndView();
        t_view.setViewName("index");
        return t_view;
    }
    
    

    @RequestMapping("/result")
    public ModelAndView search(String content) throws Exception {
        final UserService service = applicationContext.getBean(UserService.class);
        ModelAndView t_view = new ModelAndView();
        ObjectMapper mapper = new ObjectMapper();
        JsonNode request = mapper.readTree(content);
		String condition = request.get("condition").asText();
		long interval = request.get("interval").asLong();
		long businessId = request.get("business").asLong();
		long startMs = request.get("start").asLong();
        
        return t_view;
    }
    

}