Browse Source

1.新增:特殊人员导入模板下载

master
wxz 2 years ago
parent
commit
3114ebb219
  1. 40
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java
  2. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_anzhibangjiao_import.xlsx
  3. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_jingzhanghuanzhe_import.xlsx
  4. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_shequjiaozheng_import.xlsx
  5. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xidurenyuan_import.xlsx
  6. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xinfangrenyuan_import.xlsx

40
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java

@ -10,6 +10,7 @@ import com.epmet.commons.tools.utils.FileUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.result.LingShanSpecialCrowdListResultDTO; import com.epmet.dto.result.LingShanSpecialCrowdListResultDTO;
import com.epmet.enums.LingShanSpecialCrowdTypeEnums;
import com.epmet.excel.data.*; import com.epmet.excel.data.*;
import com.epmet.service.LingShanSpecialCrowdService; import com.epmet.service.LingShanSpecialCrowdService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -19,8 +20,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Date; import java.util.Date;
@ -42,6 +47,41 @@ public class LingShanSpecialCrowdController {
@Autowired @Autowired
private LingShanSpecialCrowdService lingShanSpecialCrowdService; private LingShanSpecialCrowdService lingShanSpecialCrowdService;
/**
* @description: 下载导入模板
* @param specialType:
* @return
* @author: WangXianZhang
* @date: 2023/4/21 10:16 AM
*/
@GetMapping("downloadTemplate")
public void downloadTemplate(@RequestParam("specialType") String specialType, HttpServletResponse response) {
InputStream is = null;
LingShanSpecialCrowdTypeEnums st = LingShanSpecialCrowdTypeEnums.getByType(specialType);
if (st == null) {
log.error("【灵山街道-下载特殊人群导入模板】传入的特殊人群类型错误:{}", specialType);
return;
}
try (ServletOutputStream os = response.getOutputStream()) {
is = this.getClass().getClassLoader().getResourceAsStream("excel/lingshan/special_crowd_" + specialType + "_import.xlsx");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(st.getName(), "UTF-8"));
IOUtils.copy(is, os);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
org.apache.poi.util.IOUtils.closeQuietly(is);
}
}
/** /**
* @description: 特殊人群导入 * @description: 特殊人群导入
* @param file: * @param file:

BIN
epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_anzhibangjiao_import.xlsx

Binary file not shown.

BIN
epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_jingzhanghuanzhe_import.xlsx

Binary file not shown.

BIN
epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_shequjiaozheng_import.xlsx

Binary file not shown.

BIN
epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xidurenyuan_import.xlsx

Binary file not shown.

BIN
epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xinfangrenyuan_import.xlsx

Binary file not shown.
Loading…
Cancel
Save