Browse Source

网格小组,话题

master
zxc 5 years ago
parent
commit
a7c16d2ae6
  1. 7
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubAgencyResultDTO.java
  2. 7
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubGridResultDTO.java
  3. 5
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/group/impl/GroupServiceImpl.java
  4. 30
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java
  5. 3
      epmet-module/data-report/data-report-server/src/main/resources/mapper/group/GroupDao.xml

7
epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubAgencyResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.topic.dto.result; package com.epmet.topic.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -32,4 +33,10 @@ public class TopicSubAgencyResultDTO implements Serializable {
* 机关Id * 机关Id
*/ */
private String agencyId; private String agencyId;
/**
* 排序
*/
@JsonIgnore
private Integer sort;
} }

7
epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubGridResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.topic.dto.result; package com.epmet.topic.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -32,4 +33,10 @@ public class TopicSubGridResultDTO implements Serializable {
* 网格Id * 网格Id
*/ */
private String gridId; private String gridId;
/**
* 排序
*/
@JsonIgnore
private Integer sort;
} }

5
epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/group/impl/GroupServiceImpl.java

@ -15,7 +15,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @Author zxc * @Author zxc
@ -60,7 +62,8 @@ public class GroupServiceImpl implements GroupService {
} }
}); });
}); });
return result; //倒序
return result.stream().sorted(Comparator.comparing(GroupSubAgencyResultDTO::getValue).reversed()).collect(Collectors.toList());
} }
return new ArrayList<>(); return new ArrayList<>();
} }

30
epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java

@ -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<>();

3
epmet-module/data-report/data-report-server/src/main/resources/mapper/group/GroupDao.xml

@ -59,6 +59,7 @@
fggd.del_flag = '0' fggd.del_flag = '0'
AND fggd.agency_id = #{agencyId} AND fggd.agency_id = #{agencyId}
AND fggd.date_id = (SELECT MAX(date_id) FROM fact_group_grid_daily WHERE del_flag = '0') AND fggd.date_id = (SELECT MAX(date_id) FROM fact_group_grid_daily WHERE del_flag = '0')
ORDER BY value DESC
</select> </select>
<!--小组数量 日增长--> <!--小组数量 日增长-->
@ -89,7 +90,7 @@
del_flag = '0' del_flag = '0'
AND agency_id = #{agencyId} AND agency_id = #{agencyId}
ORDER BY ORDER BY
month_id DESC month_id DESC, value DESC
LIMIT 12 LIMIT 12
</select> </select>

Loading…
Cancel
Save