/** * Copyright 2018 人人开源 https://www.renren.io *

* This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. *

* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. *

* You should have received a copy of the GNU General Public License * along with this program. If not, see . */ package com.epmet.controller; import com.epmet.common.token.annotation.Login; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.StatsResiListFormDTO; import com.epmet.dto.form.StatsResiWarnFormDTO; import com.epmet.dto.result.IcStatsResiResultDTO; import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO; import com.epmet.dto.result.IcStatsResiWarnUserResultDTO; import com.epmet.service.IcStatsResiWarnService; import com.epmet.service.StatsResiWarnService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * 预警统计表 * * @author generator generator@elink-cn.com * @since v1.0.0 2021-11-04 */ @RestController @RequestMapping("statsresiwarn") public class StatsResiWarnController { @Autowired private IcStatsResiWarnService icStatsResiWarnService; @Autowired private StatsResiWarnService statsResiWarnService; @PostMapping("list") public Result list(@RequestBody StatsResiListFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO); List icStatsResiResultDTOList = statsResiWarnService.list(formDTO.getId(),formDTO.getLevel()); return new Result().ok(icStatsResiResultDTOList); } @PostMapping("buildingwarnlist") public Result buildingWarnList(@RequestBody StatsResiWarnFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedBuilding.class); String agencyID = formDTO.getAgencyId(); List icStatsResiWarnBuildingResultDTOS = statsResiWarnService.buildingwWarnList(agencyID); return new Result().ok(icStatsResiWarnBuildingResultDTOS); } @PostMapping("userwarnlist") public Result userWarnList(@RequestBody StatsResiWarnFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedUser.class); List buildingIdList = formDTO.getBuildingIdList(); if(CollectionUtils.isEmpty(buildingIdList)){ return new Result(); } List icStatsResiWarnUserResultDTOS = statsResiWarnService.userWarnList(formDTO.getConfigId(), formDTO.getBuildingIdList()); return new Result().ok(icStatsResiWarnUserResultDTOS); } /** * 统计 * @return */ @PostMapping("resiwarn") public Result resiWarn(@LoginUser TokenDto tokenDto){ statsResiWarnService.resiWarn(tokenDto.getCustomerId()); return new Result(); } }