Przeglądaj źródła

绩效改为星级

tags/24080901
PoffyZhang 1 rok temu
rodzic
commit
4a75ef42a9
2 zmienionych plików z 15 dodań i 5 usunięć
  1. +14
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/CockpitStatsHandler.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java

+ 14
- 4
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/handle/CockpitStatsHandler.java Wyświetl plik

@@ -6,6 +6,7 @@ import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.common.helper.RegionCacheHelper;
import com.ningdatech.pmapi.dashboard.model.entity.CockpitStats;
import com.ningdatech.pmapi.dashboard.model.vo.CockpitStatsVO;
import com.ningdatech.pmapi.dashboard.service.ICockpitStatsService;
import com.ningdatech.pmapi.sys.model.dto.RegionDTO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -14,6 +15,7 @@ import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

@@ -30,6 +32,8 @@ public class CockpitStatsHandler {

private final RegionCacheHelper regionCacheHelper;

private final ICockpitStatsService cockpitStatsService;

public CockpitStatsVO convertCockpitStats(CockpitStats cockpitStats) {
CockpitStatsVO res = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.class);

@@ -103,7 +107,7 @@ public class CockpitStatsHandler {

private List<CockpitStatsVO.MapProjectsData> convertMapProjectsData(CockpitStats cockpitStats) {
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());
for(RegionDTO region : regions){
CockpitStatsVO.MapProjectsData mapProjectsData = new CockpitStatsVO.MapProjectsData();
@@ -128,14 +132,20 @@ public class CockpitStatsHandler {

private List<CockpitStatsVO.ExpertRegion> buidExpertRegionData(CockpitStats cockpitStats) {
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());

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){
CockpitStatsVO.ExpertRegion expertRegion = new CockpitStatsVO.ExpertRegion();
expertRegion.setRegionCode(region.getRegionCode());
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);
}
return regionData;


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java Wyświetl plik

@@ -103,7 +103,7 @@ public class CockpitStatsStatisticsTask {
DashboardConstant.CockpitStats.TOTAL,year));
}

List<RegionDTO> regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_COUNTY);
List<RegionDTO> regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY);

for(RegionDTO regionDto : regions){
res.add(statisticsData(regionDto.getRegionCode(),regionDto.getRegionName(),0));


Ładowanie…
Anuluj
Zapisz