|
@ -17,7 +17,9 @@ |
|
|
|
|
|
|
|
|
package com.epmet.controller; |
|
|
package com.epmet.controller; |
|
|
|
|
|
|
|
|
|
|
|
import cn.afterturn.easypoi.excel.ExcelExportUtil; |
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams; |
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams; |
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
|
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; |
|
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; |
|
|
import cn.afterturn.easypoi.excel.export.ExcelExportService; |
|
|
import cn.afterturn.easypoi.excel.export.ExcelExportService; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
@ -35,7 +37,10 @@ import com.epmet.commons.tools.validator.group.AddGroup; |
|
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|
|
import com.epmet.dto.IcResiUserDTO; |
|
|
import com.epmet.dto.IcResiUserDTO; |
|
|
import com.epmet.dto.form.*; |
|
|
import com.epmet.dto.form.CustomerFormQueryDTO; |
|
|
|
|
|
import com.epmet.dto.form.IcResiDetailFormDTO; |
|
|
|
|
|
import com.epmet.dto.form.IcResiUserFormDTO; |
|
|
|
|
|
import com.epmet.dto.form.IcResiUserPageFormDTO; |
|
|
import com.epmet.dto.result.CustomerFormResultDTO; |
|
|
import com.epmet.dto.result.CustomerFormResultDTO; |
|
|
import com.epmet.dto.result.FormGroupDTO; |
|
|
import com.epmet.dto.result.FormGroupDTO; |
|
|
import com.epmet.dto.result.FormItem; |
|
|
import com.epmet.dto.result.FormItem; |
|
@ -43,7 +48,9 @@ import com.epmet.dto.result.HomeUserResultDTO; |
|
|
import com.epmet.excel.IcResiUserExcel; |
|
|
import com.epmet.excel.IcResiUserExcel; |
|
|
import com.epmet.feign.OperCustomizeOpenFeignClient; |
|
|
import com.epmet.feign.OperCustomizeOpenFeignClient; |
|
|
import com.epmet.service.IcResiUserService; |
|
|
import com.epmet.service.IcResiUserService; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook; |
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|
|
import org.jetbrains.annotations.NotNull; |
|
|
import org.jetbrains.annotations.NotNull; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
@ -51,6 +58,8 @@ import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import java.io.FileOutputStream; |
|
|
import java.io.FileOutputStream; |
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
import java.net.URLEncoder; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -60,6 +69,7 @@ import java.util.*; |
|
|
* @author generator generator@elink-cn.com |
|
|
* @author generator generator@elink-cn.com |
|
|
* @since v1.0.0 2021-10-26 |
|
|
* @since v1.0.0 2021-10-26 |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
@Slf4j |
|
|
@RestController |
|
|
@RestController |
|
|
@RequestMapping("icresiuser") |
|
|
@RequestMapping("icresiuser") |
|
|
public class IcResiUserController { |
|
|
public class IcResiUserController { |
|
@ -312,4 +322,34 @@ public class IcResiUserController { |
|
|
return new Result().ok(icResiUserService.queryIcResiDetail(pageFormDTO)); |
|
|
return new Result().ok(icResiUserService.queryIcResiDetail(pageFormDTO)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/exportExcel") |
|
|
|
|
|
public void exportExcel(/*@LoginUser TokenDto tokenDto,*/ @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws IOException { |
|
|
|
|
|
pageFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc"); |
|
|
|
|
|
pageFormDTO.setPageFlag(false); |
|
|
|
|
|
PageData<Map<String, Object>> mapPageData = icResiUserService.pageResiMap(pageFormDTO); |
|
|
|
|
|
List<Map<String, Object>> list = mapPageData.getList(); |
|
|
|
|
|
Map<String, Object> mapData = new HashMap<>(); |
|
|
|
|
|
log.info("list:{}", JSON.toJSONString(list)); |
|
|
|
|
|
|
|
|
|
|
|
mapData.put("list", list); |
|
|
|
|
|
String templatePath = "excel/ic_resi_info_cid.xls"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Workbook workbook = ExcelExportUtil.exportExcel(new TemplateExportParams(templatePath), mapData); |
|
|
|
|
|
//header
|
|
|
|
|
|
response.setHeader("content-Type", "application/vnd.ms-excel"); |
|
|
|
|
|
response.addHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode("继续追踪导出详情-" + ".xlsx", "UTF-8")); |
|
|
|
|
|
workbook.write(response.getOutputStream()); |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
//方式1 通过mv导出
|
|
|
|
|
|
ModelAndView mv = new ModelAndView(new EasypoiTemplateExcelView()); |
|
|
|
|
|
mv.addObject(TemplateExcelConstants.FILE_NAME, "继续追踪导出详情-".concat(DateUtils.formatDate())); |
|
|
|
|
|
mv.addObject(TemplateExcelConstants.PARAMS, new TemplateExportParams(templatePath,dataType)); |
|
|
|
|
|
mv.addObject(TemplateExcelConstants.MAP_DATA, mapData); |
|
|
|
|
|
return mv; |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|