|
@@ -59,6 +59,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -1251,4 +1252,31 @@ public class CwProjectReportController {
|
|
|
return flag;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 处理报告号模板下载(调整为指定年度的报告号)
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "importDetail/template")
|
|
|
+ public void importFileTemplate(HttpServletResponse response, HttpServletRequest request) {
|
|
|
+ try {
|
|
|
+ InputStream inputStream = this.getClass().getResourceAsStream("/dot/报告号调整模板.xlsx");
|
|
|
+ //强制下载不打开
|
|
|
+ response.setContentType("application/force-download");
|
|
|
+ OutputStream out = response.getOutputStream();
|
|
|
+ //使用URLEncoder来防止文件名乱码或者读取错误
|
|
|
+ response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("finance_invoice_detail_template.xlsx", "UTF-8"));
|
|
|
+ int b = 0;
|
|
|
+ byte[] buffer = new byte[1000000];
|
|
|
+ while (b != -1) {
|
|
|
+ b = inputStream.read(buffer);
|
|
|
+ if (b != -1) out.write(buffer, 0, b);
|
|
|
+ }
|
|
|
+ inputStream.close();
|
|
|
+ out.close();
|
|
|
+ out.flush();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|