|
|
@@ -1,5 +1,6 @@
|
|
|
package com.izouma.nineth.web;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.izouma.nineth.config.MetaConstants;
|
|
|
import com.izouma.nineth.domain.Snapshot;
|
|
|
import com.izouma.nineth.dto.PageQuery;
|
|
|
@@ -11,6 +12,7 @@ import com.izouma.nineth.service.SnapshotService;
|
|
|
import com.izouma.nineth.service.SysConfigService;
|
|
|
import com.izouma.nineth.utils.excel.ExcelUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@@ -18,8 +20,10 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.time.LocalTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/snapshot")
|
|
|
@@ -49,12 +53,20 @@ public class SnapshotController extends BaseController {
|
|
|
if (1L == id) {
|
|
|
int point = sysConfigService.getInt("zombie_point");
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
- LocalDateTime endTime = LocalDate.parse(sqlParams, formatter).atStartOfDay();
|
|
|
+ LocalDateTime endTime = LocalDate.parse(sqlParams, formatter).atTime(LocalTime.MAX);
|
|
|
LocalDateTime lastEndTime = endTime.plusDays(-1);
|
|
|
- List<SnapshotDTO> snapshot = metaGameProcessRepo.snapshot(point, MetaConstants.GAME_COPY_IDS, endTime, lastEndTime);
|
|
|
- ExcelUtils.export(response, snapshot);
|
|
|
+ List<Map<String, Object>> map = metaGameProcessRepo.snapshot(point, MetaConstants.GAME_COPY_IDS, endTime, lastEndTime);
|
|
|
+ if (CollectionUtils.isEmpty(map)) {
|
|
|
+ throw new BusinessException("无数据");
|
|
|
+ }
|
|
|
+ JSONArray jsonArray = new JSONArray();
|
|
|
+ jsonArray.addAll(map);
|
|
|
+ List<SnapshotDTO> snapshotDTOS = jsonArray.toJavaList(SnapshotDTO.class);
|
|
|
+ ExcelUtils.export(response, snapshotDTOS);
|
|
|
}
|
|
|
+ if (2L == id) {
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|