package com.xueyi.system.common.controller;

import com.alibaba.fastjson2.JSONObject;
import com.xueyi.common.core.web.result.AjaxResult;
import com.xueyi.common.web.entity.controller.BaseController;
import com.xueyi.system.api.holiday.feign.RemoteHolidayService;
import com.xueyi.system.common.domain.dto.DmHolidayDto;
import com.xueyi.system.common.domain.query.DmHolidayQuery;
import com.xueyi.system.common.service.IDmHolidayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/holiday")
public class DmHolidayController extends BaseController<DmHolidayQuery, DmHolidayDto, IDmHolidayService> {


    /** 定义节点名称 */
    @Override
    protected String getNodeName() {
        return "节假日管理 ";
    }

    @Autowired
    RemoteHolidayService holidayService;
    /**
     * 获取今天是否为工作日
     */
    @GetMapping("/api/getTodayIsWorkDay")
    AjaxResult getTodayIsWorkDay() {
        return success(baseService.getTodayHoliday());
    }

    /**
     * 调用外部接口，获取本年度节假日信息
     */
    @GetMapping("/getHolidays")
    AjaxResult getHolidays() {
        JSONObject holidays = holidayService.getHolidays();
        return AjaxResult.success();
    }

}
