|
@ -14,9 +14,7 @@ import org.springframework.beans.BeanUtils; |
|
|
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 java.util.ArrayList; |
|
|
import java.util.*; |
|
|
import java.util.Comparator; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -94,6 +92,7 @@ public class TopicServiceImpl implements TopicService { |
|
|
public List<TopicSubGridResultDTO> topicSubGrid(TokenDto tokenDto) { |
|
|
public List<TopicSubGridResultDTO> topicSubGrid(TokenDto tokenDto) { |
|
|
String agencyId = this.getLoginUserDetails(tokenDto); |
|
|
String agencyId = this.getLoginUserDetails(tokenDto); |
|
|
List<TopicSubGridResultDTO> result = new ArrayList<>(); |
|
|
List<TopicSubGridResultDTO> result = new ArrayList<>(); |
|
|
|
|
|
List<TopicSubGridResultDTO> resultAll = new ArrayList<>(); |
|
|
List<String> subGridIdList = topicDao.getSubGridIdList(agencyId); |
|
|
List<String> subGridIdList = topicDao.getSubGridIdList(agencyId); |
|
|
if (subGridIdList.size() != NumConstant.ZERO){ |
|
|
if (subGridIdList.size() != NumConstant.ZERO){ |
|
|
List<TopicSubGridResultDTO> gridAllTopicInfoLastDay = topicDao.getGridAllTopicInfoLastDay(); |
|
|
List<TopicSubGridResultDTO> gridAllTopicInfoLastDay = topicDao.getGridAllTopicInfoLastDay(); |
|
@ -110,7 +109,17 @@ public class TopicServiceImpl implements TopicService { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
return result; |
|
|
Map<String, List<TopicSubGridResultDTO>> collect = result.stream().collect(Collectors.groupingBy(TopicSubGridResultDTO::getGridId)); |
|
|
|
|
|
Set<Map.Entry<String, List<TopicSubGridResultDTO>>> entries = collect.entrySet(); |
|
|
|
|
|
entries.forEach(entry -> { |
|
|
|
|
|
List<TopicSubGridResultDTO> value = entry.getValue(); |
|
|
|
|
|
Integer sort = value.stream().collect(Collectors.summingInt(TopicSubGridResultDTO::getValue)); |
|
|
|
|
|
value.forEach(v -> { |
|
|
|
|
|
v.setSort(sort); |
|
|
|
|
|
resultAll.add(v); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
return resultAll.stream().sorted(Comparator.comparing(TopicSubGridResultDTO::getSort).reversed()).collect(Collectors.toList()); |
|
|
} |
|
|
} |
|
|
return new ArrayList<>(); |
|
|
return new ArrayList<>(); |
|
|
} |
|
|
} |
|
@ -124,6 +133,7 @@ public class TopicServiceImpl implements TopicService { |
|
|
public List<TopicSubAgencyResultDTO> topicSubAgency(TokenDto tokenDto) { |
|
|
public List<TopicSubAgencyResultDTO> topicSubAgency(TokenDto tokenDto) { |
|
|
String agencyId = this.getLoginUserDetails(tokenDto); |
|
|
String agencyId = this.getLoginUserDetails(tokenDto); |
|
|
List<TopicSubAgencyResultDTO> result = new ArrayList<>(); |
|
|
List<TopicSubAgencyResultDTO> result = new ArrayList<>(); |
|
|
|
|
|
List<TopicSubAgencyResultDTO> resultAll = new ArrayList<>(); |
|
|
List<String> subAgencyIdList = topicDao.getSubAgencyIdList(agencyId); |
|
|
List<String> subAgencyIdList = topicDao.getSubAgencyIdList(agencyId); |
|
|
//存在下级机关
|
|
|
//存在下级机关
|
|
|
if (subAgencyIdList.size() != NumConstant.ZERO){ |
|
|
if (subAgencyIdList.size() != NumConstant.ZERO){ |
|
@ -142,7 +152,17 @@ public class TopicServiceImpl implements TopicService { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
return result; |
|
|
Map<String, List<TopicSubAgencyResultDTO>> collect = result.stream().collect(Collectors.groupingBy(TopicSubAgencyResultDTO::getAgencyId)); |
|
|
|
|
|
Set<Map.Entry<String, List<TopicSubAgencyResultDTO>>> entries = collect.entrySet(); |
|
|
|
|
|
entries.forEach(entry -> { |
|
|
|
|
|
List<TopicSubAgencyResultDTO> value = entry.getValue(); |
|
|
|
|
|
Integer sort = value.stream().collect(Collectors.summingInt(TopicSubAgencyResultDTO::getValue)); |
|
|
|
|
|
value.forEach(v -> { |
|
|
|
|
|
v.setSort(sort); |
|
|
|
|
|
resultAll.add(v); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
return resultAll.stream().sorted(Comparator.comparing(TopicSubAgencyResultDTO::getSort).reversed()).collect(Collectors.toList()); |
|
|
} |
|
|
} |
|
|
//不存在
|
|
|
//不存在
|
|
|
return new ArrayList<>(); |
|
|
return new ArrayList<>(); |
|
|