Compare commits
3 Commits
8d8238d7e6
...
23300d6ff7
Author | SHA1 | Date |
---|---|---|
wangliwen | 23300d6ff7 | |
wangliwen | e70ef99201 | |
wangliwen | c0042b8adc |
|
@ -719,6 +719,8 @@ public class CensusController {
|
|||
public Result similitudeDept() {
|
||||
List<HashMap<String, Object>> resultList1 = new ArrayList<>();
|
||||
List<HashMap<String, Object>> resultList2 = new ArrayList<>();
|
||||
Long county_dept_count = 0l;
|
||||
Long municipal_dept_count = 0l;
|
||||
try {
|
||||
resultList1 = CompletableFuture.supplyAsync(() -> {
|
||||
return (List<HashMap<String, Object>>) resourceService.selectApplyDeptDetailTypeCountList(new HashMap() {{
|
||||
|
@ -730,12 +732,12 @@ public class CensusController {
|
|||
put("snapshot", true);
|
||||
}}); // 能力上架统计原始数据
|
||||
}, executor).get();
|
||||
county_dept_count = CompletableFuture.supplyAsync(() -> sysDeptService.countByType(3), executor).get();
|
||||
municipal_dept_count = CompletableFuture.supplyAsync(() -> sysDeptService.countByType(2), executor).get();
|
||||
} catch (InterruptedException e) {
|
||||
logger.error("", e);
|
||||
throw new RuntimeException(e);
|
||||
logger.error("异步获取数据失败", e);
|
||||
} catch (ExecutionException e) {
|
||||
logger.error("", e);
|
||||
throw new RuntimeException(e);
|
||||
logger.error("异步获取数据失败", e);
|
||||
}
|
||||
|
||||
Integer county_apply_sum = resultList1.stream().filter(index -> index.containsKey("level") && "county".equals(index.get("level").toString()))
|
||||
|
@ -748,11 +750,11 @@ public class CensusController {
|
|||
Integer municipal_resource_sum = resultList2.stream().filter(index -> index.containsKey("level") && "municipal".equals(index.get("level").toString()))
|
||||
.mapToInt(index -> Integer.valueOf(index.get("count").toString())).sum(); // 市上架总量
|
||||
|
||||
Integer county_resource_weekly_change = 0;
|
||||
Integer county_resource_month_change = 0;
|
||||
Integer county_resource_weekly_change;
|
||||
Integer county_resource_month_change;
|
||||
|
||||
Integer municipal_resource_weekly_change = 0;
|
||||
Integer municipal_resource_month_change = 0;
|
||||
Integer municipal_resource_weekly_change;
|
||||
Integer municipal_resource_month_change;
|
||||
|
||||
SysDateSnapshotDTO resource_weekly = sysDateSnapshotService.selectForFlag(SnapshotType.RESOURCE_WEEKLY.getFlag()); // 最近的上架周快照
|
||||
SysDateSnapshotDTO resource_month = sysDateSnapshotService.selectForFlag(SnapshotType.RESOURCE_MONTH.getFlag()); // 最近的上架月快照
|
||||
|
@ -771,7 +773,6 @@ public class CensusController {
|
|||
int temp = resource_month.getSnapshot().stream().filter(index -> index.containsKey("level") && "county".equals(index.get("level").toString()))
|
||||
.mapToInt(index -> Integer.valueOf(index.get("count").toString())).sum(); // 区上架总量
|
||||
county_resource_month_change = county_resource_sum - temp;
|
||||
|
||||
temp = resource_month.getSnapshot().stream().filter(index -> index.containsKey("level") && "municipal".equals(index.get("level").toString()))
|
||||
.mapToInt(index -> Integer.valueOf(index.get("count").toString())).sum(); // 市上架总量
|
||||
municipal_resource_month_change = municipal_resource_sum - temp;
|
||||
|
@ -783,17 +784,16 @@ public class CensusController {
|
|||
SysDateSnapshotDTO apply_weekly = sysDateSnapshotService.selectForFlag(SnapshotType.APPLY_WEEKLY.getFlag()); // 最近的申请周快照
|
||||
SysDateSnapshotDTO apply_month = sysDateSnapshotService.selectForFlag(SnapshotType.APPLY_MONTH.getFlag()); // 最近的申请月快照
|
||||
|
||||
Integer county_apply_weekly_change = 0;
|
||||
Integer county_apply_month_change = 0;
|
||||
Integer county_apply_weekly_change;
|
||||
Integer county_apply_month_change;
|
||||
|
||||
Integer municipal_apply_weekly_change = 0;
|
||||
Integer municipal_apply_month_change = 0;
|
||||
Integer municipal_apply_weekly_change;
|
||||
Integer municipal_apply_month_change;
|
||||
|
||||
if (apply_weekly != null) {
|
||||
int temp = apply_weekly.getSnapshot().stream().filter(index -> index.containsKey("level") && "county".equals(index.get("level").toString()))
|
||||
.mapToInt(index -> Integer.valueOf(index.get("count").toString())).sum(); // 区申请总量
|
||||
county_apply_weekly_change = county_apply_sum - temp;
|
||||
|
||||
temp = apply_weekly.getSnapshot().stream().filter(index -> index.containsKey("level") && "municipal".equals(index.get("level").toString()))
|
||||
.mapToInt(index -> Integer.valueOf(index.get("count").toString())).sum(); // 市申请总量
|
||||
municipal_apply_weekly_change = municipal_apply_sum - temp;
|
||||
|
@ -806,7 +806,6 @@ public class CensusController {
|
|||
int temp = apply_month.getSnapshot().stream().filter(index -> index.containsKey("level") && "county".equals(index.get("level").toString()))
|
||||
.mapToInt(index -> Integer.valueOf(index.get("count").toString())).sum(); // 区申请总量
|
||||
county_apply_month_change = county_apply_sum - temp;
|
||||
|
||||
temp = apply_month.getSnapshot().stream().filter(index -> index.containsKey("level") && "municipal".equals(index.get("level").toString()))
|
||||
.mapToInt(index -> Integer.valueOf(index.get("count").toString())).sum(); // 市申请总量
|
||||
municipal_apply_month_change = municipal_apply_sum - temp;
|
||||
|
@ -823,11 +822,13 @@ public class CensusController {
|
|||
Integer finalMunicipal_apply_weekly_change = municipal_apply_weekly_change;
|
||||
Integer finalMunicipal_apply_month_change = municipal_apply_month_change;
|
||||
Integer finalCounty_apply_month_change = county_apply_month_change;
|
||||
Long finalCounty_dept_count = county_dept_count;
|
||||
Long finalMunicipal_dept_count = municipal_dept_count;
|
||||
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>() {{
|
||||
add(new LinkedHashMap<String, Object>() {{
|
||||
put("tip", "区市部门");
|
||||
put("level", "county");
|
||||
put("dept_count", sysDeptService.countByType(3).longValue());
|
||||
put("dept_count", finalCounty_dept_count);
|
||||
put("apply_sum", county_apply_sum);
|
||||
put("resource_sum", county_resource_sum);
|
||||
put("resource_weekly_change", finalCounty_resource_weekly_change);
|
||||
|
@ -838,7 +839,7 @@ public class CensusController {
|
|||
add(new LinkedHashMap<String, Object>() {{
|
||||
put("tip", "市级部门");
|
||||
put("level", "municipal");
|
||||
put("dept_count", sysDeptService.countByType(2).longValue());
|
||||
put("dept_count", finalMunicipal_dept_count);
|
||||
put("apply_sum", municipal_apply_sum);
|
||||
put("resource_sum", municipal_resource_sum);
|
||||
put("resource_weekly_change", finalMunicipal_resource_weekly_change);
|
||||
|
|
Loading…
Reference in New Issue