package com.ruoyi.system.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import com.ruoyi.system.service.ZsStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@Validated
@RestController
@RequestMapping("/system/statistics")
public class ZsStatisticsController {
    @Autowired
    private ZsStatisticsService zsStatisticsService;

    /**
     * 查询产品信息
     * @param request
     * @param websiteCode  网站编码
     * @return
     */
    @SaIgnore
    @GetMapping("/productInfo")
    public List<Map> query1(HttpServletRequest request, @RequestParam("website_code") String websiteCode) {
        //获取语言
        String languageCode = request.getHeader("language_code");
        return zsStatisticsService.getProductJson(websiteCode,languageCode);
    }

    @SaIgnore
    @GetMapping("/productCategoryInfo")
    public List<Map> getProductCategoryJson(HttpServletRequest request, @RequestParam("website_code") String websiteCode) {
        //获取语言
        String languageCode = request.getHeader("language_code");
        return zsStatisticsService.getProductCategoryJson(websiteCode,languageCode);
    }
    @SaIgnore
    @GetMapping("/productPurposeInfo")
    public List<Map> getProductPurposeJson(HttpServletRequest request, @RequestParam("website_code") String websiteCode) {
        //获取语言
        String languageCode = request.getHeader("language_code");
        return zsStatisticsService.getProductPurposeJson(websiteCode,languageCode);
    }
    @SaIgnore
    @GetMapping("/productDetailInfo")
    public List<Map> getProductDetailJson(HttpServletRequest request, @RequestParam("website_code") String websiteCode) {
        //获取语言
        String languageCode = request.getHeader("language_code");
        return zsStatisticsService.getProductDetailJson(websiteCode,languageCode);
    }
    @SaIgnore
    @GetMapping("/fAQInfo")
    public List<Map> getFAQJson(HttpServletRequest request, @RequestParam("website_code") String websiteCode) {
        //获取语言
        String languageCode = request.getHeader("language_code");
        return zsStatisticsService.getFAQJson(websiteCode,languageCode);
    }

}

