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.

131 lines
5.0 KiB

/**
* 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.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.StatsResiWarnCountFormDTO;
import com.epmet.dto.form.StatsResiWarnFormDTO;
import com.epmet.dto.result.IcStatsResiResultDTO;
import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO;
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.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 预警统计表
*
* @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<IcStatsResiResultDTO>> list(@LoginUser TokenDto tokenDto,@RequestBody StatsResiListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
String customerId = tokenDto.getCustomerId();
List<IcStatsResiResultDTO> icStatsResiResultDTOList = statsResiWarnService.list(customerId,formDTO.getId(),formDTO.getLevel());
return new Result<List<IcStatsResiResultDTO>>().ok(icStatsResiResultDTOList);
}
/**
* @Description 内部调了list
* @param formDTO
* @author zxc
* @date 2022/1/20 2:11 下午
*/
@PostMapping("list2")
4 years ago
public Result<List<IcStatsResiResultDTO>> list2(@RequestBody StatsResiListFormDTO formDTO){
return new Result<List<IcStatsResiResultDTO>>().ok(statsResiWarnService.list2(formDTO));
}
4 years ago
/**
* 可视化分析-人员预警各类别楼栋数量展示
* @param tokenDto
* @param formDTO 只有agencyId
* @return
*/
@PostMapping("buildingwarnlist")
public Result buildingWarnList(@LoginUser TokenDto tokenDto,@RequestBody StatsResiWarnFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedBuilding.class);
String customerId = tokenDto.getCustomerId();
String agencyID = formDTO.getAgencyId();
List<IcStatsResiWarnBuildingResultDTO> icStatsResiWarnBuildingResultDTOS = statsResiWarnService.buildingwWarnList(customerId,agencyID);
return new Result().ok(icStatsResiWarnBuildingResultDTOS);
}
4 years ago
/**
* 可视化分析-人员预警楼栋列表展示
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("userwarnlist")
public Result userWarnList(@LoginUser TokenDto tokenDto,@RequestBody StatsResiWarnFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedUser.class);
String customerId = tokenDto.getCustomerId();
List<String> buildingIdList = formDTO.getBuildingIdList();
if(CollectionUtils.isEmpty(buildingIdList)){
Map<String,Object> map = new HashMap<>();
map.put("total",0);
map.put("list",new ArrayList<>());
return new Result().ok(map);
}
return new Result().ok(statsResiWarnService.userWarnList(customerId,formDTO.getConfigId(), formDTO.getBuildingIdList(),formDTO.getPageNo(),formDTO.getPageSize()));
}
/**
* 统计所有
* @return
*/
@PostMapping("resiwarn")
public Result resiWarn(@LoginUser TokenDto tokenDto){
statsResiWarnService.resiWarn(tokenDto.getCustomerId());
return new Result();
}
@PostMapping("resiWarnByOne")
public Result resiWarnByOne(@LoginUser TokenDto tokenDto,@RequestBody StatsResiWarnCountFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
statsResiWarnService.resiWarnByOne(tokenDto.getCustomerId(),formDTO.getUserId());
return new Result();
}
}