Commit 29057a6f authored by jichao's avatar jichao

能耗管理--运行费用排名 修改接口

parent 191c9498
package org.rcisoft.business.overview.controller; package org.rcisoft.business.overview.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
* Created by JiChao on 2018/4/11. * Created by JiChao on 2018/4/11.
* 概览接口 * 概览接口
*/ */
@Api(tags = "能耗管理")
@RestController @RestController
@RequestMapping("overview") @RequestMapping("overview")
public class OverViewController { public class OverViewController {
...@@ -61,12 +63,11 @@ public class OverViewController { ...@@ -61,12 +63,11 @@ public class OverViewController {
@ApiOperation(value="运行费用排名", notes="运行费用排名") @ApiOperation(value="运行费用排名", notes="运行费用排名")
@ApiImplicitParams({@ApiImplicitParam(name = "proId", value = "项目类型主键", required = true, dataType = "字符串"), @ApiImplicitParams({@ApiImplicitParam(name = "proId", value = "项目类型主键", required = true, dataType = "字符串"),
@ApiImplicitParam(name = "type", value = "水电气类型,1:水,2:电,3:气", required = true, dataType = "数字"),
@ApiImplicitParam(name = "date", value = "0:今日,-1:昨日,1:明日", required = true, dataType = "数字") @ApiImplicitParam(name = "date", value = "0:今日,-1:昨日,1:明日", required = true, dataType = "数字")
}) })
@RequestMapping("/getPriceRank") @RequestMapping("/getPriceRank")
public Result getPriceRank(@RequestParam String proId, @RequestParam Integer type, @RequestParam Integer date) { public Result getPriceRank(@RequestParam String proId, @RequestParam Integer date) {
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, date));
} }
/** -------------用能比较--------------- */ /** -------------用能比较--------------- */
......
...@@ -79,10 +79,8 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -79,10 +79,8 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
*/ */
@Select("<script>select a.* from (" + @Select("<script>select a.* from (" +
"select e.`DAY`," + "select e.`DAY`," +
"<if test=\"type == 1\">sum(e.WATER_MONEY)</if>" + "sum(e.WATER_MONEY)+sum(e.ELEC_MONEY)+sum(e.GAS_MONEY) MONEY" +
"<if test=\"type == 2\">sum(e.ELEC_MONEY)</if>" + " from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=${mon}" +
"<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}" +
"<if test=\"hour != null\"> and e.HOUR &lt;= #{hour}</if>" + "<if test=\"hour != null\"> and e.HOUR &lt;= #{hour}</if>" +
" group by e.`DAY`+0 asc) a order by a.MONEY desc</script>") " group by e.`DAY`+0 asc) a order by a.MONEY desc</script>")
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
......
...@@ -48,11 +48,10 @@ public interface OverViewService { ...@@ -48,11 +48,10 @@ public interface OverViewService {
/** /**
* 运行费用排名 * 运行费用排名
* @param proId * @param proId
* @param type
* @param date * @param date
* @return * @return
*/ */
Integer getPriceRank(String proId, Integer type, Integer date); Integer getPriceRank(String proId, Integer date);
/** /**
* 建筑单位面积用量标准 * 建筑单位面积用量标准
......
...@@ -368,12 +368,11 @@ public class OverViewServiceImpl implements OverViewService { ...@@ -368,12 +368,11 @@ public class OverViewServiceImpl implements OverViewService {
} }
@Override @Override
public Integer getPriceRank(String proId, Integer type, Integer date) { public Integer getPriceRank(String proId, Integer date) {
Map<String, String> cal = this.getTime(date); Map<String, String> cal = this.getTime(date);
String day = cal.get("day"); String day = cal.get("day");
EnergyCountMVo e = new EnergyCountMVo(); EnergyCountMVo e = new EnergyCountMVo();
e.setProId(proId); e.setProId(proId);
e.setType(type);
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);
......
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