|
@@ -6,6 +6,7 @@ import com.ningdatech.pmapi.common.constant.RegionConst; |
|
|
import com.ningdatech.pmapi.common.helper.RegionCacheHelper; |
|
|
import com.ningdatech.pmapi.common.helper.RegionCacheHelper; |
|
|
import com.ningdatech.pmapi.dashboard.model.entity.CockpitStats; |
|
|
import com.ningdatech.pmapi.dashboard.model.entity.CockpitStats; |
|
|
import com.ningdatech.pmapi.dashboard.model.vo.CockpitStatsVO; |
|
|
import com.ningdatech.pmapi.dashboard.model.vo.CockpitStatsVO; |
|
|
|
|
|
import com.ningdatech.pmapi.dashboard.service.ICockpitStatsService; |
|
|
import com.ningdatech.pmapi.sys.model.dto.RegionDTO; |
|
|
import com.ningdatech.pmapi.sys.model.dto.RegionDTO; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
@@ -14,6 +15,7 @@ import org.springframework.stereotype.Component; |
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
import java.util.Comparator; |
|
|
import java.util.Comparator; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
import java.util.Objects; |
|
|
import java.util.Objects; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@@ -30,6 +32,8 @@ public class CockpitStatsHandler { |
|
|
|
|
|
|
|
|
private final RegionCacheHelper regionCacheHelper; |
|
|
private final RegionCacheHelper regionCacheHelper; |
|
|
|
|
|
|
|
|
|
|
|
private final ICockpitStatsService cockpitStatsService; |
|
|
|
|
|
|
|
|
public CockpitStatsVO convertCockpitStats(CockpitStats cockpitStats) { |
|
|
public CockpitStatsVO convertCockpitStats(CockpitStats cockpitStats) { |
|
|
CockpitStatsVO res = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.class); |
|
|
CockpitStatsVO res = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.class); |
|
|
|
|
|
|
|
@@ -103,7 +107,7 @@ public class CockpitStatsHandler { |
|
|
|
|
|
|
|
|
private List<CockpitStatsVO.MapProjectsData> convertMapProjectsData(CockpitStats cockpitStats) { |
|
|
private List<CockpitStatsVO.MapProjectsData> convertMapProjectsData(CockpitStats cockpitStats) { |
|
|
List<CockpitStatsVO.MapProjectsData> mapProjectsDatas = Lists.newArrayList(); |
|
|
List<CockpitStatsVO.MapProjectsData> mapProjectsDatas = Lists.newArrayList(); |
|
|
List<RegionDTO> regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_COUNTY); |
|
|
|
|
|
|
|
|
List<RegionDTO> regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); |
|
|
regions = regions.stream().sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); |
|
|
regions = regions.stream().sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); |
|
|
for(RegionDTO region : regions){ |
|
|
for(RegionDTO region : regions){ |
|
|
CockpitStatsVO.MapProjectsData mapProjectsData = new CockpitStatsVO.MapProjectsData(); |
|
|
CockpitStatsVO.MapProjectsData mapProjectsData = new CockpitStatsVO.MapProjectsData(); |
|
@@ -128,14 +132,20 @@ public class CockpitStatsHandler { |
|
|
|
|
|
|
|
|
private List<CockpitStatsVO.ExpertRegion> buidExpertRegionData(CockpitStats cockpitStats) { |
|
|
private List<CockpitStatsVO.ExpertRegion> buidExpertRegionData(CockpitStats cockpitStats) { |
|
|
List<CockpitStatsVO.ExpertRegion> regionData = Lists.newArrayList(); |
|
|
List<CockpitStatsVO.ExpertRegion> regionData = Lists.newArrayList(); |
|
|
List<RegionDTO> regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_COUNTY); |
|
|
|
|
|
|
|
|
List<RegionDTO> regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); |
|
|
regions = regions.stream().sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); |
|
|
regions = regions.stream().sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
List<CockpitStats> cs = cockpitStatsService.list(); |
|
|
|
|
|
Map<String, Integer> csMap = cs.stream().collect(Collectors.toMap(c -> c.getRegionCode() + c.getYear(), CockpitStats::getExpertTotalNum)); |
|
|
for(RegionDTO region : regions){ |
|
|
for(RegionDTO region : regions){ |
|
|
CockpitStatsVO.ExpertRegion expertRegion = new CockpitStatsVO.ExpertRegion(); |
|
|
CockpitStatsVO.ExpertRegion expertRegion = new CockpitStatsVO.ExpertRegion(); |
|
|
expertRegion.setRegionCode(region.getRegionCode()); |
|
|
expertRegion.setRegionCode(region.getRegionCode()); |
|
|
expertRegion.setRegionName(region.getRegionName()); |
|
|
expertRegion.setRegionName(region.getRegionName()); |
|
|
//TODO: 区域数据 |
|
|
|
|
|
expertRegion.setExpertNum(0); |
|
|
|
|
|
|
|
|
if(csMap.containsKey(region.getRegionCode() + 0)){ |
|
|
|
|
|
expertRegion.setExpertNum(csMap.get(region.getRegionCode() + 0)); |
|
|
|
|
|
}else{ |
|
|
|
|
|
expertRegion.setExpertNum(0); |
|
|
|
|
|
} |
|
|
regionData.add(expertRegion); |
|
|
regionData.add(expertRegion); |
|
|
} |
|
|
} |
|
|
return regionData; |
|
|
return regionData; |
|
|