package com.project.zcustom.controller.service;

import com.project.common.core.controller.BaseController;
import com.project.common.core.domain.AjaxResult;
import com.project.zcustom.domain.smart.PlatGreenSmart;
import com.project.zcustom.service.service.smart.*;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 绿智食堂Controller
 *
 * @author change
 * @date 2024-10-21
 */
@RestController
@RequestMapping("/large/smart")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class PlatGreenSmartController extends BaseController {

    private final IPlatGreenSmartService platGreenSmartService;
    private final IPlatGreenSmartOtherService iPlatGreenSmartOtherService;
    private final IPlatGreenSmartRankService iPlatGreenSmartRankService;
    private final IPlatGreenSmartSafetyService iPlatGreenSmartSafetyService;
    private final IPlatGreenFoodsService iPlatGreenFoodsService;


    /**
     *  食堂概览
     * @param appOrg
     * @return
     */
    @RequestMapping("/getCanteenData")
    public AjaxResult getCanteenData(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", platGreenSmartService.getCanteenData(appOrg));
    }


    /**
     * 食堂安全管理
     * @param appOrg
     * @return
     */
    @RequestMapping("/getSafetyData")
    public AjaxResult getSafetyData(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatGreenSmartSafetyService.getSafetyData(appOrg));
    }


    /**
     *  下拉 公司食堂名称
     * @param appOrg
     * @return
     */
    @RequestMapping("/getCanteenNameList")
    public AjaxResult getCanteenNameList(@RequestParam String appOrg) {
        List<PlatGreenSmart> smartList = platGreenSmartService.getgreenSmartName(appOrg);
        return AjaxResult.success("查询成功", smartList);
    }


    @RequestMapping("/getCanteenScoreData")
    public AjaxResult getCanteenScoreData(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", platGreenSmartService.getCanteenScoreData(appOrg));
    }

//
//    @RequestMapping("/getPowerData")
//    public AjaxResult getPowerData(@RequestParam String appOrg) {
//        return AjaxResult.success("查询成功", iPlatGreenSmartEnergyService.getPowerData(appOrg));
//    }

//

    /**
     * 热销菜品排行
     * @param appOrg
     * @return
     */
    @RequestMapping("/getFoodRankData")
    public AjaxResult getFoodRankData(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatGreenSmartRankService.getRankData(appOrg));
    }

    /**
     * 食堂服务人员情况接口
     * @param appOrg
     * @return
     */
    @RequestMapping("/getCanteenStaff")
    public AjaxResult getCanteenStaff(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", platGreenSmartService.getCanteenStaff(appOrg));
    }

    /**
     * 食堂满意度排名
     * @param appOrg
     * @return
     */
    @RequestMapping("/getCanteenDegreeData")
    public AjaxResult getCanteenDegreeData(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", platGreenSmartService.getCanteenDegreeData(appOrg));
    }

//
//    @RequestMapping("/getCanteenTotalRank")
//    public AjaxResult getCanteenTotalRank(@RequestParam String appOrg) {
//        return AjaxResult.success("查询成功", platGreenSmartService.getCanteenTotalRank(appOrg));
//    }


    @RequestMapping("/geParticipateData")
    public AjaxResult geParticipateData(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatGreenSmartOtherService.geParticipateData(appOrg));
    }


    @RequestMapping("/getDiningPieData")
    public AjaxResult getDiningPieData(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatGreenSmartOtherService.getDiningPieData(appOrg));
    }


    /**
     *  食堂健康许可证数量
     * @param appOrg
     * @param canteenName
     * @return
     */
    @RequestMapping("/getQualificationData")
    public AjaxResult getLicenceData(@RequestParam String appOrg,@RequestParam String canteenName) {
        return AjaxResult.success("查询成功", platGreenSmartService.getQualificationData(appOrg, canteenName));
    }


    @RequestMapping("/getSmartCanteenPieData")
    public AjaxResult getSmartCanteenPieData(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatGreenSmartOtherService.getSmartCanteenPieData(appOrg));
    }


    @RequestMapping("/getEmployeePieData")
    public AjaxResult getEmployeePieData(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatGreenSmartOtherService.getEmployeePieData(appOrg));
    }


    @RequestMapping("/getFoodData")
    public AjaxResult getFoodData(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatGreenSmartOtherService.getFoodData(appOrg));
    }

    /**
     * 获取其他数据信息
     * @param appOrg
     * @return
     */
    @RequestMapping("/getOtherData")
    public AjaxResult getOtherData(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatGreenSmartOtherService.getOtherData(appOrg));
    }

    /**
     * 电子餐券
     * @param appOrg
     * @return
     */
    @RequestMapping("/getElectronicVouchersData")
    public AjaxResult getElectronicVouchersData(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatGreenSmartOtherService.getElectronicVouchersData(appOrg));
    }


    @RequestMapping("/getFoodsList")
    public AjaxResult getFoodsList(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatGreenFoodsService.getPlatGreenFoodsByField("app_org",appOrg));
    }


    /**
     * 单位菜品种类数量
     * @param appOrg
     */
    @RequestMapping("/getFoodsTypeNum")
    public AjaxResult getFoodsTypeNum(@RequestParam String appOrg) {
        return AjaxResult.success("查询成功", iPlatGreenFoodsService.getFoodsTypeNum(appOrg));
    }

}
