Commit fdc87c68 authored by zhkwei's avatar zhkwei

CIT数据导入模板下载功能补充

parent e57197df
......@@ -13,6 +13,7 @@ import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.ServletContextAware;
import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.constant.enums.EnumCitImportType;
import pwc.taxtech.atms.constant.enums.EnumImportType;
import pwc.taxtech.atms.dpo.TemplateUniqDto;
import pwc.taxtech.atms.dto.*;
......@@ -238,10 +240,15 @@ public class TemplateController extends BaseController implements ServletContext
}
@RequestMapping(value = "file/downloadTemplate", method = RequestMethod.GET)
public void fileDownload(@RequestParam Integer fileType,HttpServletResponse response){
public void fileDownload(@RequestParam Integer fileType, @RequestParam(required=false) Integer serviceType, HttpServletResponse response){
//获取网站部署路径(通过ServletContext对象),用于确定下载文件位置,从而实现下载
String path = servletContext.getRealPath("/")+"\\WEB-INF\\classes";
String fileName = getFileName(fileType);
String fileName = "";
if(serviceType == null){
fileName = getFileName(fileType);
}else{
fileName = getCitFileName(fileType);
}
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", "attachment;fileName="+fileName+".xlsx");
ServletOutputStream out;
......@@ -288,6 +295,25 @@ public class TemplateController extends BaseController implements ServletContext
return null;
}
private String getCitFileName(Integer fileType) {
if(EnumCitImportType.JournalAdjust.getCode().equals(fileType)){
return EnumCitImportType.JournalAdjust.name();
}else if(EnumCitImportType.TrialBalance.getCode().equals(fileType)){
return EnumCitImportType.TrialBalance.name();
}else if(EnumCitImportType.DraftAccountMapping.getCode().equals(fileType)){
return EnumCitImportType.DraftAccountMapping.name();
}else if(EnumCitImportType.BalanceSheetPrcAdjust.getCode().equals(fileType)){
return EnumCitImportType.BalanceSheetPrcAdjust.name();
}else if(EnumCitImportType.ProfitPrcAdjust.getCode().equals(fileType)){
return EnumCitImportType.ProfitPrcAdjust.name();
}else if(EnumCitImportType.EAMAssetsDisposal.getCode().equals(fileType)){
return EnumCitImportType.EAMAssetsDisposal.name();
}else if(EnumCitImportType.SalaryAdvance.getCode().equals(fileType)){
return EnumCitImportType.SalaryAdvance.name();
}
return null;
}
@Override
public void setServletContext(ServletContext servletContext) {
......
package pwc.taxtech.atms.service.impl;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* @author ZhiKai Z Wei
......@@ -45,6 +48,11 @@ public class CitCommonUtil {
obj = cell.getErrorCellValue();
break;
case NUMERIC:
if(HSSFDateUtil.isCellDateFormatted(cell)){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
obj = sdf.format(cell.getDateCellValue());
break;
}
obj = cell.getNumericCellValue();
break;
case STRING:
......
......@@ -612,7 +612,6 @@ public class CitImportExcelServiceImpl extends BaseService {
//获取该行数据
Row rowData = sheet.getRow(rowNum);
CitDataImportLog citDataImportLogError = generalCitDataImportLog("", "", "",
EnumCitImportType.EAMAssetsDisposal.getCode(), 0,
0, 0,
......@@ -623,7 +622,7 @@ public class CitImportExcelServiceImpl extends BaseService {
citEAMAssetsDisposal.setId(idService.nextId());
citEAMAssetsDisposal.setPeriod(Integer.valueOf(CitCommonUtil.getPeriod().toString()));
String[] split = CitCommonUtil.getValue(rowData.getCell(1)).toString().replace("月", "").split("年");
String[] split = CitCommonUtil.getValue(rowData.getCell(1)).toString().split("-");
StringBuilder sb = new StringBuilder(split[0]);
if(new Integer(split[1]) + 1 < 10){
sb.append(0);
......@@ -709,9 +708,36 @@ public class CitImportExcelServiceImpl extends BaseService {
citSalaryAdvance.setId(idService.nextId());
citSalaryAdvance.setPeriod(Integer.valueOf(CitCommonUtil.getPeriod().toString()));
citSalaryAdvance.setPoNo(Integer.valueOf(CitCommonUtil.getValue(rowData.getCell(0)).toString()));
Object cellValue = CitCommonUtil.getValue(rowData.getCell(0));
if(cellValue == null){
citDataImportLogError.setErrorMsg("第"+(rowNum+1)+"行PO号为空");
citDataImportLogList.add(citDataImportLogError);
continue;
}
citSalaryAdvance.setPoNo(cellValue.toString());
cellValue = CitCommonUtil.getValue(rowData.getCell(5));
if(cellValue == null){
citDataImportLogError.setErrorMsg("第"+(rowNum+1)+"行PO主体CODE为空");
citDataImportLogList.add(citDataImportLogError);
continue;
}
citSalaryAdvance.setPoSubjectCode(CitCommonUtil.getValue(rowData.getCell(5)).toString());
cellValue = CitCommonUtil.getValue(rowData.getCell(6));
if(cellValue == null){
citDataImportLogError.setErrorMsg("第"+(rowNum+1)+"行PO主体为空");
citDataImportLogList.add(citDataImportLogError);
continue;
}
citSalaryAdvance.setPoSubjectName(CitCommonUtil.getValue(rowData.getCell(6)).toString());
cellValue = CitCommonUtil.getValue(rowData.getCell(16));
if(cellValue == null){
citDataImportLogError.setErrorMsg("第"+(rowNum+1)+"行预提为空");
citDataImportLogList.add(citDataImportLogError);
continue;
}
citSalaryAdvance.setAdvance(new BigDecimal(CitCommonUtil.getValue(rowData.getCell(16)).toString()));
citSalaryAdvance.setApprovedStandardInvoiceAmount(new BigDecimal(CitCommonUtil.getValue(rowData.getCell(18)).toString()));
......@@ -719,7 +745,7 @@ public class CitImportExcelServiceImpl extends BaseService {
}
int insertBatchNum = citSalaryAdvanceMapper.insertBatch(citSalaryAdvanceList);
CitDataImportLog citDataImportLog = generalCitDataImportLog("", "", "",
EnumCitImportType.JournalAdjust.getCode(), period / 100,
EnumCitImportType.SalaryAdvance.getCode(), period / 100,
0, period % 100,
"", "预提重分类数据源", true);
citDataImportLog.setRecordSize(insertBatchNum);
......
......@@ -76,7 +76,7 @@ public class CitSalaryAdvance extends BaseEntity implements Serializable {
*
* @mbg.generated
*/
private Integer poNo;
private String poNo;
/**
* Database Column Remarks:
......@@ -302,7 +302,7 @@ public class CitSalaryAdvance extends BaseEntity implements Serializable {
*
* @mbg.generated
*/
public Integer getPoNo() {
public String getPoNo() {
return poNo;
}
......@@ -314,8 +314,8 @@ public class CitSalaryAdvance extends BaseEntity implements Serializable {
*
* @mbg.generated
*/
public void setPoNo(Integer poNo) {
this.poNo = poNo;
public void setPoNo(String poNo) {
this.poNo = poNo == null ? null : poNo.trim();
}
/**
......
......@@ -536,52 +536,62 @@ public class CitSalaryAdvanceExample {
return (Criteria) this;
}
public Criteria andPoNoEqualTo(Integer value) {
public Criteria andPoNoEqualTo(String value) {
addCriterion("po_no =", value, "poNo");
return (Criteria) this;
}
public Criteria andPoNoNotEqualTo(Integer value) {
public Criteria andPoNoNotEqualTo(String value) {
addCriterion("po_no <>", value, "poNo");
return (Criteria) this;
}
public Criteria andPoNoGreaterThan(Integer value) {
public Criteria andPoNoGreaterThan(String value) {
addCriterion("po_no >", value, "poNo");
return (Criteria) this;
}
public Criteria andPoNoGreaterThanOrEqualTo(Integer value) {
public Criteria andPoNoGreaterThanOrEqualTo(String value) {
addCriterion("po_no >=", value, "poNo");
return (Criteria) this;
}
public Criteria andPoNoLessThan(Integer value) {
public Criteria andPoNoLessThan(String value) {
addCriterion("po_no <", value, "poNo");
return (Criteria) this;
}
public Criteria andPoNoLessThanOrEqualTo(Integer value) {
public Criteria andPoNoLessThanOrEqualTo(String value) {
addCriterion("po_no <=", value, "poNo");
return (Criteria) this;
}
public Criteria andPoNoIn(List<Integer> values) {
public Criteria andPoNoLike(String value) {
addCriterion("po_no like", value, "poNo");
return (Criteria) this;
}
public Criteria andPoNoNotLike(String value) {
addCriterion("po_no not like", value, "poNo");
return (Criteria) this;
}
public Criteria andPoNoIn(List<String> values) {
addCriterion("po_no in", values, "poNo");
return (Criteria) this;
}
public Criteria andPoNoNotIn(List<Integer> values) {
public Criteria andPoNoNotIn(List<String> values) {
addCriterion("po_no not in", values, "poNo");
return (Criteria) this;
}
public Criteria andPoNoBetween(Integer value1, Integer value2) {
public Criteria andPoNoBetween(String value1, String value2) {
addCriterion("po_no between", value1, value2, "poNo");
return (Criteria) this;
}
public Criteria andPoNoNotBetween(Integer value1, Integer value2) {
public Criteria andPoNoNotBetween(String value1, String value2) {
addCriterion("po_no not between", value1, value2, "poNo");
return (Criteria) this;
}
......
......@@ -11,7 +11,7 @@
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="period" jdbcType="INTEGER" property="period" />
<result column="source" jdbcType="VARCHAR" property="source" />
<result column="po_no" jdbcType="INTEGER" property="poNo" />
<result column="po_no" jdbcType="VARCHAR" property="poNo" />
<result column="po_subject_code" jdbcType="VARCHAR" property="poSubjectCode" />
<result column="po_subject_name" jdbcType="VARCHAR" property="poSubjectName" />
<result column="advance" jdbcType="DECIMAL" property="advance" />
......@@ -153,7 +153,7 @@
updated_by, create_time, update_time
)
values (#{id,jdbcType=BIGINT}, #{organizationId,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
#{period,jdbcType=INTEGER}, #{source,jdbcType=VARCHAR}, #{poNo,jdbcType=INTEGER},
#{period,jdbcType=INTEGER}, #{source,jdbcType=VARCHAR}, #{poNo,jdbcType=VARCHAR},
#{poSubjectCode,jdbcType=VARCHAR}, #{poSubjectName,jdbcType=VARCHAR}, #{advance,jdbcType=DECIMAL},
#{approvedStandardInvoiceAmount,jdbcType=DECIMAL}, #{createdBy,jdbcType=VARCHAR},
#{updatedBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
......@@ -226,7 +226,7 @@
#{source,jdbcType=VARCHAR},
</if>
<if test="poNo != null">
#{poNo,jdbcType=INTEGER},
#{poNo,jdbcType=VARCHAR},
</if>
<if test="poSubjectCode != null">
#{poSubjectCode,jdbcType=VARCHAR},
......@@ -287,7 +287,7 @@
source = #{record.source,jdbcType=VARCHAR},
</if>
<if test="record.poNo != null">
po_no = #{record.poNo,jdbcType=INTEGER},
po_no = #{record.poNo,jdbcType=VARCHAR},
</if>
<if test="record.poSubjectCode != null">
po_subject_code = #{record.poSubjectCode,jdbcType=VARCHAR},
......@@ -329,7 +329,7 @@
project_id = #{record.projectId,jdbcType=VARCHAR},
period = #{record.period,jdbcType=INTEGER},
source = #{record.source,jdbcType=VARCHAR},
po_no = #{record.poNo,jdbcType=INTEGER},
po_no = #{record.poNo,jdbcType=VARCHAR},
po_subject_code = #{record.poSubjectCode,jdbcType=VARCHAR},
po_subject_name = #{record.poSubjectName,jdbcType=VARCHAR},
advance = #{record.advance,jdbcType=DECIMAL},
......@@ -362,7 +362,7 @@
source = #{source,jdbcType=VARCHAR},
</if>
<if test="poNo != null">
po_no = #{poNo,jdbcType=INTEGER},
po_no = #{poNo,jdbcType=VARCHAR},
</if>
<if test="poSubjectCode != null">
po_subject_code = #{poSubjectCode,jdbcType=VARCHAR},
......@@ -401,7 +401,7 @@
project_id = #{projectId,jdbcType=VARCHAR},
period = #{period,jdbcType=INTEGER},
source = #{source,jdbcType=VARCHAR},
po_no = #{poNo,jdbcType=INTEGER},
po_no = #{poNo,jdbcType=VARCHAR},
po_subject_code = #{poSubjectCode,jdbcType=VARCHAR},
po_subject_name = #{poSubjectName,jdbcType=VARCHAR},
advance = #{advance,jdbcType=DECIMAL},
......
commonModule.controller('importCitBalanceSheetPrcAdjustCon', ['$scope', '$log', '$translate', '$timeout', '$q', '$interval'
, 'apiInterceptor', 'Upload', 'citImportDataService', 'SweetAlert', 'uiGridConstants', '$uibModal'
, 'vatSessionService', 'enums', 'vatOperationLogService','$anchorScroll','$location',
, 'vatSessionService', 'enums', 'vatOperationLogService','templateService',
function ($scope, $log, $translate, $timeout, $q, $interval
, apiInterceptor, Upload, citImportDataService, SweetAlert, uiGridConstants, $uibModal
, vatSessionService, enums, vatOperationLogService, $anchorScroll,$location) {
, vatSessionService, enums, vatOperationLogService,templateService) {
'use strict';
// $anchorScroll.yOffset=55;
// $location.hash('top');
......@@ -383,6 +383,36 @@
ele1.datepicker("setDate", $scope.selectedDate);
};
$scope.downloadTemplate = function () {
debugger;
templateService.citDownloadTemplate(constant.citImportFileType.BalanceSheetPrcAdjust).success(function (data, status, headers) {
var octetStreamMime = 'application/octet-stream';
var contentType = headers('content-type') || octetStreamMime;
if (window.navigator.msSaveBlob) {
var blob = new Blob([data], {
type: contentType
});
navigator.msSaveBlob(blob, "AdjustmentTable");
} else {
var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
if (urlCreator) {
var a = document.createElement('a');
var blob = new Blob([data], {
type: contentType
});
var url = urlCreator.createObjectURL(blob);
a.href = url;
a.target = '_blank';
a.download = "BalanceSheetPrcAdjust.xlsx";
document.body.appendChild(a);
a.click();
}
}
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
};
//开始
(function initialize() {
debugger;
......
......@@ -14,6 +14,7 @@
controller: 'importCitBalanceSheetPrcAdjustCon',
link: function (scope, element) {
$('.main-contents')[0].style.width = "260px";
$('.data-import-contents')[0].style.display = "block";
$('.main-contents')[0].style.float = "left";
$('.main-contents')[0].style.styleFloat = "left";
$('.main-contents')[0].style.cssFloat = "left";
......
commonModule.controller('importCitDaftAccountMappingCon', ['$scope', '$log', '$translate', '$timeout', '$q', '$interval'
, 'apiInterceptor', 'Upload', 'citImportDataService', 'SweetAlert', 'uiGridConstants', '$uibModal'
, 'vatSessionService', 'enums', 'vatOperationLogService','$anchorScroll','$location',
, 'vatSessionService', 'enums', 'vatOperationLogService','templateService',
function ($scope, $log, $translate, $timeout, $q, $interval
, apiInterceptor, Upload, citImportDataService, SweetAlert, uiGridConstants, $uibModal
, vatSessionService, enums, vatOperationLogService, $anchorScroll,$location) {
, vatSessionService, enums, vatOperationLogService, templateService) {
'use strict';
// $anchorScroll.yOffset=55;
// $location.hash('top');
......@@ -383,6 +383,36 @@
ele1.datepicker("setDate", $scope.selectedDate);
};
$scope.downloadTemplate = function () {
debugger;
templateService.citDownloadTemplate(constant.citImportFileType.DraftAccountMapping).success(function (data, status, headers) {
var octetStreamMime = 'application/octet-stream';
var contentType = headers('content-type') || octetStreamMime;
if (window.navigator.msSaveBlob) {
var blob = new Blob([data], {
type: contentType
});
navigator.msSaveBlob(blob, "AdjustmentTable");
} else {
var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
if (urlCreator) {
var a = document.createElement('a');
var blob = new Blob([data], {
type: contentType
});
var url = urlCreator.createObjectURL(blob);
a.href = url;
a.target = '_blank';
a.download = "DraftAccountMapping.xlsx";
document.body.appendChild(a);
a.click();
}
}
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
};
//开始
(function initialize() {
debugger;
......
......@@ -14,6 +14,7 @@
controller: 'importCitDaftAccountMappingCon',
link: function (scope, element) {
$('.main-contents')[0].style.width = "260px";
$('.data-import-contents')[0].style.display = "block";
$('.main-contents')[0].style.float = "left";
$('.main-contents')[0].style.styleFloat = "left";
$('.main-contents')[0].style.cssFloat = "left";
......
commonModule.controller('importCitEamAssetsDisposalCon', ['$scope', '$log', '$translate', '$timeout', '$q', '$interval'
, 'apiInterceptor', 'Upload', 'citImportDataService', 'SweetAlert', 'uiGridConstants', '$uibModal'
, 'vatSessionService', 'enums', 'vatOperationLogService','$anchorScroll','$location',
, 'vatSessionService', 'enums', 'vatOperationLogService','templateService',
function ($scope, $log, $translate, $timeout, $q, $interval
, apiInterceptor, Upload, citImportDataService, SweetAlert, uiGridConstants, $uibModal
, vatSessionService, enums, vatOperationLogService, $anchorScroll,$location) {
, vatSessionService, enums, vatOperationLogService, templateService) {
'use strict';
// $anchorScroll.yOffset=55;
// $location.hash('top');
......@@ -383,6 +383,36 @@
ele1.datepicker("setDate", $scope.selectedDate);
};
$scope.downloadTemplate = function () {
debugger;
templateService.citDownloadTemplate(constant.citImportFileType.EAMAssetsDisposal).success(function (data, status, headers) {
var octetStreamMime = 'application/octet-stream';
var contentType = headers('content-type') || octetStreamMime;
if (window.navigator.msSaveBlob) {
var blob = new Blob([data], {
type: contentType
});
navigator.msSaveBlob(blob, "AdjustmentTable");
} else {
var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
if (urlCreator) {
var a = document.createElement('a');
var blob = new Blob([data], {
type: contentType
});
var url = urlCreator.createObjectURL(blob);
a.href = url;
a.target = '_blank';
a.download = "EAMAssetsDisposal.xlsx";
document.body.appendChild(a);
a.click();
}
}
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
};
//开始
(function initialize() {
debugger;
......
......@@ -14,6 +14,7 @@
controller: 'importCitEamAssetsDisposalCon',
link: function (scope, element) {
$('.main-contents')[0].style.width = "260px";
$('.data-import-contents')[0].style.display = "block";
$('.main-contents')[0].style.float = "left";
$('.main-contents')[0].style.styleFloat = "left";
$('.main-contents')[0].style.cssFloat = "left";
......
commonModule.controller('importCitJournalAdjustController', ['$scope', '$log', '$translate', '$timeout', '$q', '$interval'
, 'apiInterceptor', 'Upload', 'citImportDataService', 'SweetAlert', 'uiGridConstants', '$uibModal'
, 'vatSessionService', 'enums', 'vatOperationLogService','$anchorScroll','$location',
, 'vatSessionService', 'enums', 'vatOperationLogService','templateService',
function ($scope, $log, $translate, $timeout, $q, $interval
, apiInterceptor, Upload, citImportDataService, SweetAlert, uiGridConstants, $uibModal
, vatSessionService, enums, vatOperationLogService, $anchorScroll,$location) {
, vatSessionService, enums, vatOperationLogService, templateService) {
'use strict';
// $anchorScroll.yOffset=55;
// $location.hash('top');
......@@ -384,6 +384,36 @@ debugger;
ele1.datepicker("setDate", $scope.selectedDate);
};
$scope.downloadTemplate = function () {
debugger;
templateService.citDownloadTemplate(constant.citImportFileType.JournalAdjust).success(function (data, status, headers) {
var octetStreamMime = 'application/octet-stream';
var contentType = headers('content-type') || octetStreamMime;
if (window.navigator.msSaveBlob) {
var blob = new Blob([data], {
type: contentType
});
navigator.msSaveBlob(blob, "AdjustmentTable");
} else {
var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
if (urlCreator) {
var a = document.createElement('a');
var blob = new Blob([data], {
type: contentType
});
var url = urlCreator.createObjectURL(blob);
a.href = url;
a.target = '_blank';
a.download = "JournalAdjust.xlsx";
document.body.appendChild(a);
a.click();
}
}
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
};
//开始
(function initialize() {
debugger;
......
......@@ -14,6 +14,7 @@
controller: 'importCitJournalAdjustController',
link: function (scope, element) {
$('.main-contents')[0].style.width = "260px";
$('.data-import-contents')[0].style.display = "block";
$('.main-contents')[0].style.float = "left";
$('.main-contents')[0].style.styleFloat = "left";
$('.main-contents')[0].style.cssFloat = "left";
......
commonModule.controller('importCitProfitPrcAdjustCon', ['$scope', '$log', '$translate', '$timeout', '$q', '$interval'
, 'apiInterceptor', 'Upload', 'citImportDataService', 'SweetAlert', 'uiGridConstants', '$uibModal'
, 'vatSessionService', 'enums', 'vatOperationLogService','$anchorScroll','$location',
, 'vatSessionService', 'enums', 'vatOperationLogService','templateService',
function ($scope, $log, $translate, $timeout, $q, $interval
, apiInterceptor, Upload, citImportDataService, SweetAlert, uiGridConstants, $uibModal
, vatSessionService, enums, vatOperationLogService, $anchorScroll,$location) {
, vatSessionService, enums, vatOperationLogService, templateService) {
'use strict';
// $anchorScroll.yOffset=55;
// $location.hash('top');
......@@ -383,6 +383,36 @@
ele1.datepicker("setDate", $scope.selectedDate);
};
$scope.downloadTemplate = function () {
debugger;
templateService.citDownloadTemplate(constant.citImportFileType.ProfitPrcAdjust).success(function (data, status, headers) {
var octetStreamMime = 'application/octet-stream';
var contentType = headers('content-type') || octetStreamMime;
if (window.navigator.msSaveBlob) {
var blob = new Blob([data], {
type: contentType
});
navigator.msSaveBlob(blob, "AdjustmentTable");
} else {
var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
if (urlCreator) {
var a = document.createElement('a');
var blob = new Blob([data], {
type: contentType
});
var url = urlCreator.createObjectURL(blob);
a.href = url;
a.target = '_blank';
a.download = "ProfitPrcAdjust.xlsx";
document.body.appendChild(a);
a.click();
}
}
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
};
//开始
(function initialize() {
debugger;
......
......@@ -14,6 +14,7 @@
controller: 'importCitProfitPrcAdjustCon',
link: function (scope, element) {
$('.main-contents')[0].style.width = "260px";
$('.data-import-contents')[0].style.display = "block";
$('.main-contents')[0].style.float = "left";
$('.main-contents')[0].style.styleFloat = "left";
$('.main-contents')[0].style.cssFloat = "left";
......
commonModule.controller('importCitSalaryAdvanceCon', ['$scope', '$log', '$translate', '$timeout', '$q', '$interval'
, 'apiInterceptor', 'Upload', 'citImportDataService', 'SweetAlert', 'uiGridConstants', '$uibModal'
, 'vatSessionService', 'enums', 'vatOperationLogService','$anchorScroll','$location',
, 'vatSessionService', 'enums', 'vatOperationLogService','templateService',
function ($scope, $log, $translate, $timeout, $q, $interval
, apiInterceptor, Upload, citImportDataService, SweetAlert, uiGridConstants, $uibModal
, vatSessionService, enums, vatOperationLogService, $anchorScroll,$location) {
, vatSessionService, enums, vatOperationLogService, templateService) {
'use strict';
// $anchorScroll.yOffset=55;
// $location.hash('top');
......@@ -383,6 +383,36 @@
ele1.datepicker("setDate", $scope.selectedDate);
};
$scope.downloadTemplate = function () {
debugger;
templateService.citDownloadTemplate(constant.citImportFileType.SalaryAdvance).success(function (data, status, headers) {
var octetStreamMime = 'application/octet-stream';
var contentType = headers('content-type') || octetStreamMime;
if (window.navigator.msSaveBlob) {
var blob = new Blob([data], {
type: contentType
});
navigator.msSaveBlob(blob, "AdjustmentTable");
} else {
var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
if (urlCreator) {
var a = document.createElement('a');
var blob = new Blob([data], {
type: contentType
});
var url = urlCreator.createObjectURL(blob);
a.href = url;
a.target = '_blank';
a.download = "SalaryAdvance.xlsx";
document.body.appendChild(a);
a.click();
}
}
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
};
//开始
(function initialize() {
debugger;
......
......@@ -14,6 +14,7 @@
controller: 'importCitSalaryAdvanceCon',
link: function (scope, element) {
$('.main-contents')[0].style.width = "260px";
$('.data-import-contents')[0].style.display = "block";
$('.main-contents')[0].style.float = "left";
$('.main-contents')[0].style.styleFloat = "left";
$('.main-contents')[0].style.cssFloat = "left";
......
commonModule.controller('importCitTrialBalanceController', ['$scope', '$log', '$translate', '$timeout', '$q', '$interval'
, 'apiInterceptor', 'Upload', 'citImportDataService', 'SweetAlert', 'uiGridConstants', '$uibModal'
, 'vatSessionService', 'enums', 'vatOperationLogService','$anchorScroll','$location',
, 'vatSessionService', 'enums', 'vatOperationLogService','templateService',
function ($scope, $log, $translate, $timeout, $q, $interval
, apiInterceptor, Upload, citImportDataService, SweetAlert, uiGridConstants, $uibModal
, vatSessionService, enums, vatOperationLogService, $anchorScroll,$location) {
, vatSessionService, enums, vatOperationLogService, templateService) {
'use strict';
// $anchorScroll.yOffset=55;
// $location.hash('top');
......@@ -383,6 +383,36 @@
ele1.datepicker("setDate", $scope.selectedDate);
};
$scope.downloadTemplate = function () {
debugger;
templateService.citDownloadTemplate(constant.citImportFileType.TrialBalance).success(function (data, status, headers) {
var octetStreamMime = 'application/octet-stream';
var contentType = headers('content-type') || octetStreamMime;
if (window.navigator.msSaveBlob) {
var blob = new Blob([data], {
type: contentType
});
navigator.msSaveBlob(blob, "TrialBalance");
} else {
var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
if (urlCreator) {
var a = document.createElement('a');
var blob = new Blob([data], {
type: contentType
});
var url = urlCreator.createObjectURL(blob);
a.href = url;
a.target = '_blank';
a.download = "TrialBalance.xlsx";
document.body.appendChild(a);
a.click();
}
}
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
};
//开始
(function initialize() {
debugger;
......
......@@ -14,6 +14,7 @@
controller: 'importCitTrialBalanceController',
link: function (scope, element) {
$('.main-contents')[0].style.width = "260px";
$('.data-import-contents')[0].style.display = "block";
$('.main-contents')[0].style.float = "left";
$('.main-contents')[0].style.styleFloat = "left";
$('.main-contents')[0].style.cssFloat = "left";
......
......@@ -128,6 +128,9 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
getTemplateJson: getTemplateJson,
downloadTemplate: function (fileType) {
return $http.get('/template/file/downloadTemplate?fileType=' + fileType , apiConfig.create({ responseType: 'arraybuffer' }));
},
citDownloadTemplate: function (fileType) {
return $http.get('/template/file/downloadTemplate?fileType=' + fileType + '&serviceType=' + 1 , apiConfig.create({ responseType: 'arraybuffer' }));
}
};
}]);
\ No newline at end of file
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