|
|
@@ -0,0 +1,457 @@
|
|
|
+package com.yc.ship.module.trade.service.report.impl;
|
|
|
+
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
+import com.alibaba.excel.converters.longconverter.LongStringConverter;
|
|
|
+import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
|
|
|
+import com.yc.ship.module.resource.dal.mysql.room.ResourceRoomMapper;
|
|
|
+import com.yc.ship.module.resource.helper.DateHelper;
|
|
|
+import com.yc.ship.module.trade.controller.admin.report.vo.CabinMixDailyReqVO;
|
|
|
+import com.yc.ship.module.trade.controller.admin.report.vo.ConsumptionIncomeDailyReqVO;
|
|
|
+import com.yc.ship.module.trade.dal.mysql.report.CabinMixDailyMapper;
|
|
|
+import com.yc.ship.module.trade.service.report.CabinMixDailyService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.io.IOException;
|
|
|
+import java.net.URLEncoder;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+@Service
|
|
|
+@Slf4j
|
|
|
+public class CabinMixDailyServiceImpl implements CabinMixDailyService {
|
|
|
+ @Resource
|
|
|
+ private ResourceRoomMapper resourceRoomMapper;
|
|
|
+ @Resource
|
|
|
+ private CabinMixDailyMapper cabinMixDailyMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> getTableHeadList(Long shipId) {
|
|
|
+ List<Map<String, Object>> list = resourceRoomMapper.getCabinMixDailyTableHeadList(shipId);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> getList(CabinMixDailyReqVO reqVO) {
|
|
|
+ if (reqVO.getShipId() == null) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String, Object>> roomTypeList = resourceRoomMapper.getCabinMixDailyTableHeadList(reqVO.getShipId());
|
|
|
+ if (roomTypeList == null || roomTypeList.isEmpty()) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String,Object>> currentDataList = cabinMixDailyMapper.getList(reqVO, buildRoomColumns(roomTypeList));
|
|
|
+
|
|
|
+ if (currentDataList == null || currentDataList.isEmpty()) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String, Object>> lastYearDataList = queryLastYearData(reqVO, roomTypeList);
|
|
|
+
|
|
|
+ return processCabinMixData(currentDataList, lastYearDataList, roomTypeList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private List<Map<String, Object>> queryLastYearData(CabinMixDailyReqVO reqVO, List<Map<String, Object>> roomTypeList) {
|
|
|
+ try {
|
|
|
+ String startDate = reqVO.getStartDate();
|
|
|
+ String endDate = reqVO.getEndDate();
|
|
|
+
|
|
|
+ if (startDate == null || startDate.isEmpty()) {
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ Date startD = DateHelper.parseDate(startDate);
|
|
|
+ Date endD = endDate != null && !endDate.isEmpty() ? DateHelper.parseDate(endDate) : null;
|
|
|
+
|
|
|
+ CabinMixDailyReqVO lastYearReq = new CabinMixDailyReqVO();
|
|
|
+ lastYearReq.setShipId(reqVO.getShipId());
|
|
|
+ lastYearReq.setStartDate(DateHelper.getAppointYearStartDate(startD));
|
|
|
+
|
|
|
+ if (endD != null) {
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ cal.setTime(startD);
|
|
|
+ int daysDiff = (int) ((endD.getTime() - startD.getTime()) / (1000 * 60 * 60 * 24));
|
|
|
+ cal.add(Calendar.YEAR, -1);
|
|
|
+ cal.add(Calendar.DATE, daysDiff);
|
|
|
+ lastYearReq.setEndDate(DateHelper.format(cal.getTime(), "yyyy-MM-dd"));
|
|
|
+ } else {
|
|
|
+ lastYearReq.setEndDate(DateHelper.format(new Date(), "yyyy-MM-dd"));
|
|
|
+ }
|
|
|
+
|
|
|
+ return cabinMixDailyMapper.getList(lastYearReq, buildRoomColumns(roomTypeList));
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("[queryLastYearData] 查询去年同期数据失败: {}", e.getMessage());
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private String buildRoomColumns(List<Map<String, Object>> roomTypeList) {
|
|
|
+ StringBuilder columns = new StringBuilder();
|
|
|
+ for (int i = 0; i < roomTypeList.size(); i++) {
|
|
|
+ Map<String, Object> roomType = roomTypeList.get(i);
|
|
|
+ String roomModelName = roomType.get("room_model_name").toString();
|
|
|
+ Long roomModelId = Long.valueOf(roomType.get("roomModelId").toString());
|
|
|
+
|
|
|
+ String columnSql;
|
|
|
+ if (roomModelName.contains("内舱")) {
|
|
|
+ columnSql = String.format(
|
|
|
+ "COALESCE(voyage_visitor.total_visitor / 2, 0) AS `%s`",
|
|
|
+ roomModelName
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ columnSql = String.format(
|
|
|
+ "COALESCE(SUM(CASE WHEN torm.room_model_id = %s THEN torm.use_room_num ELSE 0 END), 0) AS `%s`",
|
|
|
+ roomModelId, roomModelName
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ columns.append(columnSql);
|
|
|
+
|
|
|
+ if (i < roomTypeList.size() - 1) {
|
|
|
+ columns.append(", ");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return columns.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<Map<String, Object>> processCabinMixData(
|
|
|
+ List<Map<String, Object>> currentDataList,
|
|
|
+ List<Map<String, Object>> lastYearDataList,
|
|
|
+ List<Map<String, Object>> roomTypeList) {
|
|
|
+
|
|
|
+ List<Map<String, Object>> result = new ArrayList<>();
|
|
|
+
|
|
|
+ Map<String, List<Map<String, Object>>> currentMonthMap = currentDataList.stream()
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ item -> String.valueOf(item.get("month")),
|
|
|
+ TreeMap::new, Collectors.toList()));
|
|
|
+
|
|
|
+ Map<String, List<Map<String, Object>>> lastYearMonthMap = lastYearDataList.stream()
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ item -> String.valueOf(item.get("month")),
|
|
|
+ TreeMap::new, Collectors.toList()));
|
|
|
+
|
|
|
+ int index = 1;
|
|
|
+ Map<String, Double> cumulativeRoomCountMap = new LinkedHashMap<>();
|
|
|
+ Map<String, Double> lastYearCumulativeMap = new LinkedHashMap<>();
|
|
|
+ boolean isFirstMonth = true;
|
|
|
+
|
|
|
+ List<String> roomModelNames = roomTypeList.stream()
|
|
|
+ .map(room -> room.get("room_model_name").toString())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (Map.Entry<String, List<Map<String, Object>>> entry : currentMonthMap.entrySet()) {
|
|
|
+ String month = entry.getKey();
|
|
|
+ List<Map<String, Object>> dailyItems = entry.getValue();
|
|
|
+
|
|
|
+ for (Map<String, Object> data : dailyItems) {
|
|
|
+ Map<String, Object> row = createBasicRow(data, index++, roomModelNames);
|
|
|
+ row.put("month", formatMonth(month));
|
|
|
+ row.put("isSubtotal", false);
|
|
|
+ row.put("isCumulative", false);
|
|
|
+ result.add(row);
|
|
|
+
|
|
|
+ accumulateSingleRoomCount(cumulativeRoomCountMap, data, roomModelNames);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Double> monthRoomCountMap = calculateMonthRoomCount(dailyItems, roomModelNames);
|
|
|
+ double totalRooms = monthRoomCountMap.values().stream().mapToDouble(Double::doubleValue).sum();
|
|
|
+
|
|
|
+ Map<String, Object> subtotalDataVO = createSummaryRow(
|
|
|
+ month + "月小计", "", "", "数据", monthRoomCountMap, totalRooms, true, false);
|
|
|
+ subtotalDataVO.put("index", "");
|
|
|
+ result.add(subtotalDataVO);
|
|
|
+
|
|
|
+ String lastYearMonth = getMonthMinusOneYear(month);
|
|
|
+ List<Map<String, Object>> lastYearMonthData = lastYearMonthMap.getOrDefault(lastYearMonth, new ArrayList<>());
|
|
|
+ Map<String, Double> lastYearMonthRoomCountMap = calculateMonthRoomCount(lastYearMonthData, roomModelNames);
|
|
|
+ Map<String, Object> subtotalYoyVO = createYoyRow(monthRoomCountMap, lastYearMonthRoomCountMap, roomModelNames,true, false);
|
|
|
+ result.add(subtotalYoyVO);
|
|
|
+
|
|
|
+ accumulateListRoomCount(lastYearCumulativeMap, lastYearMonthData, roomModelNames);
|
|
|
+
|
|
|
+ if (!isFirstMonth) {
|
|
|
+ double cumulativeTotal = cumulativeRoomCountMap.values().stream().mapToDouble(Double::doubleValue).sum();
|
|
|
+
|
|
|
+ Map<String, Object> cumulativeDataVO = createSummaryRow(
|
|
|
+ "累计", "", "", "数据", cumulativeRoomCountMap, cumulativeTotal, false, true);
|
|
|
+ cumulativeDataVO.put("index", "");
|
|
|
+ result.add(cumulativeDataVO);
|
|
|
+
|
|
|
+ Map<String, Object> cumulativeYoyVO = createYoyRow(cumulativeRoomCountMap, lastYearCumulativeMap, roomModelNames,false, true);
|
|
|
+ result.add(cumulativeYoyVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ isFirstMonth = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getMonthMinusOneYear(String month) {
|
|
|
+ if (month == null || month.length() < 7) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ int year = Integer.parseInt(month.substring(0, 4));
|
|
|
+ String rest = month.substring(4);
|
|
|
+ return (year - 1) + rest;
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private String formatMonth(String month) {
|
|
|
+ if (month == null || month.length() < 5) {
|
|
|
+ return month;
|
|
|
+ }
|
|
|
+ return month.substring(5);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, Object> createBasicRow(Map<String, Object> data, int index, List<String> roomModelNames) {
|
|
|
+ Map<String, Object> row = new LinkedHashMap<>();
|
|
|
+ row.put("index", index);
|
|
|
+ row.put("date", String.valueOf(data.get("date")));
|
|
|
+ row.put("ship", String.valueOf(data.get("ship")));
|
|
|
+ row.put("route", String.valueOf(data.get("route")));
|
|
|
+ row.put("voyageNo", String.valueOf(data.get("voyageNo")));
|
|
|
+
|
|
|
+ for (String roomModelName : roomModelNames) {
|
|
|
+ Double roomNum = data.get(roomModelName) != null ?
|
|
|
+ ((Number) data.get(roomModelName)).doubleValue() : 0.0;
|
|
|
+ row.put(roomModelName, roomNum);
|
|
|
+ }
|
|
|
+
|
|
|
+ Object totalRooms = data.get("totalRooms");
|
|
|
+ if (totalRooms != null) {
|
|
|
+ row.put("totalRooms", ((Number) totalRooms).doubleValue());
|
|
|
+ }
|
|
|
+
|
|
|
+ return row;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, Double> calculateMonthRoomCount(List<Map<String, Object>> dataList, List<String> roomModelNames) {
|
|
|
+ Map<String, Double> roomCountMap = new LinkedHashMap<>();
|
|
|
+
|
|
|
+ for (String roomModelName : roomModelNames) {
|
|
|
+ double sum = dataList.stream()
|
|
|
+ .mapToDouble(data -> {
|
|
|
+ Object value = data.get(roomModelName);
|
|
|
+ return value != null ? ((Number) value).doubleValue() : 0.0;
|
|
|
+ })
|
|
|
+ .sum();
|
|
|
+ roomCountMap.put(roomModelName, sum);
|
|
|
+ }
|
|
|
+
|
|
|
+ return roomCountMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void accumulateSingleRoomCount(Map<String, Double> cumulativeMap, Map<String, Object> data, List<String> roomModelNames) {
|
|
|
+ for (String roomModelName : roomModelNames) {
|
|
|
+ Double roomNum = data.get(roomModelName) != null ?
|
|
|
+ ((Number) data.get(roomModelName)).doubleValue() : 0.0;
|
|
|
+ cumulativeMap.merge(roomModelName, roomNum, Double::sum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void accumulateListRoomCount(Map<String, Double> cumulativeMap, List<Map<String, Object>> dataList, List<String> roomModelNames) {
|
|
|
+ for (String roomModelName : roomModelNames) {
|
|
|
+ double sum = dataList.stream()
|
|
|
+ .mapToDouble(data -> {
|
|
|
+ Object value = data.get(roomModelName);
|
|
|
+ return value != null ? ((Number) value).doubleValue() : 0.0;
|
|
|
+ })
|
|
|
+ .sum();
|
|
|
+ cumulativeMap.merge(roomModelName, sum, Double::sum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, Object> createSummaryRow(
|
|
|
+ String month, String date, String ship, String voyageNo,
|
|
|
+ Map<String, Double> roomCountMap, double totalRooms,
|
|
|
+ boolean isSubtotal, boolean isCumulative) {
|
|
|
+
|
|
|
+ Map<String, Object> row = new LinkedHashMap<>();
|
|
|
+ row.put("month", month);
|
|
|
+ row.put("date", date);
|
|
|
+ row.put("ship", ship);
|
|
|
+ row.put("route", "");
|
|
|
+ row.put("voyageNo", voyageNo);
|
|
|
+
|
|
|
+ for (Map.Entry<String, Double> entry : roomCountMap.entrySet()) {
|
|
|
+ row.put(entry.getKey(), entry.getValue());
|
|
|
+ }
|
|
|
+
|
|
|
+ row.put("totalRooms", totalRooms);
|
|
|
+ row.put("isSubtotal", isSubtotal);
|
|
|
+ row.put("isCumulative", isCumulative);
|
|
|
+
|
|
|
+ return row;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, Object> createYoyRow(
|
|
|
+ Map<String, Double> currentMap,
|
|
|
+ Map<String, Double> lastYearMap,
|
|
|
+ List<String> roomModelNames,boolean isSubtotal, boolean isCumulative) {
|
|
|
+
|
|
|
+ Map<String, Object> yoyRow = new LinkedHashMap<>();
|
|
|
+ yoyRow.put("month", "");
|
|
|
+ yoyRow.put("date", "");
|
|
|
+ yoyRow.put("ship", "");
|
|
|
+ yoyRow.put("route", "");
|
|
|
+ yoyRow.put("voyageNo", "同比");
|
|
|
+ yoyRow.put("isSubtotal", isSubtotal);
|
|
|
+ yoyRow.put("isCumulative", isCumulative);
|
|
|
+
|
|
|
+ for (String roomModelName : roomModelNames) {
|
|
|
+ Double currentVal = currentMap.getOrDefault(roomModelName, 0.0);
|
|
|
+ Double lastYearVal = lastYearMap.getOrDefault(roomModelName, 0.0);
|
|
|
+ String yoyPercent = calcYoyPercent(currentVal, lastYearVal);
|
|
|
+ yoyRow.put(roomModelName, yoyPercent);
|
|
|
+ }
|
|
|
+
|
|
|
+ double currentTotal = currentMap.values().stream().mapToDouble(Double::doubleValue).sum();
|
|
|
+ double lastYearTotal = lastYearMap.values().stream().mapToDouble(Double::doubleValue).sum();
|
|
|
+ yoyRow.put("totalRooms", calcYoyPercent(currentTotal, lastYearTotal));
|
|
|
+
|
|
|
+ return yoyRow;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String calcYoyPercent(Number current, Number last) {
|
|
|
+ if (current == null || last == null || last.doubleValue() == 0) {
|
|
|
+ return "-";
|
|
|
+ }
|
|
|
+ double diff = current.doubleValue() - last.doubleValue();
|
|
|
+ double percent = (diff / last.doubleValue()) * 100;
|
|
|
+ if (percent >= 0) {
|
|
|
+ return String.format("+%.1f%%", percent);
|
|
|
+ } else {
|
|
|
+ return String.format("%.1f%%", percent);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void exportCabinMixDaily(@Valid CabinMixDailyReqVO reqVO, HttpServletResponse response) throws IOException {
|
|
|
+ if (reqVO.getShipId() == null) {
|
|
|
+ throw new IllegalArgumentException("请选择游轮");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String, Object>> roomTypeList = resourceRoomMapper.getCabinMixDailyTableHeadList(reqVO.getShipId());
|
|
|
+ if (roomTypeList == null || roomTypeList.isEmpty()) {
|
|
|
+ throw new IllegalArgumentException("该游轮暂无房型配置");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String, Object>> dataList = getList(reqVO);
|
|
|
+ if (dataList == null || dataList.isEmpty()) {
|
|
|
+ throw new IllegalArgumentException("暂无数据可导出");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<List<String>> headers = buildExportHeaders(roomTypeList);
|
|
|
+ List<List<Object>> exportData = transformExportData(dataList, roomTypeList);
|
|
|
+
|
|
|
+ EasyExcel.write(response.getOutputStream())
|
|
|
+ .head(headers)
|
|
|
+ .autoCloseStream(false)
|
|
|
+ .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
|
|
|
+ .registerConverter(new LongStringConverter())
|
|
|
+ .sheet("省际度假游轮房型分布日报")
|
|
|
+ .doWrite(exportData);
|
|
|
+
|
|
|
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8");
|
|
|
+ response.addHeader("Content-Disposition",
|
|
|
+ "attachment;filename=" + URLEncoder.encode("省际度假游轮房型分布日报表.xlsx", StandardCharsets.UTF_8.name()));
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<List<String>> buildExportHeaders(List<Map<String, Object>> roomTypeList) {
|
|
|
+ List<List<String>> headers = new ArrayList<>();
|
|
|
+
|
|
|
+ headers.add(new ArrayList<>(Arrays.asList("序号")));
|
|
|
+ headers.add(new ArrayList<>(Arrays.asList("月份")));
|
|
|
+ headers.add(new ArrayList<>(Arrays.asList("日期")));
|
|
|
+ headers.add(new ArrayList<>(Arrays.asList("船舶")));
|
|
|
+ headers.add(new ArrayList<>(Arrays.asList("航线")));
|
|
|
+ headers.add(new ArrayList<>(Arrays.asList("航次号")));
|
|
|
+
|
|
|
+ for (Map<String, Object> roomType : roomTypeList) {
|
|
|
+ String roomModelName = roomType.get("room_model_name").toString();
|
|
|
+ headers.add(new ArrayList<>(Arrays.asList(roomModelName)));
|
|
|
+ }
|
|
|
+
|
|
|
+ headers.add(new ArrayList<>(Arrays.asList("合计")));
|
|
|
+
|
|
|
+ return headers;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<List<Object>> transformExportData(List<Map<String, Object>> dataList, List<Map<String, Object>> roomTypeList) {
|
|
|
+ List<List<Object>> result = new ArrayList<>(dataList.size());
|
|
|
+ List<String> roomModelNames = roomTypeList.stream()
|
|
|
+ .map(room -> room.get("room_model_name").toString())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (Map<String, Object> row : dataList) {
|
|
|
+ List<Object> rowData = new ArrayList<>();
|
|
|
+
|
|
|
+ boolean isYoy = "同比".equals(row.get("voyageNo"));
|
|
|
+ boolean isSubtotalOrCumulative = Boolean.TRUE.equals(row.get("isSubtotal"))
|
|
|
+ || Boolean.TRUE.equals(row.get("isCumulative"));
|
|
|
+
|
|
|
+ if (isYoy) {
|
|
|
+ rowData.add("");
|
|
|
+ rowData.add("");
|
|
|
+ rowData.add("");
|
|
|
+ rowData.add("");
|
|
|
+ rowData.add("");
|
|
|
+ rowData.add("同比");
|
|
|
+
|
|
|
+ for (String roomModelName : roomModelNames) {
|
|
|
+ rowData.add(row.get(roomModelName) != null ? row.get(roomModelName) : "-");
|
|
|
+ }
|
|
|
+ rowData.add(row.get("totalRooms") != null ? row.get("totalRooms") : "-");
|
|
|
+ } else {
|
|
|
+ rowData.add(row.get("index") != null ? String.valueOf(row.get("index")) : "");
|
|
|
+ rowData.add(row.get("month") != null ? row.get("month") : "");
|
|
|
+ rowData.add(row.get("date") != null ? row.get("date") : "");
|
|
|
+ rowData.add(row.get("ship") != null ? row.get("ship") : "");
|
|
|
+ rowData.add(row.get("route") != null ? row.get("route") : "");
|
|
|
+ rowData.add(row.get("voyageNo") != null ? row.get("voyageNo") : "");
|
|
|
+
|
|
|
+ for (String roomModelName : roomModelNames) {
|
|
|
+ Object value = row.get(roomModelName);
|
|
|
+ if (value != null) {
|
|
|
+ double num = ((Number) value).doubleValue();
|
|
|
+ if (num == (int) num) {
|
|
|
+ rowData.add(String.valueOf((int) num));
|
|
|
+ } else {
|
|
|
+ rowData.add(String.format("%.1f", num));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ rowData.add("-");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Object totalRooms = row.get("totalRooms");
|
|
|
+ if (totalRooms != null) {
|
|
|
+ double num = ((Number) totalRooms).doubleValue();
|
|
|
+ if (num == (int) num) {
|
|
|
+ rowData.add(String.valueOf((int) num));
|
|
|
+ } else {
|
|
|
+ rowData.add(String.format("%.1f", num));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ rowData.add("-");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ result.add(rowData);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+}
|