Commit 505231d0 authored by jichao's avatar jichao

改bug

parent 29057a6f
...@@ -37,12 +37,12 @@ public class BusSavingServiceImpl implements BusSavingService { ...@@ -37,12 +37,12 @@ public class BusSavingServiceImpl implements BusSavingService {
public PersistModel update(List<BusSaving> busSavingList) { public PersistModel update(List<BusSaving> busSavingList) {
int result = 0; int result = 0;
String message = ""; String message = "";
Example example = new Example(BusSaving.class);
Example.Criteria criteria = example.createCriteria();
for (BusSaving busSaving : busSavingList) { for (BusSaving busSaving : busSavingList) {
String id = busSaving.getId(); String id = busSaving.getId();
criteria.andEqualTo("id", id);
if (StringUtils.isNotEmpty(id)) { if (StringUtils.isNotEmpty(id)) {
Example example = new Example(BusSaving.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("id", id);
result += busSavingRepository.updateByExampleSelective(busSaving, example); result += busSavingRepository.updateByExampleSelective(busSaving, example);
message = "更新成功"; message = "更新成功";
} else { } else {
......
...@@ -43,12 +43,11 @@ public class OverViewController { ...@@ -43,12 +43,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("/countDailyPrice") @RequestMapping("/countDailyPrice")
public Result countDailyPrice(@RequestParam String proId, @RequestParam Integer type, @RequestParam Integer date) { public Result countDailyPrice(@RequestParam String proId, @RequestParam Integer date) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, overViewServiceImpl.countDailyPrice(proId, type, date)); return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, overViewServiceImpl.countDailyPrice(proId, date));
} }
@ApiOperation(value="耗能拆分统计", notes="耗能拆分统计") @ApiOperation(value="耗能拆分统计", notes="耗能拆分统计")
......
...@@ -28,8 +28,8 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -28,8 +28,8 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
"sum(GAS) as gas,sum(GAS_MONEY) as gasMoney" + "sum(GAS) as gas,sum(GAS_MONEY) as gasMoney" +
" from energy_count_m e " + " from energy_count_m e " +
"where e.PRO_ID=#{proId} and `year`=#{year}" + "where e.PRO_ID=#{proId} and `year`=#{year}" +
"<if test=\"day != null\"> and `day`=${day} group by e.`day`</if>" + "<if test=\"day != null\"> and `day`=#{day} group by e.`day`</if>" +
"<if test=\"mon != null\"> and mon=${mon} group by e.mon</if></script>") "<if test=\"mon != null\"> and mon=#{mon} group by e.mon</if></script>")
@ResultMap("BaseResultMap") @ResultMap("BaseResultMap")
EnergyCountM countAmountAndPrice(EnergyCountM energyCountM); EnergyCountM countAmountAndPrice(EnergyCountM energyCountM);
...@@ -39,11 +39,9 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -39,11 +39,9 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
* @return * @return
*/ */
@Select("<script>select e.`HOUR`," + @Select("<script>select e.`HOUR`," +
"<if test=\"type == 1\">sum(e.WATER_MONEY)</if>" + "sum(e.WATER_MONEY)+sum(e.ELEC_MONEY)+sum(e.GAS_MONEY) as MONEY" +
"<if test=\"type == 2\">sum(e.ELEC_MONEY)</if>" + " from energy_count_m e" +
"<if test=\"type == 3\">sum(e.GAS_MONEY)</if>" + " where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} and e.`DAY`=#{day} group by e.`HOUR`+0 asc</script>")
" 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`+0 asc</script>")
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
List<EnergyCountMVo> countDailyPrice(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> countDailyPrice(EnergyCountMVo energyCountMVo);
...@@ -53,7 +51,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -53,7 +51,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
* @return * @return
*/ */
@Select("<script>select if(sum(e.WATER) is null, 0, sum(e.WATER)) ENERGY from energy_count_m e " + @Select("<script>select if(sum(e.WATER) is null, 0, sum(e.WATER)) ENERGY from energy_count_m e " +
"where e.`DAY`=${day} and e.MON=${mon} and e.`YEAR`=#{year} and e.PRO_ID=#{proId}</script>") "where e.`DAY`=#{day} and e.MON=#{mon} and e.`YEAR`=#{year} and e.PRO_ID=#{proId}</script>")
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
List<EnergyCountMVo> countEnergySplitWater(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> countEnergySplitWater(EnergyCountMVo energyCountMVo);
...@@ -67,7 +65,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -67,7 +65,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
"<if test=\"type == 3\">sum(e.GAS) ENERGY </if>" + "<if test=\"type == 3\">sum(e.GAS) ENERGY </if>" +
"from bus_device d,bus_device_meter dm,energy_count_m e " + "from bus_device d,bus_device_meter dm,energy_count_m e " +
"where d.DEV_NUM=dm.DEV_NUM and dm.MET_NUM=e.MET_NUM and " + "where d.DEV_NUM=dm.DEV_NUM and dm.MET_NUM=e.MET_NUM and " +
"e.`DAY`=${day} and e.MON=${mon} and e.`YEAR`=#{year} and e.PRO_ID=#{proId} " + "e.`DAY`=#{day} and e.MON=#{mon} and e.`YEAR`=#{year} and e.PRO_ID=#{proId} " +
"group by d.DEV_NM</script>") "group by d.DEV_NM</script>")
@ResultMap("resultMapVo") @ResultMap("resultMapVo")
List<EnergyCountMVo> countEnergySplitElecGas(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> countEnergySplitElecGas(EnergyCountMVo energyCountMVo);
...@@ -80,7 +78,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -80,7 +78,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
@Select("<script>select a.* from (" + @Select("<script>select a.* from (" +
"select e.`DAY`," + "select e.`DAY`," +
"sum(e.WATER_MONEY)+sum(e.ELEC_MONEY)+sum(e.GAS_MONEY) MONEY" + "sum(e.WATER_MONEY)+sum(e.ELEC_MONEY)+sum(e.GAS_MONEY) MONEY" +
" from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=${mon}" + " 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")
...@@ -95,7 +93,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -95,7 +93,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`+0 asc</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);
...@@ -114,7 +112,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -114,7 +112,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
* @param energyCountM * @param energyCountM
* @return * @return
*/ */
@Select("<script>select SUM(e.WATER) WATER,SUM(e.ELEC) ELEC,SUM(e.GAS) GAS from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=${mon} and e.`DAY`=${day}</script>") @Select("<script>select SUM(e.WATER) WATER,SUM(e.ELEC) ELEC,SUM(e.GAS) GAS from energy_count_m e where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} and e.`DAY`=#{day}</script>")
@ResultMap("BaseResultMap") @ResultMap("BaseResultMap")
EnergyCountM countEnergyDay(EnergyCountM energyCountM); EnergyCountM countEnergyDay(EnergyCountM energyCountM);
...@@ -132,7 +130,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -132,7 +130,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
* @param energyCountMVo * @param energyCountMVo
* @return * @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>") @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") @ResultMap("resultMapVo")
List<EnergyCountMVo> statEnergyPlanMonth(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> statEnergyPlanMonth(EnergyCountMVo energyCountMVo);
...@@ -141,7 +139,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> { ...@@ -141,7 +139,7 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
* @param energyCountMVo * @param energyCountMVo
* @return * @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>") @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") @ResultMap("resultMapVo")
List<EnergyCountMVo> statEnergyPlanDay(EnergyCountMVo energyCountMVo); List<EnergyCountMVo> statEnergyPlanDay(EnergyCountMVo energyCountMVo);
......
...@@ -35,7 +35,7 @@ public interface OverViewService { ...@@ -35,7 +35,7 @@ public interface OverViewService {
* @param type * @param type
* @return * @return
*/ */
List<EnergyCountMVo> countDailyPrice(String proId, Integer type, Integer date); List<EnergyCountMVo> countDailyPrice(String proId, Integer date);
/** /**
* 耗能拆分统计 * 耗能拆分统计
...@@ -51,7 +51,7 @@ public interface OverViewService { ...@@ -51,7 +51,7 @@ public interface OverViewService {
* @param date * @param date
* @return * @return
*/ */
Integer getPriceRank(String proId, Integer date); Map<String, Object> getPriceRank(String proId, Integer date);
/** /**
* 建筑单位面积用量标准 * 建筑单位面积用量标准
......
...@@ -318,11 +318,10 @@ public class OverViewServiceImpl implements OverViewService { ...@@ -318,11 +318,10 @@ public class OverViewServiceImpl implements OverViewService {
} }
@Override @Override
public List<EnergyCountMVo> countDailyPrice(String proId, Integer type, Integer date) { public List<EnergyCountMVo> countDailyPrice(String proId, Integer date) {
Map<String, String> cal = this.getTime(date); Map<String, String> cal = this.getTime(date);
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(cal.get("day")); e.setDay(cal.get("day"));
...@@ -368,7 +367,11 @@ public class OverViewServiceImpl implements OverViewService { ...@@ -368,7 +367,11 @@ public class OverViewServiceImpl implements OverViewService {
} }
@Override @Override
public Integer getPriceRank(String proId, Integer date) { public Map<String, Object> getPriceRank(String proId, Integer date) {
//返回值 价格 排名
Map<String, Object> result = new HashMap<>();
result.put("money", 0);
result.put("rank", 1);
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();
...@@ -381,10 +384,12 @@ public class OverViewServiceImpl implements OverViewService { ...@@ -381,10 +384,12 @@ public class OverViewServiceImpl implements OverViewService {
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);
String eDay = energyCountMVo.getDay(); String eDay = energyCountMVo.getDay();
if(StringUtils.equals(day, eDay)) if(StringUtils.equals(day, eDay)) {
return i + 1; result.put("money", energyCountMVo.getMoney());
result.put("rank", i + 1);
}
} }
return 1; return result;
} }
@Override @Override
......
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