forked from luyan/epmet-cloud-lingshan
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.
95 lines
3.6 KiB
95 lines
3.6 KiB
4 years ago
|
/**
|
||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||
|
* <p>
|
||
|
* 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.
|
||
|
* <p>
|
||
|
* 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.
|
||
|
* <p>
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
|
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<IcStatsResiResultDTO> 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<IcStatsResiWarnBuildingResultDTO> icStatsResiWarnBuildingResultDTOS = statsResiWarnService.buildingwWarnList(agencyID);
|
||
|
return new Result().ok(icStatsResiWarnBuildingResultDTOS);
|
||
|
|
||
|
}
|
||
|
@PostMapping("userwarnlist")
|
||
|
public Result userWarnList(@RequestBody StatsResiWarnFormDTO formDTO){
|
||
|
ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedUser.class);
|
||
|
List<String> buildingIdList = formDTO.getBuildingIdList();
|
||
|
if(CollectionUtils.isEmpty(buildingIdList)){
|
||
|
return new Result();
|
||
|
}
|
||
|
List<IcStatsResiWarnUserResultDTO> 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();
|
||
|
}
|
||
|
|
||
|
}
|