|
@@ -11,14 +11,18 @@ import com.gis.cms.entity.dto.HotelDto;
|
|
|
import com.gis.cms.entity.dto.HotelPageDto;
|
|
|
import com.gis.cms.entity.dto.RoomDto;
|
|
|
import com.gis.cms.entity.po.HotelEntity;
|
|
|
+import com.gis.cms.entity.vo.HotelExcel;
|
|
|
import com.gis.cms.entity.vo.HotelVo;
|
|
|
import com.gis.cms.mapper.HotelMapper;
|
|
|
import com.gis.cms.service.HotelService;
|
|
|
import com.gis.cms.zhengyuan.ZhengYuanService;
|
|
|
import com.gis.common.base.exception.BaseRuntimeException;
|
|
|
import com.gis.common.base.service.impl.IBaseService;
|
|
|
+import com.gis.common.constant.ConfigConstant;
|
|
|
import com.gis.common.constant.ErrorEnum;
|
|
|
import com.gis.common.util.BaseUtil;
|
|
|
+import com.gis.common.util.DateUtils;
|
|
|
+import com.gis.common.util.ExcelUtils;
|
|
|
import com.gis.common.util.Result;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -26,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@@ -46,6 +51,9 @@ public class HotelServiceImpl extends ServiceImpl<HotelMapper, HotelEntity> impl
|
|
|
@Autowired
|
|
|
ZhengYuanService zhengYuanService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ ConfigConstant configConstant;
|
|
|
+
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -239,6 +247,35 @@ public class HotelServiceImpl extends ServiceImpl<HotelMapper, HotelEntity> impl
|
|
|
return Result.success();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Result exportExcel(){
|
|
|
+ List<HotelExcel> rows = baseMapper.getExcelList();
|
|
|
+ String filePath = "/excel/" + DateUtils.getDateTime() + ".xlsx";
|
|
|
+
|
|
|
+ //LinkedHashMap 中的数据是根据put先后顺序来的,HashMap数据时无序的
|
|
|
+ LinkedHashMap<String, String> rowTitle = new LinkedHashMap<>();
|
|
|
+
|
|
|
+ rowTitle.put("id", "序号");
|
|
|
+ rowTitle.put("unit", "管理单位");
|
|
|
+ rowTitle.put("name", "酒店名称");
|
|
|
+ rowTitle.put("total", "房间总数");
|
|
|
+ rowTitle.put("roomIsolation", "隔离房间数");
|
|
|
+ rowTitle.put("used", "房间已使用");
|
|
|
+ rowTitle.put("usable", "房间可用");
|
|
|
+ rowTitle.put("touch", "密接人数");
|
|
|
+ rowTitle.put("touchSecond", "次密人数数");
|
|
|
+ rowTitle.put("contact", "联系人");
|
|
|
+ rowTitle.put("remark", "备注");
|
|
|
+
|
|
|
+ ExcelUtils.createExcel(rows, configConstant.serverBasePath + filePath, rowTitle);
|
|
|
+
|
|
|
+ HashMap<String, Object> result = new HashMap<>();
|
|
|
+ result.put("size", rows.size());
|
|
|
+ result.put("filePath", filePath);
|
|
|
+
|
|
|
+ return Result.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|