Commit e3456e49 authored by chase's avatar chase

merge档案管理

parent 8aed3bca
......@@ -311,16 +311,9 @@ public class TaxDocumentServiceImpl {
public boolean editFilesType(TaxDocument taxDocument) {
try {
TaxDocumentExample taxDocumentExample = new TaxDocumentExample();
taxDocumentExample.createCriteria().andFileNameEqualTo(taxDocument.getFileName());
List<TaxDocument> list = taxDocumentMapper.selectByExample(taxDocumentExample);
if (list.size() > 0) {
return false;
}
//更新上传时间和文件名称
taxDocument.setUpdateTime(new Date());
taxDocument.setUploadTime(new Date());
int num = taxDocumentMapper.updateByPrimaryKey(taxDocument);
if (num > 0) {
OperationLogTaxDocument actionEntity = buildOperationLogTaxDocument();
......
......@@ -341,7 +341,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
var row_height = $("table").find("tr").height();
if (row_height) {
return {
height: (row_height * 12) + "px"
height:(row_height*12+18)+"px"
}
}
};
......@@ -1576,13 +1576,13 @@ taxDocumentManageModule.directive('pdfPreview', function () {
restrict: 'EA',
controller: ['$scope','taxDocumentListService', function ($scope,taxDocumentListService) {
window.PDFJS.workerSrc = './bundles/pdf.worker.js';
var canvas = document.getElementById('the-canvas');
var context = canvas.getContext('2d');
var pdfCurPageIndex = 1;
var pdfSumPages = 1;
// var canvas = document.getElementById('the-canvas');
// var context = canvas.getContext('2d');
// var pdfCurPageIndex = 1;
// var pdfSumPages = 1;
var container = document.getElementById("pdfLayoutDialog");
var pdfPromise = null;
var cacheUrl = null;
// var pdfPromise = null;
// var cacheUrl = null;
$scope.openPdfPreviewPop_bak = function (url) {
container.style.display = "block";
if (cacheUrl !== url) {
......@@ -1593,37 +1593,32 @@ taxDocumentManageModule.directive('pdfPreview', function () {
renderPdf(pdf)
})
};
$scope.openPdfPreviewPop = function (url) {
container.style.display = "block";
function start() {
return new Promise(function (resolve, reject){
resolve('start');
});
}
start().then(function(data) {
console.log('result of start: ', data);
return taxDocumentListService.readPDF({path:url});
}).then(function(dataURL) {
var pdfData=null;
if(typeof dataURL =="string"){
pdfData = convertDataURIToBinary(dataURL);
$scope.openPdfPreviewPop = function (url)
{
var params={path:url};
taxDocumentListService.readPDF(params).then(function (data, status, headers) {
if(status===204){
SweetAlert.warning("没有数据可以下载");
return;
}
console.log(pdfData);
return window.PDFJS.getDocument({data:pdfData});
}).then(function(data) {
pdfSumPages = data.numPages;
return data.getPage(pdfCurPageIndex);
}).then(function(page){
var scale = 1.5;
var viewport = page.getViewport(scale);
canvas.height = viewport.height;
canvas.width = viewport.width;
var renderContext = {
canvasContext: context,
viewport: viewport
container.style.display = "block";
var blob=data;
var img = document.createElement('img');
var myBlob = new window.Blob([blob], {type: 'image/png'});
console.log(myBlob);
var qrUrl = window.URL.createObjectURL(myBlob);
img.src = qrUrl;
img.onload = function () {
window.URL.revokeObjectURL(qrUrl);
$("div.busy-indicator-container").removeClass("busy-indicator-container");
$(".TDL-content-container")[0].style.display="none";
$(".TDL-header")[0].style.display="none";
$(".navbar-custom-top")[0].style.display="none";
container.append(img);
};
page.render(renderContext);
});
},function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
})
};
function convertDataURIToBinary(dataURI) { //将encodeBase64解码
var raw = window.atob(dataURI);
......
......@@ -306,6 +306,8 @@
}
.TDL-pdf-layout-dialog {
text-align: center;
float: top;
display: none;
}
......@@ -1462,14 +1464,10 @@
</div>
</div>
<div class="TDL-pdf-layout-dialog" id="pdfLayoutDialog" pdf-preview>
<div class="wrapper TDL-pdf-preview-pop" id="pdfContainer">
<div class="TDL-pdf-layout-dialog" id="pdfLayoutDialog" pdf-preview>
<div id="pdfContainer" style="width:0px;height:0px;overflow: hidden;">
<canvas id="the-canvas"></canvas>
</div>
<button class="TDL-pdf-preview-pop-close-btn" ng-click="closePdfPop()">×</button>
<button class="TDL-pdf-paging-btn TDL-pdf-paging-btn-prev" ng-click="prevPaging()" title="上一页">&lt;</button>
<button class="TDL-pdf-paging-btn TDL-pdf-paging-btn-next" ng-click="nextPaging()" title="下一页">&gt;</button>
</div>
<div class="modal fade" id="imgLayoutDialog" img-preview tabindex="-1" role="dialog" aria-labelledby="myModal"
......
......@@ -134,7 +134,21 @@ taxDocumentManageModule.factory('taxDocumentListService',
return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/previewExcelToJson', params);
},
readPDF:function(params){
return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/previewPDF', params);
$('#busy-indicator-container').show();
var defer = $q.defer();
var xhr = new XMLHttpRequest();
xhr.onload = function(result) {
if (this.status == 200) {
var blob = this.response;
defer.resolve(blob,xhr.status,xhr.getAllResponseHeaders());
}
};
xhr.open("post", apiInterceptor.webApiHostUrl + "/taxDoc/previewPDF", true);
xhr.setRequestHeader("Authorization", apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken());
xhr.setRequestHeader("Content-Type", 'application/json;charset=UTF-8');
xhr.responseType="blob";
xhr.send(JSON.stringify(params));
return defer.promise;
},
getBinaryData:function(url){
var defer = $q.defer();
......
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