Commit c20a8fda authored by gaoliwei's avatar gaoliwei

Merge branch 'develop' of ssh://103.249.252.28:10022/wangxiahui/zhny into develop

parents ac5c74e2 47087c2f
...@@ -20,7 +20,7 @@ public interface BusDeviceFaultRepository extends BaseMapper<BusDeviceFault> { ...@@ -20,7 +20,7 @@ public interface BusDeviceFaultRepository extends BaseMapper<BusDeviceFault> {
* @param busDeviceFaultVo * @param busDeviceFaultVo
* @return 日期,次数的list * @return 日期,次数的list
*/ */
@Select("<script>select date_format(b.TM,'%e') `day`,count(*) NUM from bus_device_fault b where b.PRO_ID=#{proId} and date_format(b.TM,'%Y-%c')=#{date} group by date_format(b.TM,'%e')</script>") @Select("<script>select date_format(b.TM,'%e') `day`,count(*) NUM from bus_device_fault b where b.PRO_ID=#{proId} and date_format(b.TM,'%Y-%c')=#{date} group by date_format(b.TM,'%e')+0 asc</script>")
@ResultMap(value = "vo") @ResultMap(value = "vo")
List<BusDeviceFaultVo> statFault(BusDeviceFaultVo busDeviceFaultVo); List<BusDeviceFaultVo> statFault(BusDeviceFaultVo busDeviceFaultVo);
......
...@@ -131,4 +131,35 @@ public class OverViewController { ...@@ -131,4 +131,35 @@ public class OverViewController {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, overViewServiceImpl.statEmissionDay(proId, year, month)); return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, overViewServiceImpl.statEmissionDay(proId, year, month));
} }
/** -------------碳排放量--------------- */
@ApiOperation(value="年用能计划", notes="年用能计划")
@ApiImplicitParams({@ApiImplicitParam(name = "proId", value = "项目类型主键", required = true, dataType = "字符串"),
@ApiImplicitParam(name = "year", value = "年份,如:2018", required = true, dataType = "字符串或数字")
})
@RequestMapping("/statEnergyPlanYear")
public Result statEnergyPlanYear(@RequestParam String proId, @RequestParam String year) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, overViewServiceImpl.statEnergyPlanYear(proId, year));
}
@ApiOperation(value="月用能计划", notes="月用能计划")
@ApiImplicitParams({@ApiImplicitParam(name = "proId", value = "项目类型主键", required = true, dataType = "字符串"),
@ApiImplicitParam(name = "year", value = "年份,如:2018", required = true, dataType = "字符串或数字"),
@ApiImplicitParam(name = "month", value = "月份,如:6", required = true, dataType = "字符串或数字")
})
@RequestMapping("/statEnergyPlanMonth")
public Result statEnergyPlanMonth(@RequestParam String proId, @RequestParam String year, @RequestParam String month) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, overViewServiceImpl.statEnergyPlanMonth(proId, year, month));
}
@ApiOperation(value="日用能计划", notes="日用能计划")
@ApiImplicitParams({@ApiImplicitParam(name = "proId", value = "项目类型主键", required = true, dataType = "字符串"),
@ApiImplicitParam(name = "year", value = "年份,如:2018", required = true, dataType = "字符串或数字"),
@ApiImplicitParam(name = "month", value = "月份,如:6", required = true, dataType = "字符串或数字"),
@ApiImplicitParam(name = "day", value = "日,如:1", required = true, dataType = "字符串或数字")
})
@RequestMapping("/statEnergyPlanDay")
public Result statEnergyPlanDay(@RequestParam String proId, @RequestParam String year, @RequestParam String month, @RequestParam String day) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, overViewServiceImpl.statEnergyPlanDay(proId, year, month, day));
}
} }
package org.rcisoft.business.overview.dao;
import org.rcisoft.business.overview.entity.BusEnergyplanV;
import org.rcisoft.business.overview.vo.BusEnergyPlanVo;
import org.rcisoft.core.base.BaseMapper;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created with on 2018-4-19 9:20:45.
*/
@Repository
public interface BusEnergyplanVRepository extends BaseMapper<BusEnergyplanV> {
@Select("<script>select date_format(b.TM,'%c') MON,sum(b.ENERGY_MONEY) ENERGY_MONEY from bus_energyplan_v b,bus_device d where b.DEV_NUM=d.DEV_ID and d.PRO_ID=#{proId} and date_format(b.TM,'%Y')=#{time} group by date_format(b.TM,'%c') order by date_format(b.TM,'%c')+0 asc</script>")
@ResultMap(value = "vo")
List<BusEnergyPlanVo> statEnergyPlanYear(BusEnergyPlanVo busEnergyPlanVo);
@Select("<script>select date_format(b.TM,'%e') `DAY`,sum(b.ENERGY_MONEY) ENERGY_MONEY from bus_energyplan_v b,bus_device d where b.DEV_NUM=d.DEV_ID and d.PRO_ID=#{proId} and date_format(b.TM,'%Y-%c')=#{time} group by date_format(b.TM,'%e') order by date_format(b.TM,'%e')+0 asc</script>")
@ResultMap(value = "vo")
List<BusEnergyPlanVo> statEnergyPlanMonth(BusEnergyPlanVo busEnergyPlanVo);
@Select("<script>select date_format(b.TM,'%k') `HOUR`,sum(b.ENERGY_MONEY) ENERGY_MONEY from bus_energyplan_v b,bus_device d where b.DEV_NUM=d.DEV_ID and d.PRO_ID=#{proId} and date_format(b.TM,'%Y-%c-%e')=#{time} group by date_format(b.TM,'%k') order by date_format(b.TM,'%k')+0 asc</script>")
@ResultMap(value = "vo")
List<BusEnergyPlanVo> statEnergyPlanDay(BusEnergyPlanVo busEnergyPlanVo);
}
...@@ -38,12 +38,12 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -38,12 +38,12 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
* @param energyCountMVo * @param energyCountMVo
* @return * @return
*/ */
@Select("<script>select e.HOUR," + @Select("<script>select e.`HOUR`," +
"<if test=\"type == 1\">sum(e.WATER_MONEY)</if>" + "<if test=\"type == 1\">sum(e.WATER_MONEY)</if>" +
"<if test=\"type == 2\">sum(e.ELEC_MONEY)</if>" + "<if test=\"type == 2\">sum(e.ELEC_MONEY)</if>" +
"<if test=\"type == 3\">sum(e.GAS_MONEY)</if>" + "<if test=\"type == 3\">sum(e.GAS_MONEY)</if>" +
" as MONEY from ENERGY_COUNT_M e" + " as MONEY from ENERGY_COUNT_M e" +
" where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} and e.`DAY`=#{day} group by e.HOUR</script>") " where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} and e.`DAY`=#{day} group by e.`HOUR`+0 asc</script>")
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
List<EnergyCountMVo> countDailyPrice(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> countDailyPrice(EnergyCountMVo energyCountMVo);
...@@ -73,7 +73,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -73,7 +73,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
"<if test=\"type == 3\">sum(e.GAS_MONEY)</if>" + "<if test=\"type == 3\">sum(e.GAS_MONEY)</if>" +
" as MONEY from ENERGY_COUNT_M e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon}" + " as MONEY from ENERGY_COUNT_M e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon}" +
"<if test=\"hour != null\"> and e.HOUR &lt;= #{hour}</if>" + "<if test=\"hour != null\"> and e.HOUR &lt;= #{hour}</if>" +
" group by e.`DAY`) a order by a.MONEY desc</script>") " group by e.`DAY`+0 asc) a order by a.MONEY desc</script>")
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
List<EnergyCountMVo> getPriceRank(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> getPriceRank(EnergyCountMVo energyCountMVo);
...@@ -86,7 +86,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -86,7 +86,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
"<if test=\"type == 1\">sum(e.WATER)</if>" + "<if test=\"type == 1\">sum(e.WATER)</if>" +
"<if test=\"type == 2\">sum(e.ELEC)</if>" + "<if test=\"type == 2\">sum(e.ELEC)</if>" +
"<if test=\"type == 3\">sum(e.GAS)</if>" + "<if test=\"type == 3\">sum(e.GAS)</if>" +
" as ENERGY from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} group by e.`DAY`</script>") " as ENERGY from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} group by e.`DAY`+0 asc</script>")
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
List<EnergyCountMVo> getEnergyCompare(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> getEnergyCompare(EnergyCountMVo energyCountMVo);
...@@ -96,7 +96,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -96,7 +96,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
* @return * @return
*/ */
@Select("<script>select e.MON,sum(e.WATER) as WATER,sum(e.ELEC) as ELEC,sum(e.GAS) as GAS from energy_count_m e" + @Select("<script>select e.MON,sum(e.WATER) as WATER,sum(e.ELEC) as ELEC,sum(e.GAS) as GAS from energy_count_m e" +
" where e.PRO_ID=#{proId} and e.`YEAR`=#{year} group by e.MON</script>") " where e.PRO_ID=#{proId} and e.`YEAR`=#{year} group by e.MON+0 asc</script>")
@ResultMap("BaseResultMap") @ResultMap("BaseResultMap")
List<EnergyCountM> getEnergyMonth(EnergyCountM energyCountM); List<EnergyCountM> getEnergyMonth(EnergyCountM energyCountM);
...@@ -109,4 +109,31 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -109,4 +109,31 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
@ResultMap("BaseResultMap") @ResultMap("BaseResultMap")
EnergyCountM countEnergyDay(EnergyCountM energyCountM); EnergyCountM countEnergyDay(EnergyCountM energyCountM);
/**
* 年用能计划
* @param energyCountMVo
* @return
*/
@Select("<script>select e.MON,sum(if(e.WATER_MONEY is null,0,e.WATER_MONEY))+sum(if(e.ELEC_MONEY is null,0,e.ELEC_MONEY))+sum(if(e.GAS_MONEY is null,0,e.GAS_MONEY)) MONEY from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} group by e.MON+0 asc</script>")
@ResultMap("resultMapVo")
List<EnergyCountMVo> statEnergyPlanYear(EnergyCountMVo energyCountMVo);
/**
* 月用能计划
* @param energyCountMVo
* @return
*/
@Select("<script>select e.`DAY`,sum(if(e.WATER_MONEY is null,0,e.WATER_MONEY))+sum(if(e.ELEC_MONEY is null,0,e.ELEC_MONEY))+sum(if(e.GAS_MONEY is null,0,e.GAS_MONEY)) MONEY from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} group by e.`DAY`+0 asc</script>")
@ResultMap("resultMapVo")
List<EnergyCountMVo> statEnergyPlanMonth(EnergyCountMVo energyCountMVo);
/**
* 日用能计划
* @param energyCountMVo
* @return
*/
@Select("<script>select e.`HOUR`,sum(if(e.WATER_MONEY is null,0,e.WATER_MONEY))+sum(if(e.ELEC_MONEY is null,0,e.ELEC_MONEY))+sum(if(e.GAS_MONEY is null,0,e.GAS_MONEY)) MONEY from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} and e.`DAY`=#{day} group by e.`HOUR`+0 asc</script>")
@ResultMap("resultMapVo")
List<EnergyCountMVo> statEnergyPlanDay(EnergyCountMVo energyCountMVo);
} }
...@@ -38,7 +38,7 @@ public interface EnergyEmissionRealRepository extends BaseMapper<EnergyEmissionR ...@@ -38,7 +38,7 @@ public interface EnergyEmissionRealRepository extends BaseMapper<EnergyEmissionR
* @param energyEmissionReal * @param energyEmissionReal
* @return * @return
*/ */
@Select("<script>select e.MON,sum(e.EMISSION) as EMISSION from energy_emission_real e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} group by e.MON</script>") @Select("<script>select e.MON,sum(e.EMISSION) as EMISSION from energy_emission_real e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} group by e.MON asc</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<EnergyEmissionReal> statEmissionMonth(EnergyEmissionReal energyEmissionReal); List<EnergyEmissionReal> statEmissionMonth(EnergyEmissionReal energyEmissionReal);
...@@ -47,7 +47,7 @@ public interface EnergyEmissionRealRepository extends BaseMapper<EnergyEmissionR ...@@ -47,7 +47,7 @@ public interface EnergyEmissionRealRepository extends BaseMapper<EnergyEmissionR
* @param energyEmissionReal * @param energyEmissionReal
* @return * @return
*/ */
@Select("<script>select e.`DAY`,sum(e.EMISSION) as EMISSION from energy_emission_real e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} group by e.`DAY`</script>") @Select("<script>select e.`DAY`,sum(e.EMISSION) as EMISSION from energy_emission_real e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} group by e.`DAY` asc</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<EnergyEmissionReal> statEmissionDay(EnergyEmissionReal energyEmissionReal); List<EnergyEmissionReal> statEmissionDay(EnergyEmissionReal energyEmissionReal);
......
package org.rcisoft.business.overview.entity;
import lombok.*;
import org.rcisoft.core.entity.IdNotDataEntity;
import javax.persistence.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with on 2018-4-19 9:20:45.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "bus_energyplan_v")
public class BusEnergyplanV implements Serializable {
@Id
private Integer id;
private String devNum;
private Date tm;
private BigDecimal energyPower;
private BigDecimal energyGas;
private BigDecimal energyMoney;
}
...@@ -21,11 +21,22 @@ import java.util.List; ...@@ -21,11 +21,22 @@ import java.util.List;
@Table(name = "energy_count_m") @Table(name = "energy_count_m")
public class EnergyCountM implements Serializable { public class EnergyCountM implements Serializable {
public EnergyCountM(String proId, String day, String mon, String year) { public EnergyCountM(String proId, String year) {
this.proId = proId; this.proId = proId;
this.day = day; this.year = year;
}
public EnergyCountM(String proId, String year, String mon) {
this.proId = proId;
this.year = year;
this.mon = mon; this.mon = mon;
}
public EnergyCountM(String proId, String year, String mon, String day) {
this.proId = proId;
this.year = year; this.year = year;
this.mon = mon;
this.day = day;
} }
@Id @Id
......
...@@ -122,4 +122,31 @@ public interface OverViewService { ...@@ -122,4 +122,31 @@ public interface OverViewService {
*/ */
PersistModel statEmission(); PersistModel statEmission();
/**
* 年用能计划
* @param proId
* @param year
* @return
*/
Map<String, Object> statEnergyPlanYear(String proId, String year);
/**
* 月用能计划
* @param proId
* @param year
* @param month
* @return
*/
Map<String, Object> statEnergyPlanMonth( String proId, String year, String month);
/**
* 日用能计划
* @param proId
* @param year
* @param month
* @param day
* @return
*/
Map<String, Object> statEnergyPlanDay( String proId, String year, String month, String day);
} }
package org.rcisoft.business.overview.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.rcisoft.business.overview.entity.BusEnergyplanV;
import java.math.BigDecimal;
import java.util.Date;
/**
* Created by JiChao on 2018/4/18.
*/
@NoArgsConstructor
@AllArgsConstructor
@Data
public class BusEnergyPlanVo extends BusEnergyplanV {
public BusEnergyPlanVo(String proId, String time) {
super();
this.proId = proId;
this.time = time;
}
private String year, mon, day, hour, time;
private String proId;
}
package org.rcisoft.business.overview.vo; package org.rcisoft.business.overview.vo;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import org.rcisoft.business.overview.entity.EnergyCountM; import org.rcisoft.business.overview.entity.EnergyCountM;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -8,9 +10,23 @@ import java.math.BigDecimal; ...@@ -8,9 +10,23 @@ import java.math.BigDecimal;
/** /**
* Created by JiChao on 2018/4/12. * Created by JiChao on 2018/4/12.
*/ */
@NoArgsConstructor
@AllArgsConstructor
@Data @Data
public class EnergyCountMVo extends EnergyCountM { public class EnergyCountMVo extends EnergyCountM {
public EnergyCountMVo(String proId, String year){
super(proId, year);
}
public EnergyCountMVo(String proId, String year, String mon){
super(proId, year, mon);
}
public EnergyCountMVo(String proId, String year, String mon, String day){
super(proId, year, mon, day);
}
//水电气区分 //水电气区分
private Integer type; private Integer type;
//费用 //费用
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<select id="listProjectInformationByYear" resultType="map"> <select id="listProjectInformationByYear" resultType="map">
SELECT SELECT
(select count(*) from bus_project) as total,
PRO_NM, PRO_NM,
BLD_LOCAL, BLD_LOCAL,
bbt.BLD_TP_NM, bbt.BLD_TP_NM,
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.rcisoft.business.overview.dao.BusEnergyplanVRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.overview.entity.BusEnergyplanV">
<id column="ID" jdbcType="INTEGER" property="id"/>
<result column="DEV_NUM" jdbcType="VARCHAR" property="devNum"/>
<result column="TM" jdbcType="TIMESTAMP" property="tm"/>
<result column="ENERGY_POWER" jdbcType="DECIMAL" property="energyPower"/>
<result column="ENERGY_GAS" jdbcType="DECIMAL" property="energyGas"/>
<result column="ENERGY_MONEY" jdbcType="DECIMAL" property="energyMoney"/>
</resultMap>
<resultMap id="vo" type="org.rcisoft.business.overview.vo.BusEnergyPlanVo">
<result column="HOUR" jdbcType="VARCHAR" property="hour"/>
<result column="YEAR" jdbcType="VARCHAR" property="year"/>
<result column="MON" jdbcType="VARCHAR" property="mon"/>
<result column="DAY" jdbcType="VARCHAR" property="day"/>
<result column="ENERGY_MONEY" jdbcType="DECIMAL" property="energyMoney"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
This diff is collapsed.
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