|
|
|
|
@ -18,6 +18,7 @@ import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Optional; |
|
|
|
|
import java.util.function.BiConsumer; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
@ -52,8 +53,6 @@ public class DataGobalController {
|
|
|
|
|
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { |
|
|
|
|
// 获取数据大屏中央总数概览
|
|
|
|
|
JSONObject overview = dataGobalService.getAllGobalCount(beginTime, endTime); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject data = new JSONObject() |
|
|
|
|
.fluentPut("overview", overview); |
|
|
|
|
return Result.success(data); |
|
|
|
|
@ -66,49 +65,23 @@ public class DataGobalController {
|
|
|
|
|
* @param year |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Operation(summary = "数据大屏问题趋势统计(按年展示)") |
|
|
|
|
@Operation(summary = "数据大屏问题趋势统计") |
|
|
|
|
@GetMapping("/getGobalRecentlyTrendByMonth") |
|
|
|
|
public Result<JSONObject> getGobalRecentlyTrendByMonth(@RequestParam Integer year) { |
|
|
|
|
List<RecentTrendByMonthVo> recentTrendVoList = dataGobalService.getGobalRecentlyTrendByMonth(String.valueOf(year)); |
|
|
|
|
ArrayList<String> monthList = new ArrayList<>(); |
|
|
|
|
ArrayList<String> totalList = new ArrayList<>(); |
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); |
|
|
|
|
// 要展示到的月份 从那个月开始
|
|
|
|
|
YearMonth endMonth = YearMonth.of(year, new Date().getMonth()); |
|
|
|
|
YearMonth startMonth = YearMonth.of(year, 1); |
|
|
|
|
for (RecentTrendByMonthVo recentTrendByMonthVo : recentTrendVoList) { |
|
|
|
|
YearMonth trendMonth = YearMonth.parse(recentTrendByMonthVo.getMonthTime(), formatter); |
|
|
|
|
|
|
|
|
|
while (startMonth.isBefore(trendMonth)) { |
|
|
|
|
String res = startMonth.format(formatter); |
|
|
|
|
monthList.add(res); // 添加到monthList
|
|
|
|
|
totalList.add("0"); // 插入没有数据的月份,总数为0
|
|
|
|
|
startMonth = startMonth.plusMonths(1); |
|
|
|
|
} |
|
|
|
|
String res = trendMonth.format(formatter); |
|
|
|
|
monthList.add(res); |
|
|
|
|
totalList.add(recentTrendByMonthVo.getTotal()); |
|
|
|
|
startMonth = trendMonth.plusMonths(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 添加从最后一个有数据的月份到当前月份的缺失月份
|
|
|
|
|
while (!startMonth.isAfter(endMonth)) { |
|
|
|
|
String res = startMonth.format(formatter); |
|
|
|
|
monthList.add(res); // 添加到monthList
|
|
|
|
|
totalList.add("0"); // 插入没有数据的月份,总数为0
|
|
|
|
|
startMonth = startMonth.plusMonths(1); |
|
|
|
|
} |
|
|
|
|
// 截取月份
|
|
|
|
|
List<String> monthOnlyList = monthList.stream() |
|
|
|
|
.map(date -> date.substring(date.indexOf('-') + 1) + "月") |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
List<EchartsVo> gobalRecentlyTrendList = dataGobalService.getGobalRecentlyTrendByMonth(String.valueOf(year)); |
|
|
|
|
JSONObject jsonObject = new JSONObject() |
|
|
|
|
.fluentPut("monthList", monthOnlyList) |
|
|
|
|
.fluentPut("totalList", totalList); |
|
|
|
|
.fluentPut("gobalRecentlyTrendList", gobalRecentlyTrendList); |
|
|
|
|
return Result.success(jsonObject); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 机构问题排名 |
|
|
|
|
* |
|
|
|
|
* @param beginTime |
|
|
|
|
* @param endTime |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Operation(summary = "机构问题排名") |
|
|
|
|
@GetMapping("/getOrganizationRank") |
|
|
|
|
public Result<JSONObject> getOrganizationRank(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, |
|
|
|
|
@ -124,6 +97,13 @@ public class DataGobalController {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 业务类型占比 |
|
|
|
|
* |
|
|
|
|
* @param beginTime |
|
|
|
|
* @param endTime |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Operation(summary = "业务类型占比") |
|
|
|
|
@GetMapping("/getBusinessRate") |
|
|
|
|
public Result<JSONObject> getBusinessRate(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, |
|
|
|
|
@ -135,6 +115,13 @@ public class DataGobalController {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 突出问题排名 |
|
|
|
|
* |
|
|
|
|
* @param beginTime |
|
|
|
|
* @param endTime |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Operation(summary = "突出问题排名") |
|
|
|
|
@GetMapping("/getStrongProblemRate") |
|
|
|
|
public Result<JSONObject> getStrongProblemRate(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, |
|
|
|
|
@ -147,6 +134,13 @@ public class DataGobalController {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 问题类型占比 |
|
|
|
|
* |
|
|
|
|
* @param beginTime |
|
|
|
|
* @param endTime |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Operation(summary = "问题类型占比") |
|
|
|
|
@GetMapping("/getProblemBusinessRate") |
|
|
|
|
public Result<JSONObject> getProblemBusinessRate(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, |
|
|
|
|
@ -160,20 +154,26 @@ public class DataGobalController {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 地图数据 |
|
|
|
|
* |
|
|
|
|
* @param beginTime |
|
|
|
|
* @param endTime |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Operation(summary = "地图数据") |
|
|
|
|
@GetMapping("/getMap") |
|
|
|
|
public Result<JSONObject> getMap( |
|
|
|
|
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, |
|
|
|
|
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { |
|
|
|
|
public Result<JSONObject> getMap(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, |
|
|
|
|
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { |
|
|
|
|
|
|
|
|
|
// 地图数据
|
|
|
|
|
List<GobalMapIconVo> gobalTempMapVoList = dataGobalService.getMapIconInfo(beginTime, endTime); |
|
|
|
|
if (gobalTempMapVoList == null || gobalTempMapVoList.size() == 0) { |
|
|
|
|
gobalTempMapVoList = new ArrayList<>(); |
|
|
|
|
} |
|
|
|
|
List<GobalMapIconVo> gobalTempMapVoList = Optional.ofNullable(dataGobalService.getMapIconInfo(beginTime, endTime)). |
|
|
|
|
orElseGet(ArrayList::new); |
|
|
|
|
JSONObject data = new JSONObject() |
|
|
|
|
.fluentPut("gobalTempMapVoList", gobalTempMapVoList); |
|
|
|
|
return Result.success(data); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|