package cn.com.countrygarden.bi.main.service.performance.impl.indicators;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;

import com.github.pagehelper.PageHelper;

import cn.com.countrygarden.bi.main.model.performance.PerformanceArea;
import cn.com.countrygarden.bi.main.model.performance.dto.PerformanceShowDataDto;
import cn.com.countrygarden.bi.main.service.performance.indicators.AbstractIndicatorService;

/**
 * 凤凰会业务实现类
 */
@Service
public class FenghuanghuiServiceImpl<T> extends AbstractIndicatorService<T> {


    @Override
    @Transactional
    public void uploadData(long elementId, int year, int quarter, MultipartFile mf, String OperatorId) {

        CommonsMultipartFile commonsMultipartFile = (CommonsMultipartFile)mf;
        String fileName = commonsMultipartFile.getOriginalFilename();
        if(!fileName.contains("凤凰会活跃度")){
            throw new IllegalArgumentException("文件名不正确!");
        }

        try {
            //保存数据
        	ea.fenghuanghuiUpload(1021L, mf, year, quarter, OperatorId);
        	//保存平均分和总分
            this.performanceRecordService.saveQuartlyAverageScoreAndSumScore(year, quarter);
        } catch (Exception e) {
            throw e;
        }
    }

	@Override
	public Object showData(long elementId, int year, int quarter, int pageCurr, int pageSize, String typeNo) {
		
		return null;
	}

	@Override
	public Object saveData(long elementId, int year, int quarter, List<Object> values) {
		return null;
	}

	@Override
	public Object selectAuthority(long elementId, Map<String, Object> requestMap, HttpServletRequest request) {
		return this.performancePower.getUserPower(String.valueOf(elementId),requestMap,request);
	}


}
