package cn.teammodel.controller.admin.service.impl;

import cn.teammodel.controller.admin.service.*;
import cn.teammodel.model.dto.admin.common.FiveDto;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class FiveEducationServiceImpl implements FiveEducationService {

    @Autowired
    private ExamService examService;
    @Autowired
    private LaborEducationService laborEducationService;
    @Autowired
    private MoralEducationService  moralLaborService;
    @Autowired
    private ArtService artService;
    @Override
    public Map<String, Object> getAnalysis(FiveDto dto, HttpServletRequest request) {
        Map<String, Object> integratedResult = new ConcurrentHashMap<>();

        // 1. 处理概况分析
        if (dto.getOverViewDto() != null) {
            integratedResult.put("overView",
                    examService.getAnalysis(dto.getOverViewDto(), request));
        }

        // 2. 处理艺术分析
        if (dto.getArtAnalysisDto() != null) {
            integratedResult.put("artAnalytics",
                    artService.getArtAnalytics(dto.getArtAnalysisDto(), request));
        }

        // 3. 处理德育分析
        if (dto.getLaborDto() != null) {
            integratedResult.put("moralAnalysis",
                    laborEducationService.getAnalysis(dto.getLaborDto(), request));
        }

        // 4. 处理劳育分析
        if (dto.getMoralDto() != null) {
            integratedResult.put("laborAnalysis",
                    moralLaborService.getAnalysis(dto.getMoralDto(), request));
        }

        return integratedResult;

    }
}
