Browse Source

人员预警列表

master
zhaoqifeng 3 years ago
parent
commit
21dd439cfd
  1. 10
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiWarnFormDTO.java
  2. 1
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnUserResultDTO.java
  3. 9
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserWarnNameListResultDTO.java
  4. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java
  5. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java
  6. 65
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java
  7. 4
      epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml

10
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiWarnFormDTO.java

@ -22,7 +22,6 @@ import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import java.util.List; import java.util.List;
@ -40,7 +39,7 @@ public class StatsResiWarnFormDTO implements Serializable {
public interface ListSelectedBuilding {} public interface ListSelectedBuilding {}
public interface ListSelectedUser {} public interface ListSelectedUser {}
public interface AllUser {}
/** /**
* 当前页 * 当前页
@ -57,10 +56,11 @@ public class StatsResiWarnFormDTO implements Serializable {
@NotBlank(message = "组织id不能为空",groups = {ListSelectedBuilding.class}) @NotBlank(message = "组织id不能为空",groups = {ListSelectedBuilding.class})
private String agencyId; private String agencyId;
@NotBlank(message = "配置id不能为空",groups = {ListSelectedUser.class}) @NotBlank(message = "配置id不能为空",groups = {ListSelectedUser.class, AllUser.class})
private String configId; private String configId;
@NotNull(message = "楼栋不能为空",groups = {ListSelectedUser.class}) @NotNull(message = "楼栋不能为空",groups = {ListSelectedUser.class})
private List<String> buildingIdList; private List<String> buildingIdList;
@NotBlank(message = "楼栋不能为空",groups = {AllUser.class})
private String buildingId;
private String customerId;
} }

1
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnUserResultDTO.java

@ -43,6 +43,7 @@ public class IcStatsResiWarnUserResultDTO implements Serializable {
private String neighborhoodName; private String neighborhoodName;
private String buildingName; private String buildingName;
private String residentNames; private String residentNames;
private Integer count;
private List<UserWarnNameListResultDTO> userList; private List<UserWarnNameListResultDTO> userList;
} }

9
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserWarnNameListResultDTO.java

@ -21,4 +21,13 @@ public class UserWarnNameListResultDTO implements Serializable {
private String residentName; private String residentName;
private String userId; private String userId;
@JsonIgnore
private String unitId;
private String unitName;
@JsonIgnore
private String homeId;
private String doorName;
private String mobile;
private String idCard;
} }

9
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java

@ -18,6 +18,7 @@
package com.epmet.controller; package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
@ -29,6 +30,7 @@ import com.epmet.dto.form.StatsResiWarnFormDTO;
import com.epmet.dto.result.IcStatsResiResultDTO; import com.epmet.dto.result.IcStatsResiResultDTO;
import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO; import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO;
import com.epmet.dto.result.IcUserWarnNoticeResultDTO; import com.epmet.dto.result.IcUserWarnNoticeResultDTO;
import com.epmet.dto.result.UserWarnNameListResultDTO;
import com.epmet.service.IcStatsResiWarnService; import com.epmet.service.IcStatsResiWarnService;
import com.epmet.service.StatsResiWarnService; import com.epmet.service.StatsResiWarnService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -115,6 +117,13 @@ public class StatsResiWarnController {
return new Result().ok(statsResiWarnService.userWarnList(customerId,formDTO.getConfigId(), formDTO.getBuildingIdList(),formDTO.getPageNo(),formDTO.getPageSize())); return new Result().ok(statsResiWarnService.userWarnList(customerId,formDTO.getConfigId(), formDTO.getBuildingIdList(),formDTO.getPageNo(),formDTO.getPageSize()));
} }
@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 * @return

5
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java

@ -17,11 +17,14 @@
package com.epmet.service; package com.epmet.service;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.IcUserWarnNoticeFormDTO; import com.epmet.dto.form.IcUserWarnNoticeFormDTO;
import com.epmet.dto.form.StatsResiListFormDTO; import com.epmet.dto.form.StatsResiListFormDTO;
import com.epmet.dto.form.StatsResiWarnFormDTO;
import com.epmet.dto.result.IcStatsResiResultDTO; import com.epmet.dto.result.IcStatsResiResultDTO;
import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO; import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO;
import com.epmet.dto.result.IcUserWarnNoticeResultDTO; import com.epmet.dto.result.IcUserWarnNoticeResultDTO;
import com.epmet.dto.result.UserWarnNameListResultDTO;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -53,6 +56,8 @@ public interface StatsResiWarnService{
*/ */
Map<String,Object> userWarnList(String customerId, String configId, List<String> buildingIdList, Integer pageNo, Integer pageSize); Map<String,Object> userWarnList(String customerId, String configId, List<String> buildingIdList, Integer pageNo, Integer pageSize);
PageData<UserWarnNameListResultDTO> allUserWarnList(StatsResiWarnFormDTO formDTO);
List<IcStatsResiResultDTO> list(String customerId,String id, String level); List<IcStatsResiResultDTO> list(String customerId,String id, String level);
List<IcStatsResiResultDTO> list2(StatsResiListFormDTO formDTO); List<IcStatsResiResultDTO> list2(StatsResiListFormDTO formDTO);

65
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java

@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis;
import com.epmet.commons.tools.redis.common.bean.BuildingInfoCache; import com.epmet.commons.tools.redis.common.bean.BuildingInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
@ -16,6 +18,7 @@ import com.epmet.dto.IcResiCategoryWarnConfigDTO;
import com.epmet.dto.form.IcResiCategoryStatsConfigFormDTO; import com.epmet.dto.form.IcResiCategoryStatsConfigFormDTO;
import com.epmet.dto.form.IcUserWarnNoticeFormDTO; import com.epmet.dto.form.IcUserWarnNoticeFormDTO;
import com.epmet.dto.form.StatsResiListFormDTO; import com.epmet.dto.form.StatsResiListFormDTO;
import com.epmet.dto.form.StatsResiWarnFormDTO;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.entity.IcResiUserEntity; import com.epmet.entity.IcResiUserEntity;
import com.epmet.entity.IcStatsResiWarnEntity; import com.epmet.entity.IcStatsResiWarnEntity;
@ -24,12 +27,13 @@ import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.IcStatsResiWarnService; import com.epmet.service.IcStatsResiWarnService;
import com.epmet.service.StatsResiWarnService; import com.epmet.service.StatsResiWarnService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -173,20 +177,18 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
//根据buildingID,tableName he columnName获取名字 //根据buildingID,tableName he columnName获取名字
//限制条数 一栋楼内最多显示1000 即可 //限制条数 一栋楼内最多显示1000 即可
for (String s : buildingIdList) { for (String s : buildingIdList) {
PageHelper.startPage(NumConstant.ONE,NumConstant.ONE_HUNDRED,false).doSelectPage(()->{ List<UserWarnNameListResultDTO> dtos = icStatsResiWarnDao.userWarnListDTO(customerId, Arrays.asList(s), icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName());
List<UserWarnNameListResultDTO> dtos = icStatsResiWarnDao.userWarnListDTO(customerId, Arrays.asList(s), icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); if (!CollectionUtils.isEmpty(dtos)){
if (!CollectionUtils.isEmpty(dtos)){ Map<String, List<UserWarnNameListResultDTO>> groupByBuild = dtos.stream().collect(Collectors.groupingBy(UserWarnNameListResultDTO::getBuildingId));
Map<String, List<UserWarnNameListResultDTO>> groupByBuild = dtos.stream().collect(Collectors.groupingBy(UserWarnNameListResultDTO::getBuildingId)); result.forEach(item->{
result.forEach(item->{ item.setConfigId(configId);
item.setConfigId(configId); groupByBuild.forEach((k,v) -> {
groupByBuild.forEach((k,v) -> { if (item.getBuildingId().equals(k)){
if (item.getBuildingId().equals(k)){ item.setCount(v.size());
item.setUserList(v); }
}
});
}); });
} });
}); }
} }
/*PageHelper.startPage(NumConstant.ONE,NumConstant.ONE_THOUSAND,false).doSelectPage(()->{ /*PageHelper.startPage(NumConstant.ONE,NumConstant.ONE_THOUSAND,false).doSelectPage(()->{
List<UserWarnNameListResultDTO> dtos = icStatsResiWarnDao.userWarnListDTO(customerId, buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); List<UserWarnNameListResultDTO> dtos = icStatsResiWarnDao.userWarnListDTO(customerId, buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName());
@ -205,6 +207,41 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
return mapResult; return mapResult;
} }
@Override
public PageData<UserWarnNameListResultDTO> allUserWarnList(StatsResiWarnFormDTO formDTO) {
//获取configId预警配置信息
IcResiCategoryWarnConfigDTO formDto = new IcResiCategoryWarnConfigDTO();
formDto.setId(formDTO.getConfigId());
Result<IcResiCategoryWarnConfigDTO> warnResult = operCustomizeOpenFeignClient.resiCategoryWarnInfoById(formDto);
if (!warnResult.success() || null == warnResult.getData()) {
throw new RenException("获取预警配置信息失败,configId="+ formDTO.getConfigId());
}
IcResiCategoryWarnConfigDTO icResiCategoryWarnConfigDTO = warnResult.getData();
PageHelper.startPage(formDTO.getPageNo(),formDTO.getPageSize());
List<UserWarnNameListResultDTO> list = icStatsResiWarnDao.userWarnListDTO(formDTO.getCustomerId(),
Collections.singletonList(formDTO.getBuildingId()),
icResiCategoryWarnConfigDTO.getTableName(),
icResiCategoryWarnConfigDTO.getColumnName());
PageInfo<UserWarnNameListResultDTO> pageInfo = new PageInfo<>(list);
if (CollectionUtils.isNotEmpty(list)) {
Set<String> homeIds = list.stream().map(UserWarnNameListResultDTO::getHomeId).collect(Collectors.toSet());
Result<List<HouseInfoDTO>> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(homeIds, formDTO.getCustomerId());
if (!houseInfoRes.success() || CollectionUtils.isEmpty(houseInfoRes.getData())){
throw new EpmetException("查询居民所属房屋失败...");
}
Map<String, HouseInfoDTO> houseMap = houseInfoRes.getData().stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity()));
list.forEach(item -> {
HouseInfoDTO houseInfo = houseMap.get(item.getHomeId());
if (null != houseInfo) {
item.setUnitName(houseInfo.getUnitName());
item.setDoorName(houseInfo.getDoorName());
}
});
}
return new PageData<>(list, pageInfo.getTotal());
}
@Override @Override
public List<IcStatsResiResultDTO> list(String customerId,String id, String level) { public List<IcStatsResiResultDTO> list(String customerId,String id, String level) {
//获取所有配置类项 getshow //获取所有配置类项 getshow

4
epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml

@ -153,6 +153,10 @@
<select id="userWarnListDTO" resultType="com.epmet.dto.result.UserWarnNameListResultDTO"> <select id="userWarnListDTO" resultType="com.epmet.dto.result.UserWarnNameListResultDTO">
select select
BUILD_ID as buildingId, BUILD_ID as buildingId,
UNIT_ID,
HOME_ID,
MOBILE,
ID_CARD,
name as residentName, name as residentName,
ID AS userId ID AS userId
from ic_resi_user from ic_resi_user

Loading…
Cancel
Save