Commit 7b11519b authored by jichao's avatar jichao

energy_count_m表更改字段

parent e0d5f18b
...@@ -94,6 +94,23 @@ public class OverViewController { ...@@ -94,6 +94,23 @@ public class OverViewController {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, overViewServiceImpl.getPriceRank(proId, type, date)); return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, overViewServiceImpl.getPriceRank(proId, type, date));
} }
/** ------------------------------------ */ /** -------------用能比较--------------- */
@ApiOperation(value="建筑单位面积用量标准", notes="水电气的行业标准、建议标准、国家标准")
@ApiImplicitParams({@ApiImplicitParam(name = "proId", value = "项目类型主键", required = true, dataType = "字符串")})
@RequestMapping("/getStandard")
public Result getStandard(@RequestParam String proId) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, overViewServiceImpl.getStandard(proId));
}
/**
* @param proId 项目主键
* @return
*/
@ApiOperation(value="建筑单位面积用量年度", notes="建筑单位面积用量")
@ApiImplicitParams({@ApiImplicitParam(name = "proId", value = "项目类型主键", required = true, dataType = "字符串")})
@RequestMapping("/getUnitArea")
public Result getUnitArea(@RequestParam String proId) {
return null;
}
} }
package org.rcisoft.business.overview.dao;
import org.rcisoft.business.overview.entity.BusProjectArea;
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-13 13:51:00.
*/
@Repository
public interface BusProjectAreaRepository extends BaseMapper<BusProjectArea> {
/**
* 查询水电气的用量标准信息、建筑面积
* @param busProjectArea
* @return
*/
@Select("<script>select * from bus_project_area b where b.PRO_ID=#{proId}</script>")
@ResultMap(value = "BaseResultMap")
List<BusProjectArea> queryBusProjectAreas(BusProjectArea busProjectArea);
}
...@@ -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.MIN," + @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.MIN</script>") " where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} and e.`DAY`=#{day} group by e.HOUR</script>")
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
List<EnergyCountMVo> countDailyPrice(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> countDailyPrice(EnergyCountMVo energyCountMVo);
...@@ -72,7 +72,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -72,7 +72,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
"<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 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=\"min != null\"> and e.MIN &lt;= #{min}</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`) a order by a.MONEY desc</script>")
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
List<EnergyCountMVo> getPriceRank(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> getPriceRank(EnergyCountMVo energyCountMVo);
......
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-13 13:51:00.
* 建筑单位面积用量标准及面积
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "bus_project_area")
public class BusProjectArea implements Serializable {
@Id
private String id;
private String proId;
private Float area;
private String type;
private Float industryStd;
private Float suggestStd;
private Float countryStd;
}
...@@ -35,7 +35,7 @@ public class EnergyCountM implements Serializable { ...@@ -35,7 +35,7 @@ public class EnergyCountM implements Serializable {
private Float gas; private Float gas;
private String min; private String hour;
private String day; private String day;
......
...@@ -50,4 +50,11 @@ public interface OverViewService { ...@@ -50,4 +50,11 @@ public interface OverViewService {
*/ */
Integer getPriceRank(String proId, Integer type, Integer date); Integer getPriceRank(String proId, Integer type, Integer date);
/**
* 建筑单位面积用量标准
* @param proId
* @return
*/
Map<String, Object> getStandard(String proId);
} }
...@@ -2,8 +2,10 @@ package org.rcisoft.business.overview.service.impl; ...@@ -2,8 +2,10 @@ package org.rcisoft.business.overview.service.impl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.overview.dao.BusProjectAreaRepository;
import org.rcisoft.business.overview.dao.EnergyCountMRepository; import org.rcisoft.business.overview.dao.EnergyCountMRepository;
import org.rcisoft.business.overview.dao.EnergyPriceRepository; import org.rcisoft.business.overview.dao.EnergyPriceRepository;
import org.rcisoft.business.overview.entity.BusProjectArea;
import org.rcisoft.business.overview.entity.EnergyCountM; import org.rcisoft.business.overview.entity.EnergyCountM;
import org.rcisoft.business.overview.entity.EnergyPrice; import org.rcisoft.business.overview.entity.EnergyPrice;
import org.rcisoft.business.overview.service.OverViewService; import org.rcisoft.business.overview.service.OverViewService;
...@@ -24,6 +26,8 @@ public class OverViewServiceImpl implements OverViewService { ...@@ -24,6 +26,8 @@ public class OverViewServiceImpl implements OverViewService {
private EnergyPriceRepository overViewRepository; private EnergyPriceRepository overViewRepository;
@Autowired @Autowired
private EnergyCountMRepository energyCountMRepository; private EnergyCountMRepository energyCountMRepository;
@Autowired
private BusProjectAreaRepository busProjectAreaRepository;
private Calendar getBeforeDay(Calendar cl, int time){ private Calendar getBeforeDay(Calendar cl, int time){
int day = cl.get(Calendar.DATE); int day = cl.get(Calendar.DATE);
...@@ -42,16 +46,8 @@ public class OverViewServiceImpl implements OverViewService { ...@@ -42,16 +46,8 @@ public class OverViewServiceImpl implements OverViewService {
return result; return result;
} }
@Override private String getType(String type) {
public Map<String, Object> getPrice(String proId) { switch (type) {
Map<String, Object> map = new HashMap<String, Object>();
List<EnergyPrice> list = overViewRepository.getPrice(proId);
Iterator<EnergyPrice> it = list.iterator();
//定义一个变量
String type = "";
while (it.hasNext()) {
EnergyPrice energyPrice = it.next();
switch (energyPrice.getPTp()) {
case "1": //水 case "1": //水
type = "water"; type = "water";
break; break;
...@@ -62,9 +58,19 @@ public class OverViewServiceImpl implements OverViewService { ...@@ -62,9 +58,19 @@ public class OverViewServiceImpl implements OverViewService {
type = "gas"; type = "gas";
break; break;
default: default:
type = "";
break; break;
} }
return type;
}
@Override
public Map<String, Object> getPrice(String proId) {
Map<String, Object> map = new HashMap<String, Object>();
List<EnergyPrice> list = overViewRepository.getPrice(proId);
Iterator<EnergyPrice> it = list.iterator();
while (it.hasNext()) {
EnergyPrice energyPrice = it.next();
String type = this.getType(energyPrice.getPTp());
if(StringUtils.isNotEmpty(type)) map.put(type, energyPrice); if(StringUtils.isNotEmpty(type)) map.put(type, energyPrice);
} }
return map; return map;
...@@ -124,7 +130,7 @@ public class OverViewServiceImpl implements OverViewService { ...@@ -124,7 +130,7 @@ public class OverViewServiceImpl implements OverViewService {
e.setYear(cal.get("year")); e.setYear(cal.get("year"));
e.setMon(cal.get("month")); e.setMon(cal.get("month"));
e.setDay(day); e.setDay(day);
if(date != 0) e.setMin(cal.get("hour")); if(date != 0) e.setHour(cal.get("hour"));
List<EnergyCountMVo> list = energyCountMRepository.getPriceRank(e); List<EnergyCountMVo> list = energyCountMRepository.getPriceRank(e);
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
EnergyCountMVo energyCountMVo = list.get(i); EnergyCountMVo energyCountMVo = list.get(i);
...@@ -134,4 +140,20 @@ public class OverViewServiceImpl implements OverViewService { ...@@ -134,4 +140,20 @@ public class OverViewServiceImpl implements OverViewService {
} }
return 1; return 1;
} }
@Override
public Map<String, Object> getStandard(String proId) {
BusProjectArea b = new BusProjectArea();
b.setProId(proId);
List<BusProjectArea> list = busProjectAreaRepository.queryBusProjectAreas(b);
//返回值
Map<String, Object> result = new HashMap<String, Object>();
Iterator<BusProjectArea> it = list.iterator();
while (it.hasNext()) {
BusProjectArea busProjectArea = it.next();
String type = this.getType(busProjectArea.getType());
if(StringUtils.isNotEmpty(type)) result.put(type, busProjectArea);
}
return result;
}
} }
<?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.BusProjectAreaRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.overview.entity.BusProjectArea">
<id column="ID" jdbcType="VARCHAR" property="id"/>
<result column="PRO_ID" jdbcType="VARCHAR" property="proId"/>
<result column="AREA" jdbcType="FLOAT" property="area"/>
<result column="TYPE" jdbcType="CHAR" property="type"/>
<result column="INDUSTRY_STD" jdbcType="FLOAT" property="industryStd"/>
<result column="SUGGEST_STD" jdbcType="FLOAT" property="suggestStd"/>
<result column="COUNTRY_STD" jdbcType="FLOAT" property="countryStd"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<result column="WATER" jdbcType="FLOAT" property="water"/> <result column="WATER" jdbcType="FLOAT" property="water"/>
<result column="ELEC" jdbcType="FLOAT" property="elec"/> <result column="ELEC" jdbcType="FLOAT" property="elec"/>
<result column="GAS" jdbcType="FLOAT" property="gas"/> <result column="GAS" jdbcType="FLOAT" property="gas"/>
<result column="MIN" jdbcType="VARCHAR" property="min"/> <result column="HOUR" jdbcType="VARCHAR" property="hour"/>
<result column="DAY" jdbcType="VARCHAR" property="day"/> <result column="DAY" jdbcType="VARCHAR" property="day"/>
<result column="MON" jdbcType="VARCHAR" property="mon"/> <result column="MON" jdbcType="VARCHAR" property="mon"/>
<result column="YEAR" jdbcType="VARCHAR" property="year"/> <result column="YEAR" jdbcType="VARCHAR" property="year"/>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<resultMap id="resultMapVo" type="org.rcisoft.business.overview.vo.EnergyCountMVo"> <resultMap id="resultMapVo" type="org.rcisoft.business.overview.vo.EnergyCountMVo">
<result column="DEV_ID" jdbcType="VARCHAR" property="devId"/> <result column="DEV_ID" jdbcType="VARCHAR" property="devId"/>
<result column="MIN" jdbcType="VARCHAR" property="min"/> <result column="HOUR" jdbcType="VARCHAR" property="hour"/>
<result column="MONEY" jdbcType="DECIMAL" property="money"/> <result column="MONEY" jdbcType="DECIMAL" property="money"/>
<result column="ENERGY" jdbcType="DECIMAL" property="energy"/> <result column="ENERGY" jdbcType="DECIMAL" property="energy"/>
</resultMap> </resultMap>
......
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