Commit 1ecfbfd6 authored by co_dengxiongwen's avatar co_dengxiongwen

接口调整

parent 32907b78
......@@ -4,8 +4,10 @@ import org.apache.ibatis.annotations.Mapper;
import com.devplatform.admin.modules.eq.model.TotalDayModel;
import com.devplatform.admin.modules.eq.bean.TotalDay;
import com.devplatform.common.dao.MyBaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* TotalDay Mapper
......@@ -30,5 +32,5 @@ public interface TotalDayDao extends MyBaseMapper<TotalDay> {
*/
List<TotalDay> queryPageList(TotalDayModel model);
List<TotalDay> queryList();
List<Map<String,Object>> queryList(@Param("type") Integer type);
}
package com.devplatform.admin.modules.eq.dao;
import org.apache.ibatis.annotations.Mapper;
import com.devplatform.admin.modules.eq.model.TotalHourModel;
import com.devplatform.admin.modules.eq.bean.TotalHour;
import com.devplatform.admin.modules.eq.model.TotalHourModel;
import com.devplatform.common.dao.MyBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* TotalHour Mapper
......@@ -30,5 +31,5 @@ public interface TotalHourDao extends MyBaseMapper<TotalHour> {
*/
List<TotalHour> queryPageList(TotalHourModel model);
List<TotalHour> queryList();
List<Map<String,Object>> queryList(@Param("type")Integer type);
}
......@@ -4,8 +4,10 @@ import org.apache.ibatis.annotations.Mapper;
import com.devplatform.admin.modules.eq.model.TotalMonthModel;
import com.devplatform.admin.modules.eq.bean.TotalMonth;
import com.devplatform.common.dao.MyBaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* TotalMonth Mapper
......@@ -29,4 +31,6 @@ public interface TotalMonthDao extends MyBaseMapper<TotalMonth> {
* @return
*/
List<TotalMonth> queryPageList(TotalMonthModel model);
List<Map<String, Object>> queryList(@Param("type") Integer type);
}
......@@ -6,6 +6,7 @@ import com.devplatform.admin.modules.eq.bean.TotalDay;
import com.devplatform.admin.modules.eq.model.TotalDayModel;
import java.util.List;
import java.util.Map;
/**
* 当月能耗-天的service接口
......@@ -22,5 +23,5 @@ public interface TotalDayService extends MyBaseService<TotalDay> {
*/
List<TotalDay> queryPageList(TotalDayModel model);
List<TotalDay> queryList();
List<Map<String,Object>> queryList(Integer type);
}
package com.devplatform.admin.modules.eq.service;
import com.devplatform.common.service.MyBaseService;
import com.devplatform.admin.modules.eq.bean.TotalHour;
import com.devplatform.admin.modules.eq.model.TotalHourModel;
import com.devplatform.common.service.MyBaseService;
import java.util.List;
import java.util.Map;
/**
* 当天能耗-时的service接口
......@@ -22,5 +22,5 @@ public interface TotalHourService extends MyBaseService<TotalHour> {
*/
List<TotalHour> queryPageList(TotalHourModel model);
List<TotalHour> queryList();
List<Map<String,Object>> queryList(Integer type);
}
......@@ -6,6 +6,7 @@ import com.devplatform.admin.modules.eq.bean.TotalMonth;
import com.devplatform.admin.modules.eq.model.TotalMonthModel;
import java.util.List;
import java.util.Map;
/**
* 能耗-月的service接口
......@@ -22,4 +23,5 @@ public interface TotalMonthService extends MyBaseService<TotalMonth> {
*/
List<TotalMonth> queryPageList(TotalMonthModel model);
List<Map<String, Object>> queryList(Integer type);
}
......@@ -3,8 +3,6 @@ package com.devplatform.admin.modules.eq.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devplatform.admin.common.utils.Constants;
import com.devplatform.admin.common.utils.DateUtils;
import com.devplatform.admin.modules.eq.bean.TotalDay;
import com.devplatform.admin.modules.eq.bean.TotalHour;
import com.devplatform.admin.modules.eq.service.*;
import com.devplatform.admin.modules.sys.bean.SysSystemParams;
import com.devplatform.admin.modules.sys.service.SysSystemParamsService;
......@@ -86,21 +84,21 @@ public class AnalysisServiceImpl implements AnalysisService {
//能耗统计
List<List<String>> list = new ArrayList<List<String>>();
//当天
List<TotalHour> listHour = totalHourService.queryList();
List<Map<String,Object>> listHour = totalHourService.queryList(Constants.INT_1);
for (int i = 0; i < listHour.size(); i++) {
List<String> listDetail = new ArrayList<String>();
listDetail.add(DateUtils.format(listHour.get(i).getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
listDetail.add(listHour.get(i).getElectricEnergy());
listDetail.add(DateUtils.format((Date) listHour.get(i).get("create_time"),"yyyy-MM-dd HH:mm:ss"));
listDetail.add(listHour.get(i).get("electric_energy").toString());
list.add(listDetail);
}
List<List<String>> listMonth = new ArrayList<List<String>>();
//当月
List<TotalDay> listDay = totalDayService.queryList();
List<Map<String,Object>> listDay = totalDayService.queryList(Constants.INT_3);
for (int i = 0; i < listDay.size(); i++) {
List<String> listDetail = new ArrayList<String>();
listDetail.add(DateUtils.format(listDay.get(i).getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
listDetail.add(listDay.get(i).getElectricEnergy());
listDetail.add(DateUtils.format((Date) listDay.get(i).get("create_time"),"yyyy-MM-dd HH:mm:ss"));
listDetail.add(listDay.get(i).get("electric_energy").toString());
listMonth.add(listDetail);
}
......@@ -148,7 +146,15 @@ public class AnalysisServiceImpl implements AnalysisService {
@Override
public List<List<String>> getEnergyListFx(Integer type, String resourceType) {
List<Map<String,Object>> list = new ArrayList<>();
if(Constants.ID_PFJ.equals(resourceType)){
if(Constants.STRING_1.equals(resourceType)){
if(type == Constants.INT_1){
list = totalHourService.queryList(type);
}else if(type == Constants.INT_2 || type == Constants.INT_3){
list = totalDayService.queryList(type);
}else if(type == Constants.INT_4){
list = totalMonthService.queryList(type);
}
}else if(Constants.ID_PFJ.equals(resourceType)){
list = pfjInfoService.queryListByParam(type);
}else if(Constants.ID_JFKTP.equals(resourceType)){
list = jfktpInfoService.queryListByParam(type);
......
......@@ -8,6 +8,7 @@ import com.devplatform.common.service.impl.MyBaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 当月能耗-天的service接口实现类
......@@ -26,8 +27,8 @@ public class TotalDayServiceImpl extends MyBaseServiceImpl<TotalDayDao, TotalDay
}
@Override
public List<TotalDay> queryList() {
return baseMapper.queryList();
public List<Map<String,Object>> queryList(Integer type) {
return baseMapper.queryList(type);
}
......
......@@ -8,6 +8,7 @@ import com.devplatform.common.service.impl.MyBaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 当天能耗-时的service接口实现类
......@@ -26,8 +27,8 @@ public class TotalHourServiceImpl extends MyBaseServiceImpl<TotalHourDao, TotalH
}
@Override
public List<TotalHour> queryList() {
return baseMapper.queryList();
public List<Map<String,Object>> queryList(Integer type) {
return baseMapper.queryList(type);
}
}
......@@ -8,6 +8,7 @@ import com.devplatform.common.service.impl.MyBaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 能耗-月的service接口实现类
......@@ -25,4 +26,9 @@ public class TotalMonthServiceImpl extends MyBaseServiceImpl<TotalMonthDao, Tota
return baseMapper.queryPageList(model);
}
@Override
public List<Map<String, Object>> queryList(Integer type) {
return baseMapper.queryList(type);
}
}
......@@ -38,8 +38,14 @@
${pager.mysqlQueryCondition}
</if>
</select>
<select id="queryList" resultType="com.devplatform.admin.modules.eq.bean.TotalDay">
select * from total_day where DATE_FORMAT(create_time,'%Y%m') = DATE_FORMAT(CURDATE( ),'%Y%m')
<select id="queryList" resultType="java.util.Map">
select * from total_day where 1=1
<if test="type == 2">
and YEARWEEK(date_format(create_time,'%Y-%m-%d'),1) = YEARWEEK(now(),1)
</if>
<if test="type == 3">
and DATE_FORMAT(create_time,'%Y%m')=DATE_FORMAT(CURDATE(), '%Y%m' )
</if>
order by create_time
</select>
......
......@@ -38,8 +38,11 @@
${pager.mysqlQueryCondition}
</if>
</select>
<select id="queryList" resultType="com.devplatform.admin.modules.eq.bean.TotalHour">
select * from total_hour where TO_DAYS(create_time) = TO_DAYS(NOW())
<select id="queryList" resultType="java.util.Map">
select * from total_hour where 1=1
<if test="type == 1">
and TO_DAYS(create_time) = TO_DAYS(NOW())
</if>
order by create_time
</select>
......
......@@ -38,6 +38,13 @@
${pager.mysqlQueryCondition}
</if>
</select>
<select id="queryList" resultType="java.util.Map">
select * from total_hour where 1=1
<if test="type == 4">
and DATE_FORMAT( create_time, '%Y' ) = DATE_FORMAT( CURDATE() , '%Y' )
</if>
order by create_time
</select>
</mapper>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment