| | |
| | | import com.whyc.pojo.db_param.AppParam; |
| | | import com.whyc.pojo.db_param.ApptimeParam; |
| | | import com.whyc.pojo.db_param.PowerPropertyParam; |
| | | import com.whyc.pojo.db_param.PowerheartParam; |
| | | import com.whyc.pojo.db_station.PowerInf; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Autowired |
| | | private PowerPropertyParamService propertyParamService; |
| | | |
| | | //系统概览获取半小时交流输入统计 |
| | | public Response getHalfHourPwrHisAcinData(Integer powerId,Integer granularity) { |
| | | @Autowired |
| | | private PowerheartParamService heartService; |
| | | |
| | | //系统概览前N笔交流输入统计 |
| | | public Response getPwrHisAcinData100(Integer powerId) { |
| | | String dateTime = ActionUtil.sdfwithOutday.format(new Date()); |
| | | //获取前半个小时数据 |
| | | //获取前笔数*时间间隔 |
| | | PowerheartParam heartParam=heartService.getHeartParamByPowerId(powerId); |
| | | Integer interverCount=100*10;//默认值 |
| | | Integer granularity=10;//默认值 |
| | | if(heartParam!=null){ |
| | | interverCount=heartParam.getAcinInterverCfg()*heartParam.getAcinCountCfg(); |
| | | granularity=heartParam.getAcinInterverCfg(); |
| | | } |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 计算半小时前的时间点 |
| | | LocalDateTime halfHourAgo = now.minusMinutes(30); |
| | | // 计算笔数*时间间隔的时间点 |
| | | LocalDateTime halfHourAgo = now.minusMinutes(interverCount); |
| | | // 格式化输出 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | String halfHourAgoTime=halfHourAgo.format(formatter); |
| | |
| | | return new Response().setII(1,datalist.size()>0,datalist,"获取半小时内交流输入统计"); |
| | | |
| | | } |
| | | //系统概览获取半小时直流输出统计 |
| | | public Response getHalfHourPwrHisDcoutData(Integer powerId,Integer granularity) { |
| | | //系统概览获取前N笔直流输出统计 |
| | | public Response getHalfHourPwrHisDcoutData(Integer powerId) { |
| | | String dateTime = ActionUtil.sdfwithOutday.format(new Date()); |
| | | //获取前笔数*时间间隔 |
| | | PowerheartParam heartParam=heartService.getHeartParamByPowerId(powerId); |
| | | Integer interverCount=100*10;//默认值 |
| | | Integer granularity=10;//默认值 |
| | | if(heartParam!=null){ |
| | | interverCount=heartParam.getAcinInterverCfg()*heartParam.getAcinCountCfg(); |
| | | granularity=heartParam.getAcinInterverCfg(); |
| | | } |
| | | //获取前半个小时数据 |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 计算半小时前的时间点 |
| | | LocalDateTime halfHourAgo = now.minusMinutes(30); |
| | | LocalDateTime halfHourAgo = now.minusMinutes(interverCount); |
| | | // 格式化输出 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | String halfHourAgoTime=halfHourAgo.format(formatter); |