Compare commits

..

No commits in common. "23300d6ff70aaacae0815e6da42a3f8005d2ad6c" and "8d8238d7e65fb350ea5c832ca0094a3a0bb96baf" have entirely different histories.

1 changed files with 17 additions and 18 deletions

View File

@ -719,8 +719,6 @@ 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() {{
@ -732,12 +730,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);
logger.error("", e);
throw new RuntimeException(e);
} catch (ExecutionException e) {
logger.error("异步获取数据失败", e);
logger.error("", e);
throw new RuntimeException(e);
}
Integer county_apply_sum = resultList1.stream().filter(index -> index.containsKey("level") && "county".equals(index.get("level").toString()))
@ -750,11 +748,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;
Integer county_resource_month_change;
Integer county_resource_weekly_change = 0;
Integer county_resource_month_change = 0;
Integer municipal_resource_weekly_change;
Integer municipal_resource_month_change;
Integer municipal_resource_weekly_change = 0;
Integer municipal_resource_month_change = 0;
SysDateSnapshotDTO resource_weekly = sysDateSnapshotService.selectForFlag(SnapshotType.RESOURCE_WEEKLY.getFlag()); // 最近的上架周快照
SysDateSnapshotDTO resource_month = sysDateSnapshotService.selectForFlag(SnapshotType.RESOURCE_MONTH.getFlag()); // 最近的上架月快照
@ -773,6 +771,7 @@ 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;
@ -784,16 +783,17 @@ 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;
Integer county_apply_month_change;
Integer county_apply_weekly_change = 0;
Integer county_apply_month_change = 0;
Integer municipal_apply_weekly_change;
Integer municipal_apply_month_change;
Integer municipal_apply_weekly_change = 0;
Integer municipal_apply_month_change = 0;
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,6 +806,7 @@ 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;
@ -822,13 +823,11 @@ 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", finalCounty_dept_count);
put("dept_count", sysDeptService.countByType(3).longValue());
put("apply_sum", county_apply_sum);
put("resource_sum", county_resource_sum);
put("resource_weekly_change", finalCounty_resource_weekly_change);
@ -839,7 +838,7 @@ public class CensusController {
add(new LinkedHashMap<String, Object>() {{
put("tip", "市级部门");
put("level", "municipal");
put("dept_count", finalMunicipal_dept_count);
put("dept_count", sysDeptService.countByType(2).longValue());
put("apply_sum", municipal_apply_sum);
put("resource_sum", municipal_resource_sum);
put("resource_weekly_change", finalMunicipal_resource_weekly_change);