|
|
|
/**
|
|
|
|
* 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.annotation.MaskResponse;
|
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode;
|
|
|
|
import com.epmet.commons.tools.exception.EpmetException;
|
|
|
|
import com.epmet.commons.tools.page.PageData;
|
|
|
|
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.commons.tools.validator.group.AddGroup;
|
|
|
|
import com.epmet.dto.form.IcUserWarnNoticeFormDTO;
|
|
|
|
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.dto.result.IcUserWarnNoticeResultDTO;
|
|
|
|
import com.epmet.dto.result.UserWarnNameListResultDTO;
|
|
|
|
import com.epmet.service.IcStatsResiWarnService;
|
|
|
|
import com.epmet.service.StatsResiWarnService;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
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();
|
|
|
|
if (StringUtils.isBlank(formDTO.getId()) && CollectionUtils.isEmpty(formDTO.getIdList())) {
|
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "id或者idList不能同时为空", "参数错误");
|
|
|
|
}
|
|
|
|
List<IcStatsResiResultDTO> icStatsResiResultDTOList = statsResiWarnService.list(customerId,formDTO.getId(),formDTO.getLevel(),formDTO.getIdList());
|
|
|
|
return new Result<List<IcStatsResiResultDTO>>().ok(icStatsResiResultDTOList);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @Description 内部调了list
|
|
|
|
* @param formDTO
|
|
|
|
* @author zxc
|
|
|
|
* @date 2022/1/20 2:11 下午
|
|
|
|
*/
|
|
|
|
@PostMapping("list2")
|
|
|
|
public Result<List<IcStatsResiResultDTO>> list2(@RequestBody StatsResiListFormDTO formDTO){
|
|
|
|
return new Result<List<IcStatsResiResultDTO>>().ok(statsResiWarnService.list2(formDTO));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 可视化分析-人员预警,各类别楼栋数量展示
|
|
|
|
* @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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 可视化分析-人员预警,楼栋列表展示
|
|
|
|
* @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()));
|
|
|
|
}
|
|
|
|
|
|
|
|
@MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD })
|
|
|
|
@PostMapping("alluserwarnlist")
|
|
|
|
public Result<PageData<UserWarnNameListResultDTO>> allUserWarnList(@LoginUser TokenDto tokenDto, @RequestBody StatsResiWarnFormDTO formDTO){
|
|
|
|
ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.AllUser.class);
|
|
|
|
formDTO.setCustomerId(tokenDto.getCustomerId());
|
|
|
|
return new Result<PageData<UserWarnNameListResultDTO>>().ok(statsResiWarnService.allUserWarnList(formDTO));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 统计所有
|
|
|
|
* @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();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 人员预警,通知列表
|
|
|
|
* @param tokenDto
|
|
|
|
* @param formDTO
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@PostMapping("queryuserwarnnotice")
|
|
|
|
public Result<List<IcUserWarnNoticeResultDTO>> queryUserWarnNotice(@LoginUser TokenDto tokenDto,@RequestBody IcUserWarnNoticeFormDTO formDTO){
|
|
|
|
formDTO.setCustomerId(tokenDto.getCustomerId());
|
|
|
|
ValidatorUtils.validateEntity(formDTO, AddGroup.class);
|
|
|
|
return new Result<List<IcUserWarnNoticeResultDTO>>().ok(statsResiWarnService.queryUserWarnNotice(formDTO));
|
|
|
|
}
|
|
|
|
}
|