package com.th.demo.controller.home;

import com.th.demo.model.system.ResponseCodeMsg;
import com.th.demo.model.system.Type;
import com.th.demo.service.home.HomeService;
import com.th.demo.service.ware.ChangeService;
import com.th.demo.service.ware.CombineService;
import com.th.demo.service.ware.StoreService;
import com.th.demo.tools.JSONTools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping(value = "/Home")
public class HomeController {
    @Autowired
    public HomeService homeService;
    String result = Type.FAIL;

    @RequestMapping(value = "/querydrawLine1.do")//查询方法 前两个参数是分页参数
    public String querydrawLine1(
            HttpServletRequest request) {

        try {
            String userId = (String) request.getAttribute("userId");
            String belongId = (String) request.getAttribute("belongId");
            result = homeService.querydrawLine1( userId, belongId);
        } catch (Exception ex) {
            ex.printStackTrace();
            result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());
        } finally {
            return result;
        }
    }

    @RequestMapping(value = "/querydrawLine2.do")//查询方法 前两个参数是分页参数
    public String querydrawLine2(
            HttpServletRequest request) {

        try {
            String userId = (String) request.getAttribute("userId");
            String belongId = (String) request.getAttribute("belongId");
            result = homeService.querydrawLine2( userId, belongId);
        } catch (Exception ex) {
            ex.printStackTrace();
            result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());
        } finally {
            return result;
        }
    }
    @RequestMapping(value = "/querydrawLine3.do")//查询方法 前两个参数是分页参数
    public String querydrawLine3(
            HttpServletRequest request) {

        try {
            String userId = (String) request.getAttribute("userId");
            String belongId = (String) request.getAttribute("belongId");
            result = homeService.querydrawLine3( userId, belongId);
        } catch (Exception ex) {
            ex.printStackTrace();
            result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());
        } finally {
            return result;
        }
    }
    @RequestMapping(value = "/querydrawLine4.do")//查询方法 前两个参数是分页参数
    public String querydrawLine4(
            HttpServletRequest request) {

        try {
            String userId = (String) request.getAttribute("userId");
            String belongId = (String) request.getAttribute("belongId");
            result = homeService.querydrawLine4( userId, belongId);
        } catch (Exception ex) {
            ex.printStackTrace();
            result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());
        } finally {
            return result;
        }
    }
}
