package com.huimv.getdata.controller;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.huimv.getdata.entity.center.CaiGouJinE;
import com.huimv.getdata.entity.center.DangQianYvQi;
import com.huimv.getdata.entity.center.XiaoShouE;
import com.huimv.getdata.entity.center.YangMaoZhiCaiGouJinE;
import com.huimv.getdata.entity.voucher.LinJinHuanKuanQi;
import com.huimv.getdata.service.IErpCenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/weight")
public class CenterController {
    private final JdbcTemplate jdbcTemplate;
    @Autowired
    private IErpCenterService centerService;

    @Autowired
    public CenterController(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }
    @RequestMapping(value = "/getWeightTest",method = RequestMethod.GET)
    public List<Map<String, Object>> getWeightTest(@RequestParam(value = "date" ,required = false) String date){
        String sql = "SELECT * FROM Employees ";
        return jdbcTemplate.queryForList(sql);
//        return centerService.getWeightTest(date);
    }

    @RequestMapping(value = "/getXiaoShouE",method = RequestMethod.GET)
    public List<XiaoShouE> getXiaoShouE(@RequestParam(value = "date" ,required = false) String date){
        return centerService.getXiaoShouE(date);
    }

    @RequestMapping(value = "/getDangQianYvQi",method = RequestMethod.GET)
    public List<DangQianYvQi> getDangQianYvQi(@RequestParam(value = "date" ,required = false) String date){
        return centerService.getDangQianYvQi(date);
    }

    @RequestMapping(value = "/getCaiGouJinE",method = RequestMethod.GET)
    public List<CaiGouJinE> getCaiGouJinE(@RequestParam(value = "date" ,required = false) String date){
        return centerService.getCaiGouJinE(date);
    }

    @RequestMapping(value = "/getYangMaoZhiCaiGouJinE",method = RequestMethod.GET)
    public List<YangMaoZhiCaiGouJinE> getYangMaoZhiCaiGouJinE(@RequestParam(value = "date" ,required = false) String date){
        return centerService.getYangMaoZhiCaiGouJinE(date);
    }
}
