|
|
@ -12,7 +12,9 @@ import com.zdxt.enforcementcode.report.IScanDataSituationService; |
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
import org.dromara.common.core.utils.file.FileUtils; |
|
|
import org.dromara.common.excel.utils.ExcelUtil; |
|
|
import org.dromara.common.excel.utils.ExcelUtil; |
|
|
|
|
|
import org.dromara.common.excel.utils.ExcelWriterWrapper; |
|
|
import org.dromara.common.mybatis.core.page.PageQuery; |
|
|
import org.dromara.common.mybatis.core.page.PageQuery; |
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
|
import org.springframework.validation.annotation.Validated; |
|
|
import org.springframework.validation.annotation.Validated; |
|
|
@ -21,6 +23,7 @@ import org.springframework.web.bind.annotation.PostMapping; |
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -66,7 +69,13 @@ public class ScanDataSituationController { |
|
|
public void export(ScanDataSituationBo bo, HttpServletResponse response) { |
|
|
public void export(ScanDataSituationBo bo, HttpServletResponse response) { |
|
|
try { |
|
|
try { |
|
|
List<ScanDataSituationVo> list = scanDataSituationService.selectScanDataSituationAreaList(bo); |
|
|
List<ScanDataSituationVo> list = scanDataSituationService.selectScanDataSituationAreaList(bo); |
|
|
ExcelUtil.exportExcel(list, "各区扫码情", ScanDataSituationVo.class, response); |
|
|
String sheetName = "各区扫码情况"; |
|
|
|
|
|
FileUtils.setAttachmentResponseHeader(response, ExcelUtil.encodingFilename(sheetName)); |
|
|
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"); |
|
|
|
|
|
ExcelUtil.exportExcel(ScanDataSituationVo.class, response.getOutputStream(), wrapper -> |
|
|
|
|
|
wrapper.write(list, ExcelWriterWrapper.sheetBuilder(sheetName) |
|
|
|
|
|
.excludeColumnFieldNames(Arrays.asList("domainName", "streetName", "deptName")) |
|
|
|
|
|
.build())); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("导出各区扫码情Excel异常", e); |
|
|
log.error("导出各区扫码情Excel异常", e); |
|
|
response.reset(); |
|
|
response.reset(); |
|
|
@ -79,6 +88,33 @@ public class ScanDataSituationController { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 各区扫码情明细-导出Excel |
|
|
|
|
|
*/ |
|
|
|
|
|
@PostMapping("/exportAreaDetails") |
|
|
|
|
|
public void exportAreaDetails(ScanDataSituationBo bo, HttpServletResponse response) { |
|
|
|
|
|
try { |
|
|
|
|
|
List<ScanDataSituationVo> list = scanDataSituationService.selectScanDataSituationAreaDetailsList(bo); |
|
|
|
|
|
String sheetName = "区街道扫码情况"; |
|
|
|
|
|
FileUtils.setAttachmentResponseHeader(response, ExcelUtil.encodingFilename(sheetName)); |
|
|
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"); |
|
|
|
|
|
ExcelUtil.exportExcel(ScanDataSituationVo.class, response.getOutputStream(), wrapper -> |
|
|
|
|
|
wrapper.write(list, ExcelWriterWrapper.sheetBuilder(sheetName) |
|
|
|
|
|
.excludeColumnFieldNames(Arrays.asList("domainName", "districtName", "deptName")) |
|
|
|
|
|
.build())); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
log.error("导出各区街道扫码情Excel异常", e); |
|
|
|
|
|
response.reset(); |
|
|
|
|
|
response.setContentType("application/json; charset=utf-8"); |
|
|
|
|
|
try { |
|
|
|
|
|
response.getWriter().write("{\"code\":500,\"msg\":\"导出失败: " + e.getMessage() + "\"}"); |
|
|
|
|
|
} catch (Exception ignored) { |
|
|
|
|
|
log.error("响应重置异常", ignored); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 各领域扫码情况 |
|
|
* 各领域扫码情况 |
|
|
*/ |
|
|
*/ |
|
|
@ -104,7 +140,39 @@ public class ScanDataSituationController { |
|
|
public void exportDomain(ScanDataSituationBo bo, HttpServletResponse response) { |
|
|
public void exportDomain(ScanDataSituationBo bo, HttpServletResponse response) { |
|
|
try { |
|
|
try { |
|
|
List<ScanDataSituationVo> list = scanDataSituationService.selectScanDataSituationDomainList(bo); |
|
|
List<ScanDataSituationVo> list = scanDataSituationService.selectScanDataSituationDomainList(bo); |
|
|
ExcelUtil.exportExcel(list, "各领域扫码情况", ScanDataSituationVo.class, response); |
|
|
String sheetName = "各领域扫码情况"; |
|
|
|
|
|
FileUtils.setAttachmentResponseHeader(response, ExcelUtil.encodingFilename(sheetName)); |
|
|
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"); |
|
|
|
|
|
ExcelUtil.exportExcel(ScanDataSituationVo.class, response.getOutputStream(), wrapper -> |
|
|
|
|
|
wrapper.write(list, ExcelWriterWrapper.sheetBuilder(sheetName) |
|
|
|
|
|
.excludeColumnFieldNames(Arrays.asList("districtName", "enterpriseCount", "deptName","streetName")) |
|
|
|
|
|
.build())); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
log.error("导出各领域扫码情况Excel异常", e); |
|
|
|
|
|
response.reset(); |
|
|
|
|
|
response.setContentType("application/json; charset=utf-8"); |
|
|
|
|
|
try { |
|
|
|
|
|
response.getWriter().write("{\"code\":500,\"msg\":\"导出失败: " + e.getMessage() + "\"}"); |
|
|
|
|
|
} catch (Exception ignored) { |
|
|
|
|
|
log.error("响应重置异常", ignored); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 各领域扫码情况明细-导出Excel |
|
|
|
|
|
*/ |
|
|
|
|
|
@PostMapping("/exportDomainDetails") |
|
|
|
|
|
public void exportDomainDetails(ScanDataSituationBo bo, HttpServletResponse response) { |
|
|
|
|
|
try { |
|
|
|
|
|
List<ScanDataSituationVo> list = scanDataSituationService.selectScanDataSituationDomainDetailsList(bo); |
|
|
|
|
|
String sheetName = "各领域扫码情况"; |
|
|
|
|
|
FileUtils.setAttachmentResponseHeader(response, ExcelUtil.encodingFilename(sheetName)); |
|
|
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"); |
|
|
|
|
|
ExcelUtil.exportExcel(ScanDataSituationVo.class, response.getOutputStream(), wrapper -> |
|
|
|
|
|
wrapper.write(list, ExcelWriterWrapper.sheetBuilder(sheetName) |
|
|
|
|
|
.excludeColumnFieldNames(Arrays.asList("districtName", "enterpriseCount", "domainName","streetName")) |
|
|
|
|
|
.build())); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("导出各领域扫码情况Excel异常", e); |
|
|
log.error("导出各领域扫码情况Excel异常", e); |
|
|
response.reset(); |
|
|
response.reset(); |
|
|
|