Commit 21a9d2de authored by chase's avatar chase

merge 档案管理

parent b07b6e3a
...@@ -13,7 +13,7 @@ import pwc.taxtech.atms.thirdparty.ExcelUtil; ...@@ -13,7 +13,7 @@ import pwc.taxtech.atms.thirdparty.ExcelUtil;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.HashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -92,7 +92,7 @@ public class FileTypesController { ...@@ -92,7 +92,7 @@ public class FileTypesController {
@ResponseBody @ResponseBody
public void exportExcelFile (HttpServletResponse response){ public void exportExcelFile (HttpServletResponse response){
try { try {
Map<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new LinkedHashMap<>();
headers.put("id", "id"); headers.put("id", "id");
headers.put("file_attr", "档案属性"); headers.put("file_attr", "档案属性");
headers.put("file_type", "档案类型"); headers.put("file_type", "档案类型");
......
...@@ -12,7 +12,7 @@ import pwc.taxtech.atms.thirdparty.ExcelUtil; ...@@ -12,7 +12,7 @@ import pwc.taxtech.atms.thirdparty.ExcelUtil;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.HashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -93,7 +93,7 @@ public class OperationLogFileTypeController { ...@@ -93,7 +93,7 @@ public class OperationLogFileTypeController {
public void exportExcelFile (HttpServletResponse response){ public void exportExcelFile (HttpServletResponse response){
// public ReturnData selectListForLog(@RequestBody OperationLogFileType operationLogFileType){ // public ReturnData selectListForLog(@RequestBody OperationLogFileType operationLogFileType){
try { try {
Map<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new LinkedHashMap<>();
headers.put("id", "id"); headers.put("id", "id");
// headers.put("operation_content", "操作内容"); // headers.put("operation_content", "操作内容");
// headers.put("module_name", "模块名称"); // headers.put("module_name", "模块名称");
......
...@@ -13,7 +13,7 @@ import pwc.taxtech.atms.thirdparty.ExcelUtil; ...@@ -13,7 +13,7 @@ import pwc.taxtech.atms.thirdparty.ExcelUtil;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.HashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -74,7 +74,7 @@ public class OperationLogTaxDocController { ...@@ -74,7 +74,7 @@ public class OperationLogTaxDocController {
// public void exportExcelFile(HttpServletResponse response, @RequestBody OperationLogTaxDocument operationLogTaxDocument) { // public void exportExcelFile(HttpServletResponse response, @RequestBody OperationLogTaxDocument operationLogTaxDocument) {
public void exportExcelFile(HttpServletResponse response) { public void exportExcelFile(HttpServletResponse response) {
try { try {
Map<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new LinkedHashMap<>();
headers.put("id", "id"); headers.put("id", "id");
// headers.put("operation_content", "操作内容"); // headers.put("operation_content", "操作内容");
// headers.put("module_name", "模块名称"); // headers.put("module_name", "模块名称");
......
...@@ -30,10 +30,7 @@ import java.net.HttpURLConnection; ...@@ -30,10 +30,7 @@ import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@Controller @Controller
@RequestMapping("/api/v1/taxDoc") @RequestMapping("/api/v1/taxDoc")
...@@ -88,24 +85,24 @@ public class TaxDocumentController { ...@@ -88,24 +85,24 @@ public class TaxDocumentController {
@ResponseBody @ResponseBody
public void exportExcelFile(HttpServletResponse response, @RequestBody TaxDocumentDto taxDocumentDto) { public void exportExcelFile(HttpServletResponse response, @RequestBody TaxDocumentDto taxDocumentDto) {
try { try {
Map<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new LinkedHashMap<>();
headers.put("id", "id"); headers.put("Id", "序号");
headers.put("file_attr", "档案属性"); headers.put("FileAttr", "档案属性");
headers.put("file_type", "档案类型"); headers.put("FileType", "档案类型");
headers.put("file_name", "档案名称"); headers.put("FileName", "档案名称");
headers.put("business_line", "业务线"); headers.put("BusinessLine", "业务线");
headers.put("company_name", "公司名称"); headers.put("CompanyName", "公司名称");
headers.put("tax_type", "税种"); headers.put("TaxType", "税种");
headers.put("file_time", "文件生效日期"); headers.put("FileTime", "文件生效日期");
headers.put("effective_time", "有效日期"); headers.put("EffectiveTime", "有效日期");
headers.put("creator", "创建人"); headers.put("Creator", "创建人");
headers.put("create_time", "创建时间"); headers.put("CreateTime", "创建时间");
headers.put("upload_time", "上传日期"); headers.put("UploadTime", "上传日期");
headers.put("storage_area", "实物存放地点"); headers.put("StorageArea", "实物存放地点");
headers.put("keeper", "保管人"); headers.put("Keeper", "保管人");
headers.put("remark", "档案备注"); headers.put("Remark", "档案备注");
headers.put("file_position_url", "文件存储的位置"); headers.put("FilePositionUrl", "文件存储的位置");
headers.put("own_time", "所属期间"); headers.put("OwnTime", "所属期间");
List<TaxDocument> TaxDocument = taxDocumentService.selectTaxDocumentList(taxDocumentDto); List<TaxDocument> TaxDocument = taxDocumentService.selectTaxDocumentList(taxDocumentDto);
response.setContentType("multipart/form-data"); response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", "attachment;fileName=" + new String("taxDocument.xlsx".getBytes("GB2312"), "ISO-8859-1")); response.setHeader("Content-Disposition", "attachment;fileName=" + new String("taxDocument.xlsx".getBytes("GB2312"), "ISO-8859-1"));
......
...@@ -28,10 +28,7 @@ import java.net.HttpURLConnection; ...@@ -28,10 +28,7 @@ import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Calendar; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
...@@ -350,7 +347,7 @@ public class TaxDocumentServiceImpl { ...@@ -350,7 +347,7 @@ public class TaxDocumentServiceImpl {
} }
public void downloadAllFile(HttpServletResponse response, List<Long> ids) { public void downloadAllFile(HttpServletResponse response, List<Long> ids) {
//如果只选择了一个附件,则不打包 //如果只选择了一个附件,则不打包
if (null != ids &&ids.size()==1){ if (null != ids && ids.size() == 1) {
TaxDocumentExample example = new TaxDocumentExample(); TaxDocumentExample example = new TaxDocumentExample();
TaxDocumentExample.Criteria criteria = example.createCriteria(); TaxDocumentExample.Criteria criteria = example.createCriteria();
criteria.andIdIn(ids); criteria.andIdIn(ids);
...@@ -360,8 +357,10 @@ public class TaxDocumentServiceImpl { ...@@ -360,8 +357,10 @@ public class TaxDocumentServiceImpl {
if (StringUtils.isBlank(urlPath)) { if (StringUtils.isBlank(urlPath)) {
throw new RuntimeException("文件url为空,id为:" + taxDocument.getId()); throw new RuntimeException("文件url为空,id为:" + taxDocument.getId());
} }
//文件名称(带后缀) //文件名称(带后缀) 文件名前+7位uuid截取码以防文件名相同
String fileName = StringUtils.isBlank(taxDocument.getFileOriginalName()) ? "未知文件(请修改后缀名).xlsx" : taxDocument.getFileOriginalName(); String fileName = StringUtils.isBlank(taxDocument.getFileName())
? "未知文件(请修改后缀名).xlsx"
: UUID.randomUUID().toString().substring(0, 6) + "_" + taxDocument.getFileOriginalName();
//设置输出流信息 //设置输出流信息
try { try {
response.setContentType("multipart/form-data"); response.setContentType("multipart/form-data");
...@@ -399,27 +398,27 @@ public class TaxDocumentServiceImpl { ...@@ -399,27 +398,27 @@ public class TaxDocumentServiceImpl {
out.write(buffer, 0, len); out.write(buffer, 0, len);
} }
} catch (IOException e) { } catch (IOException e) {
log.error("单个附件下载异常:"+e.getMessage()); log.error("单个附件下载异常:" + e.getMessage());
} finally { } finally {
if (null != out){ if (null != out) {
try { try {
out.close(); out.close();
} catch (IOException e) { } catch (IOException e) {
log.error("关闭输出流错误:"+e.getMessage()); log.error("关闭输出流错误:" + e.getMessage());
} }
} }
if (null != is) { if (null != is) {
try { try {
is.close(); is.close();
} catch (IOException e) { } catch (IOException e) {
log.error("关闭输入流错误:"+e.getMessage()); log.error("关闭输入流错误:" + e.getMessage());
} }
} }
if (null != in) { if (null != in) {
try { try {
in.close(); in.close();
} catch (IOException e) { } catch (IOException e) {
log.error("关闭缓存输入流错误:"+e.getMessage()); log.error("关闭缓存输入流错误:" + e.getMessage());
} }
} }
} }
...@@ -485,8 +484,10 @@ public class TaxDocumentServiceImpl { ...@@ -485,8 +484,10 @@ public class TaxDocumentServiceImpl {
if (StringUtils.isBlank(urlPath)) { if (StringUtils.isBlank(urlPath)) {
throw new RuntimeException("文件url为空,id为:" + item.getId()); throw new RuntimeException("文件url为空,id为:" + item.getId());
} }
//文件名称(带后缀) //文件名称(带后缀) 文件名前+7位uuid截取码以防文件名相同
String fileName = StringUtils.isBlank(item.getFileOriginalName()) ? "未知文件(请修改后缀名).xlsx" : item.getFileOriginalName(); String fileName = StringUtils.isBlank(item.getFileName())
? "未知文件(请修改后缀名).xlsx"
: UUID.randomUUID().toString().substring(0, 6) + "_" + item.getFileName();
InputStream is = null; InputStream is = null;
BufferedInputStream in = null; BufferedInputStream in = null;
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment