diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java index 91ec7d41cc..5d9596722a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java +++ b/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.validator.ValidatorUtils; import com.epmet.dto.result.LingShanSpecialCrowdListResultDTO; +import com.epmet.enums.LingShanSpecialCrowdTypeEnums; import com.epmet.excel.data.*; import com.epmet.service.LingShanSpecialCrowdService; 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.multipart.MultipartFile; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; +import java.net.URLEncoder; import java.nio.file.Files; import java.nio.file.Path; import java.util.Date; @@ -42,6 +47,41 @@ public class LingShanSpecialCrowdController { @Autowired 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: 特殊人群导入 * @param file: diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_anzhibangjiao_import.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_anzhibangjiao_import.xlsx new file mode 100644 index 0000000000..f3e412780e Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_anzhibangjiao_import.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_jingzhanghuanzhe_import.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_jingzhanghuanzhe_import.xlsx new file mode 100644 index 0000000000..63d3839c6d Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_jingzhanghuanzhe_import.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_shequjiaozheng_import.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_shequjiaozheng_import.xlsx new file mode 100644 index 0000000000..984fdb14cb Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_shequjiaozheng_import.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xidurenyuan_import.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xidurenyuan_import.xlsx new file mode 100644 index 0000000000..d29f9b4b30 Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xidurenyuan_import.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xinfangrenyuan_import.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xinfangrenyuan_import.xlsx new file mode 100644 index 0000000000..17de7b7846 Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xinfangrenyuan_import.xlsx differ