You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
3.6 KiB
98 lines
3.6 KiB
package com.mh.user.controller; |
|
|
|
import com.mh.common.http.HttpResult; |
|
import com.mh.user.entity.AlarmInfoSumEntity; |
|
import com.mh.user.entity.DeviceStateEntity; |
|
import com.mh.user.entity.EnergySumEntity; |
|
import com.mh.user.entity.MaintainSumEntity; |
|
import com.mh.user.service.BuildingService; |
|
import com.mh.user.service.SummaryService; |
|
import org.springframework.beans.factory.annotation.Autowired; |
|
import org.springframework.web.bind.annotation.PostMapping; |
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
import org.springframework.web.bind.annotation.RequestParam; |
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
@RestController |
|
@RequestMapping("sum") |
|
public class SummaryController { |
|
|
|
@Autowired |
|
SummaryService summaryService; |
|
|
|
@Autowired |
|
BuildingService buildingService; |
|
|
|
//查询运行状态页面设备状态汇总 |
|
@PostMapping(value="/deviceState") |
|
public HttpResult queryDeviceState() { |
|
try{ |
|
DeviceStateEntity record=summaryService.queryDeviceState(); |
|
return HttpResult.ok(record); |
|
}catch (Exception e){ |
|
//e.printStackTrace(); |
|
return HttpResult.error(); |
|
} |
|
|
|
} |
|
|
|
//查询日月年用量汇总 |
|
@PostMapping(value="/energySum") |
|
public HttpResult queryEnergySum(@RequestParam(value= "buildingId", required=false)String buildingId, |
|
@RequestParam(value= "curDate", required=false)String curDate, |
|
@RequestParam(value= "level", required=false, defaultValue="0") int level, |
|
@RequestParam(value= "type", required=true)Integer type) { |
|
try{ |
|
// String areaId=""; |
|
// if (buildingId!=null && buildingId.length()>0){ |
|
// if (!buildingId.equals("所有")){ |
|
// areaId=buildingService.queryAreaId(Integer.parseInt(buildingId)); |
|
// } |
|
// } |
|
EnergySumEntity record; |
|
// if (areaId!=null && areaId.length()>0){ |
|
// record=summaryService.queryEnergySum(areaId,curDate,type); |
|
// }else{ |
|
record=summaryService.queryEnergySum(buildingId,curDate,type, level); |
|
// } |
|
return HttpResult.ok(record); |
|
}catch (Exception e){ |
|
e.printStackTrace(); |
|
return HttpResult.error(); |
|
} |
|
} |
|
|
|
//查询维修量汇总 |
|
@PostMapping(value="/maintainSum") |
|
public HttpResult queryMaintainSum(@RequestParam(value= "buildingId", required=false)String buildingId, |
|
@RequestParam(value= "curDate", required=false)String curDate) { |
|
try{ |
|
MaintainSumEntity record; |
|
if(buildingId==null || buildingId.equals("")){ |
|
record=summaryService.queryMaintainSum("所有",curDate); |
|
}else { |
|
record=summaryService.queryMaintainSum(buildingId,curDate); |
|
} |
|
|
|
return HttpResult.ok(record); |
|
}catch (Exception e){ |
|
//e.printStackTrace(); |
|
return HttpResult.error(); |
|
} |
|
} |
|
|
|
//警报管理汇总查询 |
|
@PostMapping(value="/alarmInfoSum") |
|
public HttpResult queryAlarmInfoSum(@RequestParam(value= "buildingId", required=false)String buildingId, |
|
@RequestParam(value= "curDate", required=false)String curDate) { |
|
try{ |
|
|
|
AlarmInfoSumEntity record=summaryService.queryAlarmInfoSum(buildingId,curDate); |
|
return HttpResult.ok(record); |
|
}catch (Exception e){ |
|
//e.printStackTrace(); |
|
return HttpResult.error(); |
|
} |
|
} |
|
|
|
}
|
|
|