Commit d21bfb54 authored by chase's avatar chase

merge 档案管理

parent 376af30c
...@@ -96,6 +96,7 @@ public class FileTypesController { ...@@ -96,6 +96,7 @@ public class FileTypesController {
headers.put("id", "id"); headers.put("id", "id");
headers.put("file_attr", "档案属性"); headers.put("file_attr", "档案属性");
headers.put("file_type", "档案类型"); headers.put("file_type", "档案类型");
headers.put("file_type", "必填字段");
headers.put("description", "说明"); headers.put("description", "说明");
headers.put("creator", "办事人"); headers.put("creator", "办事人");
headers.put("create_time", "创建时间"); headers.put("create_time", "创建时间");
......
...@@ -96,7 +96,7 @@ public class TaxDocumentController { ...@@ -96,7 +96,7 @@ public class TaxDocumentController {
headers.put("business_line", "业务线"); headers.put("business_line", "业务线");
headers.put("company_name", "公司名称"); headers.put("company_name", "公司名称");
headers.put("tax_type", "税种"); headers.put("tax_type", "税种");
headers.put("file_time", "文件日期"); headers.put("file_time", "文件生效日期");
headers.put("effective_time", "有效日期"); headers.put("effective_time", "有效日期");
headers.put("creator", "创建人"); headers.put("creator", "创建人");
headers.put("create_time", "创建时间"); headers.put("create_time", "创建时间");
...@@ -105,9 +105,10 @@ public class TaxDocumentController { ...@@ -105,9 +105,10 @@ public class TaxDocumentController {
headers.put("keeper", "保管人"); headers.put("keeper", "保管人");
headers.put("remark", "档案备注"); headers.put("remark", "档案备注");
headers.put("file_position_url", "文件存储的位置"); headers.put("file_position_url", "文件存储的位置");
headers.put("own_time", "所属期间");
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("".getBytes("GB2312"), "ISO-8859-1")); response.setHeader("Content-Disposition", "attachment;fileName=" + new String("taxDocument.xlsx".getBytes("GB2312"), "ISO-8859-1"));
OutputStream ouputStream = response.getOutputStream(); OutputStream ouputStream = response.getOutputStream();
ExcelUtil.exportExcel(headers, TaxDocument, ouputStream); ExcelUtil.exportExcel(headers, TaxDocument, ouputStream);
} catch (Exception e) { } catch (Exception e) {
......
package pwc.taxtech.atms.dto; package pwc.taxtech.atms.dto;
import pwc.taxtech.atms.thirdparty.ExcelCell;
import pwc.taxtech.atms.anno.ExcelCell;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
......
package pwc.taxtech.atms.dto; package pwc.taxtech.atms.dto;
import pwc.taxtech.atms.thirdparty.ExcelCell;
import pwc.taxtech.atms.anno.ExcelCell;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
......
package pwc.taxtech.atms.dto.organization; package pwc.taxtech.atms.dto.organization;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import pwc.taxtech.atms.thirdparty.ExcelCell; import pwc.taxtech.atms.anno.ExcelCell;
public class OrgBasicDto { public class OrgBasicDto {
//@JsonProperty("ID") //@JsonProperty("ID")
......
package pwc.taxtech.atms.dto.organization; package pwc.taxtech.atms.dto.organization;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import pwc.taxtech.atms.thirdparty.ExcelCell; import pwc.taxtech.atms.anno.ExcelCell;
import java.util.Date; import java.util.Date;
......
package pwc.taxtech.atms.dto.previewData; package pwc.taxtech.atms.dto.previewData;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.entity.BaseEntity; import pwc.taxtech.atms.anno.ExcelCell;
import pwc.taxtech.atms.entity.CustomDateSerializer; import pwc.taxtech.atms.entity.CustomDateSerializer;
import pwc.taxtech.atms.thirdparty.ExcelCell;
import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
......
package pwc.taxtech.atms.dto.vatdto; package pwc.taxtech.atms.dto.vatdto;
import pwc.taxtech.atms.thirdparty.ExcelCell; import pwc.taxtech.atms.anno.ExcelCell;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
......
package pwc.taxtech.atms.dto.vatdto; package pwc.taxtech.atms.dto.vatdto;
import pwc.taxtech.atms.thirdparty.ExcelCell; import pwc.taxtech.atms.anno.ExcelCell;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
......
package pwc.taxtech.atms.dto.vatdto; package pwc.taxtech.atms.dto.vatdto;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import pwc.taxtech.atms.constant.enums.EnumOutputInvoiceType; import pwc.taxtech.atms.anno.ExcelCell;
import pwc.taxtech.atms.thirdparty.ExcelCell;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
......
package pwc.taxtech.atms.dto.vatdto.dd; package pwc.taxtech.atms.dto.vatdto.dd;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.common.util.PwCIdSerialize;
import pwc.taxtech.atms.thirdparty.ExcelCell;
import java.io.Serializable; import pwc.taxtech.atms.anno.ExcelCell;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
......
package pwc.taxtech.atms.dto.vatdto.dd; package pwc.taxtech.atms.dto.vatdto.dd;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import pwc.taxtech.atms.anno.ExcelCell;
import pwc.taxtech.atms.common.util.PwCIdSerialize;
import pwc.taxtech.atms.thirdparty.ExcelCell;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
......
package pwc.taxtech.atms.dto.vatdto.dd; package pwc.taxtech.atms.dto.vatdto.dd;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.common.util.PwCIdSerialize; import pwc.taxtech.atms.anno.ExcelCell;
import pwc.taxtech.atms.thirdparty.ExcelCell;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
......
package pwc.taxtech.atms.dto.vatdto.dd; package pwc.taxtech.atms.dto.vatdto.dd;
import pwc.taxtech.atms.thirdparty.ExcelCell;
import pwc.taxtech.atms.anno.ExcelCell;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
......
package pwc.taxtech.atms.thirdparty; package pwc.taxtech.atms.thirdparty;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.text.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.beanutils.BeanComparator; import org.apache.commons.beanutils.BeanComparator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.ComparatorUtils; import org.apache.commons.collections.ComparatorUtils;
import org.apache.commons.collections.comparators.ComparableComparator; import org.apache.commons.collections.comparators.ComparableComparator;
import org.apache.commons.collections.comparators.ComparatorChain; import org.apache.commons.collections.comparators.ComparatorChain;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.usermodel.HSSFDateUtil; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellReference; import org.apache.poi.ss.util.CellReference;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import pwc.taxtech.atms.anno.ExcelCell;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.MessageFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/** /**
* The <code>ExcelUtil</code> 与 {@link ExcelCell}搭配使用 * The <code>ExcelUtil</code> 与 {@link ExcelCell}搭配使用
...@@ -112,34 +96,34 @@ public class ExcelUtil { ...@@ -112,34 +96,34 @@ public class ExcelUtil {
return null; return null;
} }
CellType cellType = cell.getCellTypeEnum(); CellType cellType = cell.getCellTypeEnum();
if(cellType == CellType.BLANK) if(cellType == CellType.BLANK)
return null; return null;
else if(cellType == CellType.BOOLEAN) else if(cellType == CellType.BOOLEAN)
return cell.getBooleanCellValue(); return cell.getBooleanCellValue();
else if(cellType == CellType.ERROR) else if(cellType == CellType.ERROR)
return cell.getErrorCellValue(); return cell.getErrorCellValue();
else if(cellType == CellType.FORMULA) { else if(cellType == CellType.FORMULA) {
try { try {
if (HSSFDateUtil.isCellDateFormatted(cell)) { if (HSSFDateUtil.isCellDateFormatted(cell)) {
return cell.getDateCellValue();
} else {
return cell.getNumericCellValue();
}
} catch (IllegalStateException e) {
return cell.getRichStringCellValue();
}
}
else if(cellType == CellType.NUMERIC){
if (DateUtil.isCellDateFormatted(cell)) {
return cell.getDateCellValue(); return cell.getDateCellValue();
} else { } else {
return cell.getNumericCellValue(); return cell.getNumericCellValue();
} }
} catch (IllegalStateException e) {
return cell.getRichStringCellValue();
}
}
else if(cellType == CellType.NUMERIC){
if (DateUtil.isCellDateFormatted(cell)) {
return cell.getDateCellValue();
} else {
return cell.getNumericCellValue();
} }
else if(cellType == CellType.STRING) }
return cell.getStringCellValue(); else if(cellType == CellType.STRING)
else return cell.getStringCellValue();
return null; else
return null;
} }
/** /**
...@@ -415,7 +399,7 @@ public class ExcelUtil { ...@@ -415,7 +399,7 @@ public class ExcelUtil {
* @throws RuntimeException * @throws RuntimeException
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <T> Collection<T> importExcel(Class<T> clazz, Workbook workBook, String sheetName, public static <T> Collection<T> importExcel(Class<T> clazz, Workbook workBook, String sheetName,
String pattern, ExcelLogs logs, Integer... arrayCount) { String pattern, ExcelLogs logs, Integer... arrayCount) {
//Workbook workBook; //Workbook workBook;
/*try { /*try {
...@@ -432,11 +416,11 @@ public class ExcelUtil { ...@@ -432,11 +416,11 @@ public class ExcelUtil {
else { else {
sheet = workBook.getSheet(sheetName); sheet = workBook.getSheet(sheetName);
} }
if(sheet == null) { if(sheet == null) {
return null; return null;
} }
Iterator<Row> rowIterator = sheet.rowIterator(); Iterator<Row> rowIterator = sheet.rowIterator();
try { try {
List<ExcelLog> logList = new ArrayList<>(); List<ExcelLog> logList = new ArrayList<>();
...@@ -570,7 +554,7 @@ public class ExcelUtil { ...@@ -570,7 +554,7 @@ public class ExcelUtil {
} }
return list; return list;
} }
/** /**
* 读取Excel的Header行, 并封装成Map<String, int) * 读取Excel的Header行, 并封装成Map<String, int)
* *
...@@ -588,7 +572,7 @@ public class ExcelUtil { ...@@ -588,7 +572,7 @@ public class ExcelUtil {
LG.error("load excel file error",e); LG.error("load excel file error",e);
return null; return null;
}*/ }*/
Sheet sheet; Sheet sheet;
if(null == sheetName || sheetName.isEmpty()) { if(null == sheetName || sheetName.isEmpty()) {
sheet = workBook.getSheetAt(0); sheet = workBook.getSheetAt(0);
...@@ -596,7 +580,7 @@ public class ExcelUtil { ...@@ -596,7 +580,7 @@ public class ExcelUtil {
else { else {
sheet = workBook.getSheet(sheetName); sheet = workBook.getSheet(sheetName);
} }
if(sheet == null) { if(sheet == null) {
return null; return null;
} }
......
...@@ -9,7 +9,6 @@ import org.apache.poi.ss.formula.functions.FreeRefFunction; ...@@ -9,7 +9,6 @@ import org.apache.poi.ss.formula.functions.FreeRefFunction;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import pwc.taxtech.atms.exception.Exceptions; import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.thirdparty.ExcelCell;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.HashMap; import java.util.HashMap;
......
...@@ -14,6 +14,11 @@ ...@@ -14,6 +14,11 @@
</parent> </parent>
<dependencies> <dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency> <dependency>
<groupId>org.mybatis</groupId> <groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId> <artifactId>mybatis</artifactId>
......
package pwc.taxtech.atms.thirdparty; package pwc.taxtech.atms.anno;
import org.apache.commons.lang3.StringUtils;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import org.apache.commons.lang3.StringUtils;
/** /**
* The <code>ExcelCell</code><br> * The <code>ExcelCell</code><br>
......
...@@ -2,6 +2,7 @@ package pwc.taxtech.atms.entity; ...@@ -2,6 +2,7 @@ package pwc.taxtech.atms.entity;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import pwc.taxtech.atms.anno.ExcelCell;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
...@@ -24,6 +25,7 @@ public class FileTypes implements Serializable { ...@@ -24,6 +25,7 @@ public class FileTypes implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=1)
private Long id; private Long id;
/** /**
...@@ -35,6 +37,7 @@ public class FileTypes implements Serializable { ...@@ -35,6 +37,7 @@ public class FileTypes implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=2)
private String fileAttr; private String fileAttr;
/** /**
...@@ -57,6 +60,7 @@ public class FileTypes implements Serializable { ...@@ -57,6 +60,7 @@ public class FileTypes implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=3)
private String fileType; private String fileType;
...@@ -69,6 +73,7 @@ public class FileTypes implements Serializable { ...@@ -69,6 +73,7 @@ public class FileTypes implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=4)
private List<String> requiredField; private List<String> requiredField;
...@@ -85,6 +90,7 @@ public class FileTypes implements Serializable { ...@@ -85,6 +90,7 @@ public class FileTypes implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=5)
private String description; private String description;
/** /**
...@@ -105,6 +111,7 @@ public class FileTypes implements Serializable { ...@@ -105,6 +111,7 @@ public class FileTypes implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=6)
private String creator; private String creator;
/** /**
...@@ -116,6 +123,7 @@ public class FileTypes implements Serializable { ...@@ -116,6 +123,7 @@ public class FileTypes implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=7)
private Date createTime; private Date createTime;
/** /**
...@@ -127,6 +135,7 @@ public class FileTypes implements Serializable { ...@@ -127,6 +135,7 @@ public class FileTypes implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=8)
private Date updateTime; private Date updateTime;
/** /**
...@@ -138,6 +147,7 @@ public class FileTypes implements Serializable { ...@@ -138,6 +147,7 @@ public class FileTypes implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=9)
private String status; private String status;
/** /**
...@@ -149,6 +159,7 @@ public class FileTypes implements Serializable { ...@@ -149,6 +159,7 @@ public class FileTypes implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=10)
private String remarks; private String remarks;
/** /**
......
package pwc.taxtech.atms.entity; package pwc.taxtech.atms.entity;
import pwc.taxtech.atms.anno.ExcelCell;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -19,6 +21,7 @@ public class OperationLogFileType implements Serializable { ...@@ -19,6 +21,7 @@ public class OperationLogFileType implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=1)
private String id; private String id;
/** /**
...@@ -55,6 +58,7 @@ public class OperationLogFileType implements Serializable { ...@@ -55,6 +58,7 @@ public class OperationLogFileType implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=2)
private String operationAction; private String operationAction;
/** /**
...@@ -73,6 +77,7 @@ public class OperationLogFileType implements Serializable { ...@@ -73,6 +77,7 @@ public class OperationLogFileType implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=3)
private String updateState; private String updateState;
/** /**
...@@ -82,6 +87,7 @@ public class OperationLogFileType implements Serializable { ...@@ -82,6 +87,7 @@ public class OperationLogFileType implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=4)
private String operationUser; private String operationUser;
/** /**
...@@ -91,6 +97,7 @@ public class OperationLogFileType implements Serializable { ...@@ -91,6 +97,7 @@ public class OperationLogFileType implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=5)
private String ip; private String ip;
/** /**
...@@ -100,6 +107,7 @@ public class OperationLogFileType implements Serializable { ...@@ -100,6 +107,7 @@ public class OperationLogFileType implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=5)
private String comment; private String comment;
/** /**
...@@ -109,6 +117,7 @@ public class OperationLogFileType implements Serializable { ...@@ -109,6 +117,7 @@ public class OperationLogFileType implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=6)
private Date createTime; private Date createTime;
private List<String> fileTypeIds; private List<String> fileTypeIds;
......
package pwc.taxtech.atms.entity; package pwc.taxtech.atms.entity;
import pwc.taxtech.atms.anno.ExcelCell;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -19,6 +21,7 @@ public class OperationLogTaxDocument implements Serializable { ...@@ -19,6 +21,7 @@ public class OperationLogTaxDocument implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=1)
private String id; private String id;
/** /**
...@@ -55,6 +58,7 @@ public class OperationLogTaxDocument implements Serializable { ...@@ -55,6 +58,7 @@ public class OperationLogTaxDocument implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=2)
private String operationAction; private String operationAction;
/** /**
...@@ -73,6 +77,7 @@ public class OperationLogTaxDocument implements Serializable { ...@@ -73,6 +77,7 @@ public class OperationLogTaxDocument implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=3)
private String updateState; private String updateState;
/** /**
...@@ -82,6 +87,7 @@ public class OperationLogTaxDocument implements Serializable { ...@@ -82,6 +87,7 @@ public class OperationLogTaxDocument implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=4)
private String operationUser; private String operationUser;
/** /**
...@@ -91,6 +97,7 @@ public class OperationLogTaxDocument implements Serializable { ...@@ -91,6 +97,7 @@ public class OperationLogTaxDocument implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=5)
private String ip; private String ip;
/** /**
...@@ -100,6 +107,7 @@ public class OperationLogTaxDocument implements Serializable { ...@@ -100,6 +107,7 @@ public class OperationLogTaxDocument implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=6)
private String comment; private String comment;
/** /**
...@@ -109,6 +117,7 @@ public class OperationLogTaxDocument implements Serializable { ...@@ -109,6 +117,7 @@ public class OperationLogTaxDocument implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
@ExcelCell(index=7)
private Date createTime; private Date createTime;
List<String> ids; List<String> ids;
......
...@@ -386,4 +386,127 @@ ...@@ -386,4 +386,127 @@
$scope.cancelDocFileType = cancelDocFileType; $scope.cancelDocFileType = cancelDocFileType;
})(); })();
}]); }]);
\ No newline at end of file
infrastructureModule.directive('exportPlugin',function(){
return{
restrict:"EA",
controller:['$scope','SweetAlert','$translate','docManageService','$q','$log',
function($scope,SweetAlert,$translate,docManageService,$q,$log){
$scope.exportTableData = function ()
{
docManageService.exportTableData().then(function (data, status, headers) {
if(status===204){
SweetAlert.warning("没有数据可以下载");
return;
}
exportToExcel(data, 'docType.xls');
},function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
})
};
//下载服务器上的xls文件
var exportToExcel = function (data, filename) {
$('#busy-indicator-container').show();
var defer = $q.defer();
// var octetStreamMime = 'application/vnd.ms-excel';
var success = false;
// Get the headers
// headers = headers();
// Get the filename from the x-filename header or default to "download.bin"
// var filename = decodeURI(headers['x-file-name']) + defaultFileName;
// Determine the content type from the header or default to "application/octet-stream"
// var contentType = headers['content-type'] || octetStreamMime;
try {
// Try using msSaveBlob if supported
//console.log("Trying saveBlob method ...");
var blob = new Blob([data], { type: "arraybuffer" });
if (navigator.msSaveBlob)
navigator.msSaveBlob(blob, filename);
else {
// Try using other saveBlob implementations, if available
var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
if (saveBlob === undefined) throw "Not supported";
saveBlob(blob, filename);
}
//console.log("saveBlob succeeded");
success = true;
} catch (ex) {
$log.debug("saveBlob method failed with the following exception:");
$log.debug(ex);
}
if (!success) {
// Get the blob url creator
var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
if (urlCreator) {
// Try to use a download link
var link = document.createElement('a');
if ('download' in link) {
// Try to simulate a click
try {
// Prepare a blob URL
//console.log("Trying download link method with simulated click ...");
var blobdownload = new Blob([data], { type: "arraybuffer" });
var urldownload = urlCreator.createObjectURL(blobdownload);
link.setAttribute('href', urldownload);
// Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
link.setAttribute("download", filename);
// Simulate clicking the download link
var event = document.createEvent('MouseEvents');
event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
link.dispatchEvent(event);
//console.log("Download link method with simulated click succeeded");
success = true;
} catch (ex) {
$log.debug("Download link method with simulated click failed with the following exception:");
$log.debug(ex);
$q.reject();
}
}
if (!success) {
// Fallback to window.location method
try {
// Prepare a blob URL
// Use application/octet-stream when using window.location to force download
//console.log("Trying download link method with window.location ...");
var blobsuccess = new Blob([data], { type: "arraybuffer" });
var urlsuccess = urlCreator.createObjectURL(blobsuccess);
window.location = urlsuccess;
//console.log("Download link method with window.location succeeded");
success = true;
} catch (ex) {
//console.log("Download link method with window.location failed with the following exception:");
$log.debug(ex);
$q.reject();
}
}
}
}
if (!success) {
// Fallback to window.open method
$log.debug("No methods worked for saving the arraybuffer, using last resort window.open");
window.open(httpPath, '_blank', '');
}
//Delete the file
// deleteFile(encodeURI(filename));
defer.resolve('success');
$('#busy-indicator-container').hide();
return defer.promise;
};
}]
}
});
\ No newline at end of file
 
<div class="land-manage-page"> <div class="land-manage-page" export-plugin>
<style> <style>
.DM-state-label{ .DM-state-label{
margin: 0; margin: 0;
...@@ -12,6 +12,12 @@ ...@@ -12,6 +12,12 @@
display: none; display: none;
} }
.required-tip{
color: red;
position: absolute;
left: 2rem;
top: 0.7rem;
}
</style> </style>
<div class="menu-header"> <div class="menu-header">
<div class="menu-title" translate="DocumentTypeSets"></div> <div class="menu-title" translate="DocumentTypeSets"></div>
...@@ -22,7 +28,7 @@ ...@@ -22,7 +28,7 @@
</div> </div>
<div class="content-container"> <div class="content-container">
<div class="row" style="margin-top:15px; text-align:right;padding:1rem;background: #fff"> <div class="row" style="margin-top:15px; text-align:right;padding:1rem;background: #fff">
<button style="width: 150px;" class="btn btn-in-panel-big" ng-click="exportEventTrigger()"> <button style="width: 150px;" class="btn btn-in-panel-big" ng-click="exportTableData()">
<i class="fa fa-file-excel-o"></i> <i class="fa fa-file-excel-o"></i>
{{'ExportTable' | translate}} {{'ExportTable' | translate}}
</button> </button>
...@@ -68,8 +74,8 @@ ...@@ -68,8 +74,8 @@
<!--档案属性--> <!--档案属性-->
<div class="form-group"> <div class="form-group">
<label for="DocumentAttr" class="col-sm-3 control-label"> <label for="DocumentAttr" class="col-sm-3 control-label">
<span style="color:red"> * </span> <span class="required-tip"> * </span>
<span translate="DocumentAttr"></span> <span translate="DocumentAttr"></span>
</label> </label>
<div class="col-sm-11" style="width:61.67%"> <div class="col-sm-11" style="width:61.67%">
<input class="form-control" <input class="form-control"
...@@ -86,7 +92,7 @@ ...@@ -86,7 +92,7 @@
<div class="form-group"> <div class="form-group">
<label for="DocumentType" class="col-sm-3 control-label"> <label for="DocumentType" class="col-sm-3 control-label">
<span style="color:red"> * </span> <span class="required-tip"> * </span>
<span translate="DocumentType"></span> <span translate="DocumentType"></span>
</label> </label>
<div class="col-sm-11" style="width:61.67%"> <div class="col-sm-11" style="width:61.67%">
...@@ -116,7 +122,7 @@ ...@@ -116,7 +122,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"> <label class="col-sm-3 control-label">
<span style="color:red"> * </span> <span class="required-tip"> * </span>
<span translate="RequiredFields"></span> <span translate="RequiredFields"></span>
</label> </label>
<div class="col-sm-11" style="width:61.67%" id="appMultiSelectContainer"> <div class="col-sm-11" style="width:61.67%" id="appMultiSelectContainer">
......
...@@ -15,6 +15,24 @@ function ($http, $q, apiConfig, apiInterceptor,jqFetch) { ...@@ -15,6 +15,24 @@ function ($http, $q, apiConfig, apiInterceptor,jqFetch) {
editFileType: function (params) { editFileType: function (params) {
return jqFetch.post(apiInterceptor.webApiHostUrl + '/fileTypes/edit', params); return jqFetch.post(apiInterceptor.webApiHostUrl + '/fileTypes/edit', params);
}, },
exportTableData:function(params){
$('#busy-indicator-container').show();
var defer = $q.defer();
var xhr = new XMLHttpRequest();
xhr.onload = function(e) {
var arraybuffer = xhr.response;
console.info("arraybuffer:",arraybuffer);
defer.resolve(arraybuffer,xhr.status,xhr.getAllResponseHeaders());
};
xhr.open("POST", apiInterceptor.webApiHostUrl + '/fileTypes/exportExcel', true);
xhr.setRequestHeader("Authorization", apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken());
xhr.setRequestHeader("Content-Type", 'application/json;charset=UTF-8');
xhr.responseType = "arraybuffer";
xhr.send(JSON.stringify(params));
return defer.promise;
},
}; };
}]); }]);
...@@ -70,16 +70,16 @@ frameworkModule.controller('appUsrOperateLogController', ...@@ -70,16 +70,16 @@ frameworkModule.controller('appUsrOperateLogController',
descendingText: "Sort Descending", descendingText: "Sort Descending",
mode: "single" mode: "single"
}, },
'export': { // 'export': {
allowExportSelectedData: false,//允许选择导出 // allowExportSelectedData: false,//允许选择导出
customizeExcelCell: null, // customizeExcelCell: null,
enabled: true,//允许导出 // enabled: true,//允许导出
excelFilterEnabled: false, // excelFilterEnabled: false,
excelWrapTextEnabled: false, // excelWrapTextEnabled: false,
fileName: "usrlog",//名字 // fileName: "usrlog",//名字
ignoreExcelErrors: true, // ignoreExcelErrors: true,
//
}, // },
showRowLines: true, showRowLines: true,
columnAutoWidth: true, columnAutoWidth: true,
allowColumnReordering: true, allowColumnReordering: true,
...@@ -165,4 +165,125 @@ frameworkModule.controller('appUsrOperateLogController', ...@@ -165,4 +165,125 @@ frameworkModule.controller('appUsrOperateLogController',
}; };
}]); }]);
\ No newline at end of file frameworkModule.directive('usrLogExportPlugin',function(){
return{
restrict:"EA",
controller:['$scope','SweetAlert','$translate','usrOperateLogService','$q','$log',
function($scope,SweetAlert,$translate,usrOperateLogService,$q,$log){
$scope.exportTableData = function ()
{
usrOperateLogService[$scope.thisModuleName + "Export"]().then(function (data, status, headers) {
if(status===204){
SweetAlert.warning("没有数据可以下载");
return;
}
exportToExcel(data, $scope.thisModuleName + '.xls');
},function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
})
};
//下载服务器上的xls文件
var exportToExcel = function (data, filename) {
var defer = $q.defer();
// var octetStreamMime = 'application/vnd.ms-excel';
var success = false;
// Get the headers
// headers = headers();
// Get the filename from the x-filename header or default to "download.bin"
// var filename = decodeURI(headers['x-file-name']) + defaultFileName;
// Determine the content type from the header or default to "application/octet-stream"
// var contentType = headers['content-type'] || octetStreamMime;
try {
// Try using msSaveBlob if supported
//console.log("Trying saveBlob method ...");
var blob = new Blob([data], { type: "arraybuffer" });
if (navigator.msSaveBlob)
navigator.msSaveBlob(blob, filename);
else {
// Try using other saveBlob implementations, if available
var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
if (saveBlob === undefined) throw "Not supported";
saveBlob(blob, filename);
}
//console.log("saveBlob succeeded");
success = true;
} catch (ex) {
$log.debug("saveBlob method failed with the following exception:");
$log.debug(ex);
}
if (!success) {
// Get the blob url creator
var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
if (urlCreator) {
// Try to use a download link
var link = document.createElement('a');
if ('download' in link) {
// Try to simulate a click
try {
// Prepare a blob URL
//console.log("Trying download link method with simulated click ...");
var blobdownload = new Blob([data], { type: "arraybuffer" });
var urldownload = urlCreator.createObjectURL(blobdownload);
link.setAttribute('href', urldownload);
// Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
link.setAttribute("download", filename);
// Simulate clicking the download link
var event = document.createEvent('MouseEvents');
event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
link.dispatchEvent(event);
//console.log("Download link method with simulated click succeeded");
success = true;
} catch (ex) {
$log.debug("Download link method with simulated click failed with the following exception:");
$log.debug(ex);
$q.reject();
}
}
if (!success) {
// Fallback to window.location method
try {
// Prepare a blob URL
// Use application/octet-stream when using window.location to force download
//console.log("Trying download link method with window.location ...");
var blobsuccess = new Blob([data], { type: "arraybuffer" });
var urlsuccess = urlCreator.createObjectURL(blobsuccess);
window.location = urlsuccess;
//console.log("Download link method with window.location succeeded");
success = true;
} catch (ex) {
//console.log("Download link method with window.location failed with the following exception:");
$log.debug(ex);
$q.reject();
}
}
}
}
if (!success) {
// Fallback to window.open method
$log.debug("No methods worked for saving the arraybuffer, using last resort window.open");
window.open(httpPath, '_blank', '');
}
//Delete the file
// deleteFile(encodeURI(filename));
defer.resolve('success');
$('#busy-indicator-container').hide();
return defer.promise;
};
}]
}
});
\ No newline at end of file
<div class="operate-log-wrapper"> <div class="operate-log-wrapper" usr-log-export-plugin>
<style>
.log-export-btn{
position: absolute;
right: 550px;
z-index: 2;
top: 1.3rem;
background: #fff;
}
.log-export-btn:hover{
background: #E6E6E6;
}
</style>
<button class="btn btn-not-important" ng-click="openUsrOperateLogPop()"><i class="material-icons">description</i><span translate="log">日志</span></button> <button class="btn btn-not-important" ng-click="openUsrOperateLogPop()"><i class="material-icons">description</i><span translate="log">日志</span></button>
<script type="text/html" id="usrOperateLogPopContainer"> <script type="text/html" id="usrOperateLogPopContainer">
<div class="modal fade" id="usrOperateLogPop" tabindex="-1" role="dialog" aria-labelledby="myModal" data-backdrop="static" data-keyboard="false"> <div class="modal fade" id="usrOperateLogPop" tabindex="-1" role="dialog" aria-labelledby="myModal" data-backdrop="static" data-keyboard="false">
...@@ -19,6 +31,11 @@ ...@@ -19,6 +31,11 @@
<!--<div ui-grid="operateLogGridOptions" ui-grid-selection style="width:1140px; height:510px;margin:0px;"></div>--> <!--<div ui-grid="operateLogGridOptions" ui-grid-selection style="width:1140px; height:510px;margin:0px;"></div>-->
<div class="dx-viewport demo-container"> <div class="dx-viewport demo-container">
<button class="btn log-export-btn" ng-click="exportTableData()">
<i class="fa fa-file-excel-o"></i>
<span translate="ExportTable"></span>
</button>
<div dx-data-grid="dataGridOptions"></div> <div dx-data-grid="dataGridOptions"></div>
</div> </div>
......
...@@ -2,15 +2,47 @@ ...@@ -2,15 +2,47 @@
* Created by Administrator on 2019/2/28 0028. * Created by Administrator on 2019/2/28 0028.
*/ */
frameworkModule.factory('usrOperateLogService', frameworkModule.factory('usrOperateLogService',
['$q', 'apiConfig', 'jqFetch','apiInterceptor', ['$q', 'apiConfig', 'jqFetch','apiInterceptor',
function ($q, apiConfig, jqFetch,apiInterceptor) { function ($q, apiConfig, jqFetch,apiInterceptor) {
'use strict'; 'use strict';
return { return {
docManageTypeLog: function (params) { docManageTypeLog: function (params) {
return jqFetch.get(apiInterceptor.webApiHostUrl + '/operLogFileTypes/selectList', params); return jqFetch.get(apiInterceptor.webApiHostUrl + '/operLogFileTypes/selectList', params);
}, },
docManageListLog: function (params) { docManageListLog: function (params) {
return jqFetch.post(apiInterceptor.webApiHostUrl + '/operLogTaxDoc/selectListForLog', params); return jqFetch.post(apiInterceptor.webApiHostUrl + '/operLogTaxDoc/selectListForLog', params);
} },
}; docManageListLogExport:function(){
}]);
\ No newline at end of file $('#busy-indicator-container').show();
return exportFn(apiInterceptor.webApiHostUrl + '/operLogTaxDoc/exportExcel');
},
docManageTypeLogExport:function(){
$('#busy-indicator-container').show();
return exportFn(apiInterceptor.webApiHostUrl + '/operLogFileTypes/exportExcel');
// http://etms.longi-silicon.com:8180//api/v1/operLogFileTypes/exportExcel
}
};
function exportFn(url) {
var defer = $q.defer();
var xhr = new XMLHttpRequest();
xhr.onload = function(e) {
var arraybuffer = xhr.response;
console.info("arraybuffer:",arraybuffer);
defer.resolve(arraybuffer,xhr.status,xhr.getAllResponseHeaders());
};
xhr.open("POST", url, true);
xhr.setRequestHeader("Authorization", apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken());
xhr.setRequestHeader("Content-Type", 'application/json;charset=UTF-8');
xhr.responseType = "arraybuffer";
xhr.send();
return defer.promise;
}
}]);
\ No newline at end of file
...@@ -79,8 +79,8 @@ taxDocumentManageModule.factory('taxDocumentListService', ...@@ -79,8 +79,8 @@ taxDocumentManageModule.factory('taxDocumentListService',
return jqFetch.get(apiInterceptor.webApiHostUrl + '/businessunit/getlist', params); return jqFetch.get(apiInterceptor.webApiHostUrl + '/businessunit/getlist', params);
}, },
downloadAllFile:function(params){ downloadAllFile:function(params){
//post请求会自带http://etms.longi-silicon.com:8180//api/v1的前缀路径,get请求不会
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
var fileName = 'files.zip'; // 文件名称
xhr.open('POST', apiInterceptor.webApiHostUrl + "/taxDoc/downloadAllFile", true); xhr.open('POST', apiInterceptor.webApiHostUrl + "/taxDoc/downloadAllFile", true);
xhr.responseType = 'arraybuffer'; xhr.responseType = 'arraybuffer';
// xhr.setRequestHeader(token, 'xxxxx') ;// 请求头中的验证信息等(如果有) // xhr.setRequestHeader(token, 'xxxxx') ;// 请求头中的验证信息等(如果有)
...@@ -88,9 +88,11 @@ taxDocumentManageModule.factory('taxDocumentListService', ...@@ -88,9 +88,11 @@ taxDocumentManageModule.factory('taxDocumentListService',
xhr.setRequestHeader("Authorization", apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken()); xhr.setRequestHeader("Authorization", apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken());
xhr.setRequestHeader("Content-Type", 'application/json;charset=UTF-8'); xhr.setRequestHeader("Content-Type", 'application/json;charset=UTF-8');
xhr.onload = function() { xhr.onload = function() {
if (this.status === 200) { var fileName = 'files.zip'; // 文件名称
// let type = xhr.getResponseHeader('Content-Type'); var headers = xhr.getAllResponseHeaders();
fileName = headers['x-file-name'] ? headers['x-file-name'] : fileName;
if (this.status === 200) {
var blob = new Blob([this.response], {type: "arraybuffer"}); var blob = new Blob([this.response], {type: "arraybuffer"});
if (typeof window.navigator.msSaveBlob !== 'undefined') { if (typeof window.navigator.msSaveBlob !== 'undefined') {
/* /*
...@@ -138,6 +140,25 @@ taxDocumentManageModule.factory('taxDocumentListService', ...@@ -138,6 +140,25 @@ taxDocumentManageModule.factory('taxDocumentListService',
oReq.responseType = "arraybuffer"; oReq.responseType = "arraybuffer";
oReq.send(); oReq.send();
return defer.promise;
},
exportTableData:function(params){
$('#busy-indicator-container').show();
var defer = $q.defer();
var xhr = new XMLHttpRequest();
xhr.onload = function(e) {
var arraybuffer = xhr.response;
console.info("arraybuffer:",arraybuffer);
defer.resolve(arraybuffer,xhr.status,xhr.getAllResponseHeaders());
};
xhr.open("POST", apiInterceptor.webApiHostUrl + '/taxDoc/exportExcel', true);
xhr.setRequestHeader("Authorization", apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken());
xhr.setRequestHeader("Content-Type", 'application/json;charset=UTF-8');
xhr.responseType = "arraybuffer";
xhr.send(JSON.stringify(params));
return defer.promise; return defer.promise;
} }
}; };
......
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