|
@@ -1,13 +1,22 @@
|
|
package com.ruoyi.web.controller.zdsz;
|
|
package com.ruoyi.web.controller.zdsz;
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Arrays;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.util.*;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
|
+import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
|
|
|
|
+import com.ruoyi.common.convert.ExcelBigNumberConvert;
|
|
|
|
+import com.ruoyi.common.utils.file.FileUtils;
|
|
|
|
+import com.ruoyi.zdsz.domain.vo.GExportsVo;
|
|
|
|
+import com.ruoyi.zdsz.domain.vo.GImportVo;
|
|
import com.ruoyi.zdsz.service.*;
|
|
import com.ruoyi.zdsz.service.*;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.ServletOutputStream;
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.validation.constraints.*;
|
|
import javax.validation.constraints.*;
|
|
|
|
|
|
@@ -27,6 +36,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
import com.ruoyi.zdsz.domain.vo.ZAreaVo;
|
|
import com.ruoyi.zdsz.domain.vo.ZAreaVo;
|
|
import com.ruoyi.zdsz.domain.bo.ZAreaBo;
|
|
import com.ruoyi.zdsz.domain.bo.ZAreaBo;
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 小区管理
|
|
* 小区管理
|
|
@@ -40,6 +50,9 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|
@RequestMapping("/zdsz/area")
|
|
@RequestMapping("/zdsz/area")
|
|
public class ZAreaController extends BaseController {
|
|
public class ZAreaController extends BaseController {
|
|
|
|
|
|
|
|
+ private String bfb="0";
|
|
|
|
+ private String message;
|
|
|
|
+
|
|
private final IZAreaService iZAreaService;
|
|
private final IZAreaService iZAreaService;
|
|
@Resource
|
|
@Resource
|
|
private IZBuildingService buildingService;
|
|
private IZBuildingService buildingService;
|
|
@@ -135,4 +148,81 @@ public class ZAreaController extends BaseController {
|
|
}
|
|
}
|
|
return toAjax(iZAreaService.deleteWithValidByIds(Arrays.asList(ids), true));
|
|
return toAjax(iZAreaService.deleteWithValidByIds(Arrays.asList(ids), true));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @GetMapping("/importTemplate")
|
|
|
|
+ @Log(title = "下载导入模板", businessType = BusinessType.EXPORT)
|
|
|
|
+ public void importTemplate(HttpServletResponse response) {
|
|
|
|
+ ExcelUtil.exportExcel(new ArrayList<>(), "小区", GImportVo.class, response);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 批量下载生成文件夹打压缩包
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/upload")
|
|
|
|
+ @Log(title = "批量下载生成文件夹打压缩包", businessType = BusinessType.EXPORT)
|
|
|
|
+ public void upload(HttpServletRequest request, HttpServletResponse response, @RequestParam String id) throws Exception {
|
|
|
|
+ iZAreaService.upload(request, response, id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 导出所属包功能
|
|
|
|
+ */
|
|
|
|
+ @Log(title = "导出所属包功能", businessType = BusinessType.EXPORT)
|
|
|
|
+ @GetMapping("/exports")
|
|
|
|
+ public void exports(@Validated ZAreaBo bo, HttpServletResponse response) {
|
|
|
|
+ String filename = iZAreaService.getDictNameOfAffiliatedPackage(bo);
|
|
|
|
+ List<GExportsVo> list = iZAreaService.getExport(bo);
|
|
|
|
+ try {
|
|
|
|
+ response.reset();
|
|
|
|
+ FileUtils.setAttachmentResponseHeader(response, filename+ ".xlsx");
|
|
|
|
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8");
|
|
|
|
+ ServletOutputStream os = response.getOutputStream();
|
|
|
|
+ EasyExcel.write(os, GExportsVo.class)
|
|
|
|
+ .autoCloseStream(false)
|
|
|
|
+ // 自动适配
|
|
|
|
+ .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
|
|
|
|
+ // 大数值自动转换 防止失真
|
|
|
|
+ .registerConverter(new ExcelBigNumberConvert())
|
|
|
|
+ .sheet(filename).doWrite(list);
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ throw new RuntimeException("导出Excel异常");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+// @Log(title = "导入小区列表", businessType = BusinessType.EXPORT)
|
|
|
|
+// @ApiImplicitParams({
|
|
|
|
+// @ApiImplicitParam(name = "file", value = "导入文件", dataType = "java.io.File", required = true),
|
|
|
|
+// })
|
|
|
|
+// @PostMapping("/importData")
|
|
|
|
+// public synchronized AjaxResult<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception {
|
|
|
|
+// List<GImportVo> listVo = ExcelUtil.importExcel(file.getInputStream(), GImportVo.class);
|
|
|
|
+// List<GImportVo> list = BeanUtil.copyToList(listVo, GImportVo.class);
|
|
|
|
+// String operName = getUsername();
|
|
|
|
+// if(Double.valueOf(bfb)<=0){
|
|
|
|
+// forImportData(list,true,operName,0,0);
|
|
|
|
+// }
|
|
|
|
+// return AjaxResult.success(message);
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 进度条刷新,
|
|
|
|
+ */
|
|
|
|
+ @GetMapping(value = "/flushProgress")
|
|
|
|
+ public R<Map> flushProgress() throws Exception
|
|
|
|
+ {
|
|
|
|
+ Map<String,String> ret = new HashMap<>();
|
|
|
|
+ ret.put("bfb",bfb);
|
|
|
|
+ ret.put("message",message);
|
|
|
|
+ return R.ok(ret);
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 结束进度条刷新,
|
|
|
|
+ */
|
|
|
|
+ @GetMapping(value = "/clearFlushProgress")
|
|
|
|
+ public R<Void> clearFlushProgress() throws Exception
|
|
|
|
+ {
|
|
|
|
+ bfb="0";
|
|
|
|
+ message="";
|
|
|
|
+ return R.ok();
|
|
|
|
+ }
|
|
}
|
|
}
|