|
|
@ -28,13 +28,16 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.io.IOUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.http.HttpHeaders; |
|
|
|
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.Path; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.UUID; |
|
|
@ -165,4 +168,27 @@ public class IcNatCompareRecordController implements ResultDataResolver { |
|
|
|
icNatCompareRecordService.execAsyncExcelImport(fileSavePath, rstData.getTaskId(),tokenDto.getCustomerId(),tokenDto.getUserId()); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param response |
|
|
|
* @throws IOException |
|
|
|
*/ |
|
|
|
@RequestMapping(value = "template-download", method = {RequestMethod.GET, RequestMethod.POST}) |
|
|
|
public void downloadTemplate(HttpServletResponse response) throws IOException { |
|
|
|
response.setCharacterEncoding("UTF-8"); |
|
|
|
response.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Content-Disposition"); |
|
|
|
//response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.ms-excel");
|
|
|
|
response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
|
|
|
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("未做核酸比对", "UTF-8") + ".xlsx"); |
|
|
|
|
|
|
|
InputStream is = this.getClass().getClassLoader().getResourceAsStream("excel/ic_nat_compare_record_template.xlsx"); |
|
|
|
try { |
|
|
|
ServletOutputStream os = response.getOutputStream(); |
|
|
|
IOUtils.copy(is, os); |
|
|
|
} finally { |
|
|
|
if (is != null) { |
|
|
|
is.close(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|