diff --git a/src/main/java/com/biutag/supervision/config/InterceptorConfig.java b/src/main/java/com/biutag/supervision/config/InterceptorConfig.java index e27035c..272dd4d 100644 --- a/src/main/java/com/biutag/supervision/config/InterceptorConfig.java +++ b/src/main/java/com/biutag/supervision/config/InterceptorConfig.java @@ -47,7 +47,7 @@ public class InterceptorConfig implements WebMvcConfigurer { .excludePathPatterns("/common/**") .excludePathPatterns("/app/**") // excel导出 - .excludePathPatterns("/data/petitionComplaint12337/export/result", "/negative/books/export/**") + .excludePathPatterns("/data/petitionComplaint12337/export/result", "/negative/books/export/**","/data/petitionComplaint/export/**") .excludePathPatterns(List.of("/doc.html", "/webjars/**", "/favicon.ico", "/v3/api-docs/**")); registry.addInterceptor(new ApiInterceptor()) .addPathPatterns("/api/jwdc/**"); diff --git a/src/main/java/com/biutag/supervision/controller/books/NegativeBookController.java b/src/main/java/com/biutag/supervision/controller/books/NegativeBookController.java index ebabad6..d5c3a9d 100644 --- a/src/main/java/com/biutag/supervision/controller/books/NegativeBookController.java +++ b/src/main/java/com/biutag/supervision/controller/books/NegativeBookController.java @@ -20,6 +20,7 @@ import com.biutag.supervision.pojo.param.NegativeQueryParam; import com.biutag.supervision.pojo.vo.*; import com.biutag.supervision.service.*; import com.biutag.supervision.util.ImgUtil; +import dm.jdbc.util.StringUtil; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -198,6 +199,9 @@ public class NegativeBookController { DataPetitionComplaintExportGabxfVo exportGabxfVo = new DataPetitionComplaintExportGabxfVo(); BeanUtil.copyProperties(item, exportGabxfVo); exportGabxfVo.setIndex(i.getAndIncrement()); + if(StringUtil.isNotEmpty(item.getInitialPetition())){ + exportGabxfVo.setInitialPetition((item.getInitialPetition().contains("1")||item.getInitialPetition().contains("初"))?"初访":"重访"); + } return exportGabxfVo; }).toList(); diff --git a/src/main/java/com/biutag/supervision/controller/data/DataPetitionComplaintController.java b/src/main/java/com/biutag/supervision/controller/data/DataPetitionComplaintController.java index 95d4031..c1f5f22 100644 --- a/src/main/java/com/biutag/supervision/controller/data/DataPetitionComplaintController.java +++ b/src/main/java/com/biutag/supervision/controller/data/DataPetitionComplaintController.java @@ -1,5 +1,6 @@ package com.biutag.supervision.controller.data; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; @@ -23,11 +24,16 @@ import com.biutag.supervision.pojo.entity.NegativeTask; import com.biutag.supervision.pojo.entity.SupDepart; import com.biutag.supervision.pojo.model.UserAuth; import com.biutag.supervision.pojo.param.DataPetitionComplaintQueryParam; +import com.biutag.supervision.pojo.param.NegativeQueryParam; +import com.biutag.supervision.pojo.vo.DataPetitionComplaintExportGabxfVo; +import com.biutag.supervision.pojo.vo.DataPetitionComplaintNegativeVo; import com.biutag.supervision.pojo.vo.DataPetitionComplaintVo; +import com.biutag.supervision.pojo.vo.ExportGabxfVo; import com.biutag.supervision.service.DataPetitionComplaintService; import com.biutag.supervision.service.NegativeTaskService; import com.biutag.supervision.service.SupDepartService; import dm.jdbc.util.StringUtil; +import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; @@ -36,11 +42,13 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; +import java.net.URLEncoder; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; /** * @author wxc @@ -113,7 +121,7 @@ public class DataPetitionComplaintController { excelReader.close(); return Result.success(list); } - + //集访、领导名字数据补充 @PostMapping("gab/replenish") public Result replenishExcel(@RequestPart("file") MultipartFile file) throws IOException { log.info("文件导入中------------------------------"); @@ -148,7 +156,46 @@ public class DataPetitionComplaintController { }).sheet(0).headRowNumber(2).doRead(); return Result.success(); } + //台帐导出 + @GetMapping("export/xf/{petitionComplaintType}") + public void exportByGabXf(@PathVariable String petitionComplaintType, DataPetitionComplaintQueryParam queryParam, HttpServletResponse response) throws IOException { + log.info("数据导出==================>"); + queryParam.setCurrent(1); + queryParam.setSize(100000); + Page page = dataPetitionComplaintService.page(queryParam); + List records = page.getRecords(); + AtomicInteger i = new AtomicInteger(1); + List list = records.stream().map(item -> { + ExportGabxfVo exportGabxfVo = new ExportGabxfVo(); + BeanUtil.copyProperties(item, exportGabxfVo); + exportGabxfVo.setIndex(i.getAndIncrement()); + if(StringUtil.isNotEmpty(item.getInitialPetition())){ + exportGabxfVo.setInitialPetition((item.getInitialPetition().contains("1")||item.getInitialPetition().contains("初"))?"初访":"重访"); + } + if(item.getMassVisits()!=null){ + exportGabxfVo.setMassVisits((item.getMassVisits())?"是":"否"); + } + return exportGabxfVo; + }).toList(); + String name = null; + switch (petitionComplaintType){ + case "gabxf": + name="公安部信访线索"; + break; + case "gjxf": + name="国家信访投诉线索"; + break; + case "xfts": + name="信访投诉"; + break; + } + + String headerValue = "attachment; filename=\"" + URLEncoder.encode(name+".xlsx", "UTF-8") + "\""; + response.setHeader("Content-Disposition", headerValue); + response.setContentType("application/octet-stream"); + EasyExcel.write(response.getOutputStream(), ExportGabxfVo.class).inMemory(Boolean.TRUE).sheet(name).doWrite(list); + } diff --git a/src/main/java/com/biutag/supervision/pojo/vo/ExportGabxfVo.java b/src/main/java/com/biutag/supervision/pojo/vo/ExportGabxfVo.java new file mode 100644 index 0000000..3f8876a --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/vo/ExportGabxfVo.java @@ -0,0 +1,56 @@ +package com.biutag.supervision.pojo.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ExportGabxfVo { + + @ExcelProperty({"序号"}) + private Integer index; + + @ExcelProperty({"信访件编号"}) + private String originId; + + @ExcelProperty({"投诉渠道"}) + private String channelForFilingComplaints; + + @ExcelProperty({"信访方式"}) + private String petitionType; + + @ExcelProperty({"电话"}) + private String discoveryTime; + + @ExcelProperty({"信访人"}) + private String responderName; + + // 手机号码 + @ExcelProperty({"手机号码"}) + private String responderPhone; + + // 投诉人 + @ExcelProperty({"身份证号码"}) + private String responderIdCode; + + @ExcelProperty({"初访重访"}) + private String initialPetition; + + @ExcelProperty({"群众集访"}) + private String massVisits; + + @ExcelProperty({"被投诉机构"}) + private String secondDepartName; + + @ExcelProperty({"办理情况"}) + private String petitionProcessingStatus; + + @ExcelProperty({"接访领导"}) + private String receivingLeaderName; + + @ExcelProperty({"具体内容"}) + private String thingDesc; + + +}