|
|
@ -9,10 +9,8 @@ import com.epmet.dao.IcResiUserDao; |
|
|
|
import com.epmet.dao.IcStatsResiWarnDao; |
|
|
|
import com.epmet.dto.IcResiCategoryStatsConfigDTO; |
|
|
|
import com.epmet.dto.IcResiCategoryWarnConfigDTO; |
|
|
|
import com.epmet.dto.result.BuildingResultDTO; |
|
|
|
import com.epmet.dto.result.IcStatsResiResultDTO; |
|
|
|
import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO; |
|
|
|
import com.epmet.dto.result.IcStatsResiWarnUserResultDTO; |
|
|
|
import com.epmet.dto.form.IcResiCategoryStatsConfigFormDTO; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.IcResiUserEntity; |
|
|
|
import com.epmet.entity.IcStatsResiWarnEntity; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
@ -26,10 +24,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Optional; |
|
|
|
import java.util.*; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@ -54,8 +49,15 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { |
|
|
|
@Override |
|
|
|
public List<IcStatsResiWarnBuildingResultDTO> buildingwWarnList(String customerId,String agencyID) { |
|
|
|
List<IcStatsResiWarnBuildingResultDTO> result = new ArrayList<>(); |
|
|
|
//feign 获取当前配置类别列表
|
|
|
|
Result<List<IcResiCategoryStatsConfigDTO>> statsResult = operCustomizeOpenFeignClient.resiCategoryStatsListShowd(new IcResiCategoryStatsConfigFormDTO()); |
|
|
|
if (!statsResult.success() || null == statsResult.getData()) { |
|
|
|
throw new RenException("配置类别查询失败:"+ statsResult.getMsg()); |
|
|
|
} |
|
|
|
List<IcResiCategoryStatsConfigDTO> icResiCategoryStatsConfigDTOList = statsResult.getData(); |
|
|
|
//feign获取当前需要预警的配置信息以及阈值
|
|
|
|
Result<List<IcResiCategoryWarnConfigDTO>> warnResult = operCustomizeOpenFeignClient.resiCategoryWarnList(); |
|
|
|
|
|
|
|
if (!warnResult.success() || null == warnResult.getData()) { |
|
|
|
throw new RenException("预警配置查询失败:"+ warnResult.getMsg()); |
|
|
|
} |
|
|
@ -75,9 +77,20 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { |
|
|
|
resiWarnBuildingResultDTO.setLevelCount1(0); |
|
|
|
resiWarnBuildingResultDTO.setLevelCount2(0); |
|
|
|
resiWarnBuildingResultDTO.setLevelCount3(0); |
|
|
|
resiWarnBuildingResultDTO.setCount(0); |
|
|
|
resiWarnBuildingResultDTO.setBuildingIdList1(new ArrayList<>()); |
|
|
|
resiWarnBuildingResultDTO.setBuildingIdList2(new ArrayList<>()); |
|
|
|
resiWarnBuildingResultDTO.setBuildingIdList3(new ArrayList<>()); |
|
|
|
|
|
|
|
|
|
|
|
//获取各类别数量
|
|
|
|
List<IcResiCategoryStatsConfigDTO> collect = icResiCategoryStatsConfigDTOList.stream().filter(i -> i.getTableName().equals(item.getTableName()) && i.getColumnName().equals(item.getColumnName())).collect(Collectors.toList()); |
|
|
|
if(!CollectionUtils.isEmpty(collect)){ |
|
|
|
resiWarnBuildingResultDTO.setManagementIcon(collect.get(0).getManagementIcon()); |
|
|
|
resiWarnBuildingResultDTO.setDataIcon(collect.get(0).getDataIcon()); |
|
|
|
resiWarnBuildingResultDTO.setHouseShowIcon(collect.get(0).getHouseShowIcon()); |
|
|
|
} |
|
|
|
|
|
|
|
return resiWarnBuildingResultDTO; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
//统计数量
|
|
|
@ -87,13 +100,17 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { |
|
|
|
} |
|
|
|
Map<String,IcStatsResiWarnBuildingResultDTO> warnResultMap = result.stream().collect(Collectors.toMap(IcStatsResiWarnBuildingResultDTO::getConfigId, Function.identity(),(k1, k2)->k1)); |
|
|
|
for (IcStatsResiWarnEntity item : icStatsResiWarnEntityList) { |
|
|
|
IcStatsResiWarnBuildingResultDTO resiWarnBuildingResultDTO = warnResultMap.get(item.getConfigId()); |
|
|
|
|
|
|
|
|
|
|
|
//每栋楼的数量
|
|
|
|
Integer count = Optional.ofNullable(item.getCount()).orElse(0); |
|
|
|
IcStatsResiWarnBuildingResultDTO resiWarnBuildingResultDTO = warnResultMap.get(item.getConfigId()); |
|
|
|
|
|
|
|
//判断数量
|
|
|
|
Integer levle1= resiWarnBuildingResultDTO.getLevel1(); |
|
|
|
Integer levle2= resiWarnBuildingResultDTO.getLevel2(); |
|
|
|
Integer levle3= resiWarnBuildingResultDTO.getLevel3(); |
|
|
|
resiWarnBuildingResultDTO.setCount(resiWarnBuildingResultDTO.getCount()+count); |
|
|
|
if(0 == count){ |
|
|
|
continue; |
|
|
|
} |
|
|
@ -115,17 +132,20 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<IcStatsResiWarnUserResultDTO> userWarnList(String customerId,String configId, List<String> buildingIdList) { |
|
|
|
public Map<String,Object> userWarnList(String customerId,String configId, List<String> buildingIdList,Integer pageNo,Integer pageSize) { |
|
|
|
//feign根据buildingIdList 获取网格,小区,楼宇 信息
|
|
|
|
Result<List<BuildingResultDTO>> buildingList = govOrgOpenFeignClient.buildingListByIds(buildingIdList); |
|
|
|
if (!buildingList.success() || null == buildingList.getData()) { |
|
|
|
Result<BuildingResultPagedDTO> buildingPageList = govOrgOpenFeignClient.buildinglistbyidsPage(buildingIdList,pageNo,pageSize); |
|
|
|
if (!buildingPageList.success() || null == buildingPageList.getData()) { |
|
|
|
throw new RenException("楼宇信息查询失败,buildingList="+ JSON.toJSONString(buildingIdList)); |
|
|
|
} |
|
|
|
List<BuildingResultDTO> buildingResultDTOList = buildingList.getData(); |
|
|
|
|
|
|
|
BuildingResultPagedDTO pageData = buildingPageList.getData(); |
|
|
|
List<BuildingResultDTO> buildingResultDTOList = pageData.getList(); |
|
|
|
List<IcStatsResiWarnUserResultDTO> result = ConvertUtils.sourceToTarget(buildingResultDTOList,IcStatsResiWarnUserResultDTO.class); |
|
|
|
Map<String,Object> mapResult = new HashMap<>(); |
|
|
|
mapResult.put("total",pageData.getTotal()); |
|
|
|
mapResult.put("list",result); |
|
|
|
if(CollectionUtils.isEmpty(result)){ |
|
|
|
return new ArrayList<>(); |
|
|
|
return mapResult; |
|
|
|
} |
|
|
|
//获取configId预警配置信息
|
|
|
|
IcResiCategoryWarnConfigDTO formDto = new IcResiCategoryWarnConfigDTO(); |
|
|
@ -143,13 +163,16 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { |
|
|
|
List<Map<String, String>> buildingIds = maps.stream().filter(map -> item.getBuildingId().equals(map.get("buildingId"))).collect(Collectors.toList()); |
|
|
|
item.setResidentNames(CollectionUtils.isEmpty(buildingIds)?"":buildingIds.get(0).get("residentNames")); |
|
|
|
}); |
|
|
|
return result; |
|
|
|
|
|
|
|
return mapResult; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<IcStatsResiResultDTO> list(String customerId,String id, String level) { |
|
|
|
//获取所有配置类项 getshow
|
|
|
|
Result<List<IcResiCategoryStatsConfigDTO>> statsResult = operCustomizeOpenFeignClient.resiCategoryStatsListShowd(); |
|
|
|
IcResiCategoryStatsConfigFormDTO dto = new IcResiCategoryStatsConfigFormDTO(); |
|
|
|
dto.setStatus("show"); |
|
|
|
Result<List<IcResiCategoryStatsConfigDTO>> statsResult = operCustomizeOpenFeignClient.resiCategoryStatsListShowd(dto); |
|
|
|
if (!statsResult.success() || null == statsResult.getData()) { |
|
|
|
throw new RenException("获取配置类项失败"); |
|
|
|
} |
|
|
|