package com.whyc.service; import com.whyc.dto.Real.PwrHisRealAcInDto; import com.whyc.dto.Real.PwrHisRealDcoutInDto; import com.whyc.dto.Response; import com.whyc.mapper.CommonMapper; import com.whyc.pojo.db_data_history.BattRealdataId; import com.whyc.pojo.db_data_history.PwrdevHistorydataId; import com.whyc.util.ActionUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Date; import java.util.List; @Service public class PwrdevHistorydataIdService { @Autowired private SubTablePageInfoService subTablePageInfoService; @Resource private CommonMapper commonMapper; //系统概览获取半小时交流输入统计 public Response getHalfHourPwrHisAcinData(Integer powerId,Integer granularity) { String dateTime = ActionUtil.sdfwithOutday.format(new Date()); String tableName ="db_data_history.tb_pwrdev_historydata_"+powerId+"_"+dateTime; String existTableName = commonMapper.existTable("db_data_history", "tb_pwrdev_historydata_"+powerId+"_"+dateTime); if(existTableName == null){ return new Response().set(1,false,"当前电池组不存在前面小时数据"); } List datalist=subTablePageInfoService.getHalfHourPwrHisAcinData(tableName,granularity); return new Response().setII(1,datalist.size()>0,datalist,"获取半小时内交流输入统计"); } //系统概览获取半小时直流输出统计 public Response getHalfHourPwrHisDcoutData(Integer powerId,Integer granularity) { String dateTime = ActionUtil.sdfwithOutday.format(new Date()); String tableName ="db_data_history.tb_pwrdev_historydata_"+powerId+"_"+dateTime; String existTableName = commonMapper.existTable("db_data_history", "tb_pwrdev_historydata_"+powerId+"_"+dateTime); if(existTableName == null){ return new Response().set(1,false,"当前电源不存在前面小时数据"); } List datalist=subTablePageInfoService.getHalfHourPwrHisDcoutData(tableName,granularity); return new Response().setII(1,datalist.size()>0,datalist,"获取半小时内直流输出统计"); } }