package com.yinet.web.controller.wsyy;

import java.util.List;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.yinet.common.annotation.Log;
import com.yinet.common.enums.BusinessType;
import com.yinet.wsyy.domain.WsyySetting;
import com.yinet.wsyy.service.IWsyySettingService;
import com.yinet.common.core.controller.BaseController;
import com.yinet.common.core.domain.AjaxResult;
import com.yinet.common.utils.poi.ExcelUtil;
import com.yinet.common.core.page.TableDataInfo;

/**
 * 网上预约配置Controller
 *
 * @author yinet
 * @date 2019-09-02
 */
@Controller
@RequestMapping("/wsyy/setting")
public class WsyySettingController extends BaseController {
    private String prefix = "wsyy/admin/setting";

    @Autowired
    private IWsyySettingService wsyySettingService;

    @GetMapping()
    public String setting(ModelMap mmap) {
        WsyySetting wsyySetting = wsyySettingService.selectWsyySetting();
        mmap.put("wsyySetting", wsyySetting);
        return prefix + "/setting";
    }

    /**
     * 修改保存网上预约配置
     */
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(WsyySetting wsyySetting) {
        int i = wsyySettingService.updateWsyySetting(wsyySetting);
        return AjaxResult.success();
    }

    /**
     * 修改保存网上预约配置
     */
    @PostMapping("/holiday")
    @ResponseBody
    public AjaxResult holiday() {
        int i = wsyySettingService.updateWsyyHoliday();
        return AjaxResult.success();
    }
}
