Commit aae0ee9e authored by jichao's avatar jichao

修改单位面积获取

parent 03e5e5d7
...@@ -16,17 +16,17 @@ import java.util.List; ...@@ -16,17 +16,17 @@ import java.util.List;
@Repository @Repository
public interface BusProjectAreaRepository extends BaseMapper<BusProjectArea> { public interface BusProjectAreaRepository extends BaseMapper<BusProjectArea> {
/** // /**
* 查询水电气的用量标准信息、建筑面积 // * 查询水电气的用量标准信息、建筑面积
* @param busProjectArea // * @param busProjectArea
* @return // * @return
*/ // */
@Select("<script>select * from bus_project_area b where b.PRO_ID=#{proId}</script>") // @Select("<script>select * from bus_project_area b where b.PRO_ID=#{proId}</script>")
@ResultMap(value = "BaseResultMap") // @ResultMap(value = "BaseResultMap")
List<BusProjectArea> queryBusProjectAreas(BusProjectArea busProjectArea); // List<BusProjectArea> queryBusProjectAreas(BusProjectArea busProjectArea);
//
@Select("<script>select SUM(IF(b.TYPE=1, b.AREA, 0)) as WATER_AREA,SUM(IF(b.TYPE=2, b.AREA, 0)) as ELEC_AREA,SUM(IF(b.TYPE=3, b.AREA, 0)) as GAS_AREA from bus_project_area b where b.PRO_ID=#{proId}</script>") // @Select("<script>select SUM(IF(b.TYPE=1, b.AREA, 0)) as WATER_AREA,SUM(IF(b.TYPE=2, b.AREA, 0)) as ELEC_AREA,SUM(IF(b.TYPE=3, b.AREA, 0)) as GAS_AREA from bus_project_area b where b.PRO_ID=#{proId}</script>")
@ResultMap(value = "vo") // @ResultMap(value = "vo")
BusProjectAreaVo classifyProjectArea(String proId); // BusProjectAreaVo classifyProjectArea(String proId);
} }
...@@ -26,8 +26,8 @@ public class BusProjectArea implements Serializable { ...@@ -26,8 +26,8 @@ public class BusProjectArea implements Serializable {
private String proId; private String proId;
private Float area; // private Float area;
//
private String type; private String type;
private Float industryStd; private Float industryStd;
......
...@@ -2,12 +2,10 @@ package org.rcisoft.business.overview.service.impl; ...@@ -2,12 +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.apache.poi.ss.formula.functions.T;
import org.rcisoft.business.overview.dao.*; import org.rcisoft.business.overview.dao.*;
import org.rcisoft.business.overview.entity.*; import org.rcisoft.business.overview.entity.*;
import org.rcisoft.business.overview.service.OverViewService; import org.rcisoft.business.overview.service.OverViewService;
import org.rcisoft.business.overview.vo.BusEnergyPlanVo; import org.rcisoft.business.overview.vo.BusEnergyPlanVo;
import org.rcisoft.business.overview.vo.BusProjectAreaVo;
import org.rcisoft.business.overview.vo.EnergyCountMVo; import org.rcisoft.business.overview.vo.EnergyCountMVo;
import org.rcisoft.business.overview.vo.EnergyPriceVo; import org.rcisoft.business.overview.vo.EnergyPriceVo;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
...@@ -359,7 +357,7 @@ public class OverViewServiceImpl implements OverViewService { ...@@ -359,7 +357,7 @@ public class OverViewServiceImpl implements OverViewService {
public Map<String, Object> getStandard(String proId) { public Map<String, Object> getStandard(String proId) {
BusProjectArea b = new BusProjectArea(); BusProjectArea b = new BusProjectArea();
b.setProId(proId); b.setProId(proId);
List<BusProjectArea> list = busProjectAreaRepository.queryBusProjectAreas(b); List<BusProjectArea> list = busProjectAreaRepository.select(b);
//返回值 //返回值
Map<String, Object> result = new HashMap<String, Object>(); Map<String, Object> result = new HashMap<String, Object>();
Iterator<BusProjectArea> it = list.iterator(); Iterator<BusProjectArea> it = list.iterator();
...@@ -465,14 +463,15 @@ public class OverViewServiceImpl implements OverViewService { ...@@ -465,14 +463,15 @@ public class OverViewServiceImpl implements OverViewService {
if(calendar.get(Calendar.MONTH) == 1) year -= 1; if(calendar.get(Calendar.MONTH) == 1) year -= 1;
String yearS = String.valueOf(year); String yearS = String.valueOf(year);
//1.得到所有的项目 //1.得到所有的项目
List<BusProject> busProjectList = busProjectRepository.queryBusProjects(); List<BusProject> busProjectList = busProjectRepository.selectAll();
//2.循环所有的项目,查询对应项目的统计信息 //2.循环所有的项目,查询对应项目的统计信息
Iterator<BusProject> busProjectIterator = busProjectList.iterator(); Iterator<BusProject> busProjectIterator = busProjectList.iterator();
while (busProjectIterator.hasNext()) { while (busProjectIterator.hasNext()) {
//得到项目主键 //得到项目主键
String proId = busProjectIterator.next().getProId(); String proId = busProjectIterator.next().getProId();
//查询该项目的水电气面积 //查询该项目的水电气面积
BusProjectAreaVo busProjectAreaVo = busProjectAreaRepository.classifyProjectArea(proId); // BusProjectAreaVo busProjectAreaVo = busProjectAreaRepository.classifyProjectArea(proId);
Float area = busProjectIterator.next().getBldArea();
//3.查询对应项目的能源统计(按月份统计) //3.查询对应项目的能源统计(按月份统计)
EnergyCountM e = new EnergyCountM(); EnergyCountM e = new EnergyCountM();
e.setProId(proId); e.setProId(proId);
...@@ -492,9 +491,9 @@ public class OverViewServiceImpl implements OverViewService { ...@@ -492,9 +491,9 @@ public class OverViewServiceImpl implements OverViewService {
gasSum += energyCountM.getGas(); gasSum += energyCountM.getGas();
} }
//算出年度平均值 //算出年度平均值
waterSum = waterSum * 12 / size / busProjectAreaVo.getWaterArea(); waterSum = waterSum * 12 / size / area;
elecSum = elecSum * 12 / size / busProjectAreaVo.getElecArea(); elecSum = elecSum * 12 / size / area;
gasSum = gasSum * 12 / size / busProjectAreaVo.getGasArea(); gasSum = gasSum * 12 / size / area;
//需要新增或更新的对象 //需要新增或更新的对象
resultList.add(new BusProjectAreaStat(proId, yearS, waterSum, elecSum, gasSum)); resultList.add(new BusProjectAreaStat(proId, yearS, waterSum, elecSum, gasSum));
} }
...@@ -597,7 +596,7 @@ public class OverViewServiceImpl implements OverViewService { ...@@ -597,7 +596,7 @@ public class OverViewServiceImpl implements OverViewService {
//昨天时间 //昨天时间
Integer year = calendar.get(Calendar.YEAR), month = calendar.get(Calendar.MONTH) + 1, day = calendar.get(Calendar.DAY_OF_MONTH); Integer year = calendar.get(Calendar.YEAR), month = calendar.get(Calendar.MONTH) + 1, day = calendar.get(Calendar.DAY_OF_MONTH);
//1.得到所有的项目 //1.得到所有的项目
List<BusProject> busProjectList = busProjectRepository.queryBusProjects(); List<BusProject> busProjectList = busProjectRepository.selectAll();
//2.循环所有的项目,查询对应项目的统计信息 //2.循环所有的项目,查询对应项目的统计信息
Iterator<BusProject> busProjectIterator = busProjectList.iterator(); Iterator<BusProject> busProjectIterator = busProjectList.iterator();
while (busProjectIterator.hasNext()) { while (busProjectIterator.hasNext()) {
...@@ -634,13 +633,18 @@ public class OverViewServiceImpl implements OverViewService { ...@@ -634,13 +633,18 @@ public class OverViewServiceImpl implements OverViewService {
private Map<String, Object> getEnergyPlanResult(List<BigDecimal> planList, List<BigDecimal> realList) { private Map<String, Object> getEnergyPlanResult(List<BigDecimal> planList, List<BigDecimal> realList) {
//达标月数,未达标月数 //达标月数,未达标月数
int standard = 0, excessive = 0; int standard = 0, excessive = 0;
BigDecimal planYear = new BigDecimal(0), realYear = new BigDecimal(0);
int size = realList.size(); int size = realList.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
if(realList.get(i).compareTo(planList.get(i)) > 0){ BigDecimal real = realList.get(i);
BigDecimal plan = planList.get(i);
if(real.compareTo(plan) > 0){
excessive++; excessive++;
}else{ }else{
standard++; standard++;
} }
planYear = planYear.add(plan);
realYear = realYear.add(real);
} }
//返回结果 //返回结果
Map<String, Object> result = new HashMap<String, Object>(); Map<String, Object> result = new HashMap<String, Object>();
...@@ -649,6 +653,10 @@ public class OverViewServiceImpl implements OverViewService { ...@@ -649,6 +653,10 @@ public class OverViewServiceImpl implements OverViewService {
result.put("running", size); result.put("running", size);
result.put("standard", standard); result.put("standard", standard);
result.put("excessive", excessive); result.put("excessive", excessive);
if (size == 12) {
result.put("planYear", planYear);
result.put("realYear", realYear);
}
return result; return result;
} }
......
...@@ -9,6 +9,6 @@ import org.rcisoft.business.overview.entity.BusProjectArea; ...@@ -9,6 +9,6 @@ import org.rcisoft.business.overview.entity.BusProjectArea;
@Data @Data
public class BusProjectAreaVo extends BusProjectArea { public class BusProjectAreaVo extends BusProjectArea {
private Float waterArea, elecArea, gasArea; // private Float waterArea, elecArea, gasArea;
} }
...@@ -4,18 +4,18 @@ ...@@ -4,18 +4,18 @@
<resultMap id="BaseResultMap" type="org.rcisoft.business.overview.entity.BusProjectArea"> <resultMap id="BaseResultMap" type="org.rcisoft.business.overview.entity.BusProjectArea">
<id column="ID" jdbcType="VARCHAR" property="id"/> <id column="ID" jdbcType="VARCHAR" property="id"/>
<result column="PRO_ID" jdbcType="VARCHAR" property="proId"/> <result column="PRO_ID" jdbcType="VARCHAR" property="proId"/>
<result column="AREA" jdbcType="FLOAT" property="area"/> <!--<result column="AREA" jdbcType="FLOAT" property="area"/>-->
<result column="TYPE" jdbcType="CHAR" property="type"/> <result column="TYPE" jdbcType="CHAR" property="type"/>
<result column="INDUSTRY_STD" jdbcType="FLOAT" property="industryStd"/> <result column="INDUSTRY_STD" jdbcType="FLOAT" property="industryStd"/>
<result column="SUGGEST_STD" jdbcType="FLOAT" property="suggestStd"/> <result column="SUGGEST_STD" jdbcType="FLOAT" property="suggestStd"/>
<result column="COUNTRY_STD" jdbcType="FLOAT" property="countryStd"/> <result column="COUNTRY_STD" jdbcType="FLOAT" property="countryStd"/>
</resultMap> </resultMap>
<resultMap id="vo" type="org.rcisoft.business.overview.vo.BusProjectAreaVo"> <!--<resultMap id="vo" type="org.rcisoft.business.overview.vo.BusProjectAreaVo">-->
<result column="WATER_AREA" jdbcType="FLOAT" property="waterArea"/> <!--<result column="WATER_AREA" jdbcType="FLOAT" property="waterArea"/>-->
<result column="ELEC_AREA" jdbcType="FLOAT" property="elecArea"/> <!--<result column="ELEC_AREA" jdbcType="FLOAT" property="elecArea"/>-->
<result column="GAS_AREA" jdbcType="FLOAT" property="gasArea"/> <!--<result column="GAS_AREA" jdbcType="FLOAT" property="gasArea"/>-->
</resultMap> <!--</resultMap>-->
<!--<cache type="${corePackag!}.util.RedisCache"/>--> <!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper> </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