/*
 * Author: wangjian
 * 生成ServiceImpl
 */
package com.tofly.watermeter.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tofly.watermeter.custom.entity.quality.QualityStatis;
import com.tofly.watermeter.entity.Gjgl;
import com.tofly.watermeter.entity.Gjglxq;
import com.tofly.watermeter.mapper.GjglMapper;
import com.tofly.watermeter.service.GjglService;
import com.tofly.watermeter.service.GjglxqService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * 归集管理表
 *
 * @author wangjieliu
 * @date Wed Mar 09 00:00:00 CST 2022
 */
@Service("gjglService")
public class GjglServiceImpl extends ServiceImpl<GjglMapper, Gjgl> implements GjglService {
    @Autowired
    private GjglxqService gjglxqService;

    /**
     * 这个功能很不对劲，归集里面存在卡表、机械表类型的抄表用户，而卡表走本系统抄表的水量，机械表走森鑫炬数据表的抄表水量，并且本月的机械表数据又走本系统抄表的水量，这不好做啊
     * 这个功能反馈过，但是给我打哈哈，先做嘛先做
     * @param page
     * @param qualityStatis
     * @param response
     * @return
     */
    @Override
    public IPage<Map> collectAnalyzeOne(Page<Gjgl> page, QualityStatis qualityStatis, HttpServletResponse response) {
        String collectionType = qualityStatis.getCollectionType();
//        //查询对应的归集
//        IPage<Gjgl> gjglIPage = this.page(page, Wrappers.<Gjgl>lambdaQuery().eq(StringUtil.isNotEmpty(collectionType) , Gjgl::getCollectionType , collectionType));
//        if (gjglIPage.getRecords().size() > 0){
//            List<Gjgl> gjglList = gjglIPage.getRecords();
//        }


        String inputcontent = qualityStatis.getInputcontent();
        String startDate = qualityStatis.getStartDate();
        String endDate = qualityStatis.getEndDate();
        return baseMapper.collectAnalyzeOne(page , inputcontent , collectionType , startDate , endDate);
    }

    @Override
    public List<Map> collectAnalyzeTwo(String startDate, String endDate, String collectionNumber, HttpServletResponse response) {
        return baseMapper.collectAnalyzeTwo(startDate , endDate , collectionNumber);
    }

    @Override
    public IPage<Map> collectAnalyzeThree(Page<Gjglxq> page, String startDate, String endDate, String collectionNumber, HttpServletResponse response) {
        return baseMapper.collectAnalyzeThree(page , startDate , endDate , collectionNumber);
    }
}
