Commit f76ca39d authored by chase's avatar chase

merge

parent 8328fd4b
......@@ -50,8 +50,7 @@ public class TaxDocumentController {
@PostMapping("add")
@ResponseBody
public boolean addTaxDocument(@RequestBody TaxDocument taxDocument,
@RequestPart("file") MultipartFile file,
@RequestParam(required = false) String modual) {
@RequestParam MultipartFile file) {
return taxDocumentService.addTaxDocumentList(file,taxDocument);
}
......
......@@ -53,9 +53,13 @@ public class TaxDocumentServiceImpl {
if(CollectionUtils.isNotEmpty(uploadDetail.getList())){
urlMap = uploadDetail.getList().stream().collect(Collectors.toMap(DidiFileUploadDetailResult::getUid, didiFileUploadDetailResult -> didiFileUploadDetailResult.getViewHttpUrl()));
}
for(TaxDocument data:dataList){
data.setFilePositionUrl(urlMap.get(data.getFileUploadId()));
if(urlMap!=null){
for(TaxDocument data:dataList){
data.setFilePositionUrl(urlMap.get(data.getFileUploadId()));
}
}
return dataList;
}
......@@ -87,7 +91,7 @@ public class TaxDocumentServiceImpl {
}
//档案名称 fileName
if (StringUtils.isNotBlank(taxDocumentDto.getFileName())) {
criteria.andFileNameEqualTo(taxDocumentDto.getFileName());
criteria.andFileNameLike(taxDocumentDto.getFileName());
}
//业务线 businessLine
if (StringUtils.isNotBlank(taxDocumentDto.getBusinessLine())) {
......
......@@ -2,8 +2,8 @@
* Created by Administrator on 2019/3/1 0001.
*/
taxDocumentManageModule.controller('taxDocumentListController',
['$log', '$http', '$q', '$scope', '$translate', '$timeout', 'SweetAlert', '$compile', 'taxDocumentListService', '$filter',
function ($log, $http, $q, $scope, $translate, $timeout, SweetAlert, $compile, taxDocumentListService, $filter) {
['$log', '$http', '$q', '$scope', '$translate', '$timeout', 'SweetAlert', '$compile', 'taxDocumentListService', '$filter','apiInterceptor',
function ($log, $http, $q, $scope, $translate, $timeout, SweetAlert, $compile, taxDocumentListService, $filter,apiInterceptor) {
$scope.queryFieldModel = {};
$scope.editFieldModel = {
......@@ -267,13 +267,25 @@ taxDocumentManageModule.controller('taxDocumentListController',
var uploadItem = $scope.uploader.queue[0];
var fileName = uploadItem._file ? uploadItem._file.name : uploadItem.name;
uploadItem.formData = [
{originFileName:fileName}
{originFileName:fileName},
];
Object.keys($scope.editFieldModel).forEach(function(key){
var fields = {};
if(/(ownTime|fileTime|effectiveTime)/.test(key)){
fields[key] = $scope.editFieldModel[key].split("-").join("/");
}else{
fields[key] = $scope.editFieldModel[key];
}
uploadItem.formData.push(fields);
});
// data == true,代表可以直接上传,否则属于覆盖行为
if (data === true) {
$scope.uploader.url = apiInterceptor.webApiHostUrl + "/taxDoc/add";
$scope.uploader.uploadItem(0);
$scope.isCoverOperation = false;
$('#busy-indicator-container').show();
// addLogicAfterUploadFile($scope.editFieldModel,'simple');
} else {
SweetAlert.swal({
......@@ -289,7 +301,11 @@ taxDocumentManageModule.controller('taxDocumentListController',
},
function (isConfirm) {
if (isConfirm) {
$scope.uploader.url = apiInterceptor.webApiHostUrl + "/taxDoc/edit";
$scope.uploader.uploadItem(0);
// editDocFileRecord($scope.editFieldModel, 'simple');
$('#busy-indicator-container').show();
$scope.isCoverOperation = true;
}
})
......@@ -439,13 +455,11 @@ taxDocumentManageModule.controller('taxDocumentListController',
}
});
taxDocumentListService.getCompanyNameOptions().then(function(res){
if (res && 0 === res.code) {
angular.forEach(res.data, function (item) {
$scope.companyNameOptionsMap[item.id]=item.name;
});
console.log($scope.companyNameOptionsMap)
} else {
SweetAlert.error($translate.instant('RevenueGetOrgError'));
}
......@@ -475,7 +489,7 @@ taxDocumentManageModule.controller('taxDocumentListController',
$scope.cancelDocFileType = cancelDocFileType;
})();
}])
}]);
taxDocumentManageModule.directive("multiDatePicker", function () {
return {
restrict: "EA",
......@@ -624,7 +638,7 @@ taxDocumentManageModule.directive('fileUploader',function () {
$("#uploadFilePlugin").click();
};
$scope.uploader = new FileUploader({
url: "http://etms.longi-silicon.com:8180/api/v1/taxDoc/upload",
url: apiInterceptor.webApiHostUrl + "/taxDoc/add",
// autoUpload: true,//添加后,自动上传
headers:{"Authorization":apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken()},
removeAfterUpload:true,
......@@ -632,20 +646,14 @@ taxDocumentManageModule.directive('fileUploader',function () {
$scope.uploader.filters.push({//xls限制
name: 'fileTypeFilter',
fn: function (item, options) {
// var type = item.name.split(".").pop();
// var matchResult = /xlsx|xls|pdf/i.test(type);
var fileNativePath = $("#uploadFilePlugin")[0].value;
var splitMark = /\//.test(fileNativePath) ? "/" : "\\";
var prevPath = fileNativePath.split(splitMark);
prevPath.pop();
fileNativePath = prevPath.join(splitMark) + splitMark;
// if(matchResult){
$scope.uploader.clearQueue();
$scope.editFieldModel.fileNativePath = fileNativePath;
$scope.editFieldModel.fileName = item.name;
// $scope.uploader.addToQueue($("#uploadFilePlugin")[0].files[0]);
// $scope.uploader.queue[0] = $("#uploadFilePlugin")[0].files[0];
// }
return true;
}
});
......@@ -654,23 +662,39 @@ taxDocumentManageModule.directive('fileUploader',function () {
});
$scope.uploader.onErrorItem = function(fileItem, response, status, headers) {
SweetAlert.warning($translate.instant('FailUpload'));
$scope.uploader.clearQueue();
// $scope.uploader.cancelItem();
// $scope.uploader.clearQueue();
$scope.editFieldModel = {};
// console.info('onErrorItem', fileItem, response, status, headers);
$('#busy-indicator-container').hide();
};
// $scope.uploader.onCancelItem = function(fileItem, response, status, headers) {
// console.info('onCancelItem', fileItem, response, status, headers);
// };
$scope.uploader.onSuccessItem = function(fileItem, response, status, headers) {
fileItem.filePositionUrl = response;
$scope.editFieldModel.filePositionUrl = response;
// fileItem.filePositionUrl = response;
// $scope.editFieldModel.filePositionUrl = response;
var title = $translate.instant("Uploaded");
if($scope.isCoverOperation) {
$scope.coverDocFileRecord($scope.editFieldModel, 'simple');
title = $translate.instant("Edited");
// $scope.coverDocFileRecord($scope.editFieldModel, 'simple');
} else {
$scope.addLogicAfterUploadFile($scope.editFieldModel, 'simple');
title = $translate.instant("Uploaded");
// $scope.addLogicAfterUploadFile($scope.editFieldModel, 'simple');
}
// console.info('onSuccessItem', arguments);
SweetAlert.swal({
title:title,
type: "success",
confirmButtonText: $translate.instant('Confirm'),
closeOnConfirm: true
},
function (isConfirm) {
if(isConfirm) $scope.loadMainData();
});
$('#simpleUploadPopDialog').modal('hide');
};
}]
}
......@@ -709,7 +733,6 @@ taxDocumentManageModule.directive('multiFileUploader',function () {
},500);
$scope.multiUploader = new FileUploader({
url: "http://etms.longi-silicon.com:8180/api/v1/taxDoc/upload",
// autoUpload: true,//添加后,自动上传
headers:{"Authorization":apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken()},
removeAfterUpload:true,
......@@ -717,9 +740,6 @@ taxDocumentManageModule.directive('multiFileUploader',function () {
$scope.multiUploader.filters.push({//xls限制
name: 'fileTypeFilter',
fn: function (item, options) {
// var type = item.name.split(".").pop();
// var matchResult = /xlsx|xls|pdf/i.test(type);
// if(matchResult){
var fileNativePath = $("#multiUploadFilePlugin")[0].value;
var splitMark = /\//.test(fileNativePath) ? "/" : "\\";
var prevPath = fileNativePath.split(splitMark);
......@@ -730,8 +750,6 @@ taxDocumentManageModule.directive('multiFileUploader',function () {
fileName:item.name,
iShow:$scope.editFieldModel_multi.length === 0
});
// }
// 根据需求,改为不做类型限制
return true;
}
......@@ -751,55 +769,59 @@ taxDocumentManageModule.directive('multiFileUploader',function () {
$scope.multiUploadSuccessItems = [];
$scope.multiUploader.onCompleteAll = function () {
if($scope.multiUploadErrorItems.length >=5){
//如果上传错误大于5个,直接取消上传行为
console.info("失败数量:",$scope.multiUploadErrorItems);
SweetAlert.warning($translate.instant('UploadLimit'));
}else{
console.info("成功数量:",$scope.multiUploadSuccessItems);
//先探测有没有覆盖的情况
$scope.editFieldModel_multi.forEach(function(fieldItem){
taxDocumentListService.verifyDuplicate(fieldItem).then(function(data){
//$scope.multiUploadSuccessItems的长度可以用作判断上传是否已经完成
$scope.multiUploadSuccessItems.shift();
if (data === true) {
$scope.addLogicAfterUploadFile(fieldItem,'multi');
} else {
$scope.coverDocFileRecord(fieldItem,'multi');
}
});
});
}
$scope.multiUploader.clearQueue();
$("#uploadResultPop").modal("show");
$('#multiUploadPopDialog').modal('hide');
// $scope.multiUploader.clearQueue();
};
$scope.multiUploader.onSuccessItem = function(fileItem,response) {
fileItem.filePositionUrl = response;
// fileItem.filePositionUrl = response;
$scope.multiUploadSuccessItems.push(fileItem);
// 存储返回的URL
$scope.editFieldModel_multi.forEach(function(modelItem){
if(modelItem.fileName === fileItem._file.name){
modelItem.filePositionUrl = response;
}
});
};
$scope.multiUploadSubmit = function(){
$scope.multiUploadErrorItems = [];
$scope.multiUploadSuccessItems = [];
for(var i = 0; i < $scope.multiUploader.queue.length;i++){
// 先设置uploader队列里每个文件的请求参数:fileOriginalName
var fileItem = $scope.multiUploader.queue[i];
fileItem.formData = [{
fileOriginName:fileItem._file.name
fileOriginName:fileItem.name ? fileItem.name : fileItem._file.name
}];
var editFieldModel = $scope.editFieldModel_multi[i];
Object.keys(editFieldModel).forEach(function(key){
var fields = {};
if(/(ownTime|fileTime|effectiveTime)/.test(key)){
fields[key] = editFieldModel[key].split("-").join("/");
}else{
fields[key] = editFieldModel[key];
}
fileItem.formData.push(fields);
});
(function(_i,_fileItem,_editFieldModel,_taxDocumentListService,_multiUploader){
_taxDocumentListService.verifyDuplicate(_editFieldModel).then(function(data){
if (data === true) {
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/add";
} else {
_fileItem.url = apiInterceptor.webApiHostUrl + "/taxDoc/edit";
}
_multiUploader.uploadItem(_i);
});
})(i,fileItem,editFieldModel,taxDocumentListService,$scope.multiUploader);
$scope.multiUploader.uploadItem(i);
}
}
};
$scope.confirmUploadResult = function(){
$('#uploadResultPop').modal('hide');
$scope.loadMainData();
};
}]
}
});
......@@ -839,7 +861,45 @@ taxDocumentManageModule.directive('filePreview',function(){
SweetAlert.warning($translate.instant('UnFile'));
}
};*/
$scope.currentSheetName = '';
var sheetCurPageIndex = 0;
var sheetSumPages = 1;
var sheetPromise = null;
var cacheUrl = null;
$scope.prevPaging_xls = function(){
if(sheetCurPageIndex <= 0) return sheetCurPageIndex = 0;
sheetCurPageIndex --;
sheetPromise.then(function(resData){renderXLS(resData)})
};
$scope.nextPaging_xls = function(){
if(sheetCurPageIndex >= (sheetSumPages - 1)) return sheetCurPageIndex = sheetSumPages - 1;
sheetCurPageIndex ++;
sheetPromise.then(function(resData){renderXLS(resData)})
};
function getXLS(url){
// return taxDocumentListService.getBinaryData('./bundles/MS Function list - Phase 1.xlsx');
return taxDocumentListService.getBinaryData(url);
}
function renderXLS(resData){
try{
var wb = window.XLSX.read(resData, {type:"array"});
sheetSumPages = wb.SheetNames.length;
$scope.currentSheetName = wb.SheetNames[sheetCurPageIndex];
var data = window.XLSX.utils.sheet_to_json(wb.Sheets[$scope.currentSheetName]);
// console.log(data);
if(data && data.length){
$scope.filePreview_dataGridUpdate(data);
$("#filePreviewPop").modal("show");
}
}catch(e){
SweetAlert.warning(e.message);
}
}
$scope.viewRemoteFile = function (fileName, filePositionUrl) {
if(typeof filePositionUrl !== 'string'
|| filePositionUrl === 'null'
......@@ -849,19 +909,12 @@ taxDocumentManageModule.directive('filePreview',function(){
//区分文件类型
var fileType = fileName.split(".").pop();
if(/xlsx|xls/i.test(fileType)){
taxDocumentListService.getBinaryData(filePositionUrl).then(function(resData){
try{
var wb = window.XLSX.read(resData, {type:"array"});
var data = window.XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);
// console.log(data);
if(data && data.length){
$scope.filePreview_dataGridUpdate(data);
$("#filePreviewPop").modal("show");
}
}catch(e){
SweetAlert.warning(e.message);
}
});
if(cacheUrl !== filePositionUrl){
cacheUrl = filePositionUrl;
sheetPromise = getXLS(filePositionUrl);
}
sheetPromise.then(function(resData){renderXLS(resData)})
}
else if(/pdf/i.test(fileType)){
// return SweetAlert.warning('暂时不支持PDF预览');
......@@ -936,7 +989,7 @@ taxDocumentManageModule.directive('filePreview',function(){
rowAlternationEnabled: true, //单双行颜色
};
var dataGrid = $('<div dx-data-grid="filePreview_dataGridOptions">');
$("#preview_dataGrid").append(dataGrid);
$("#preview_dataGrid").html("").append(dataGrid);
$compile(dataGrid)($scope);
};
......@@ -981,12 +1034,12 @@ taxDocumentManageModule.directive('pdfPreview',function(){
container.style.display = "none";
};
$scope.prevPaging = function(){
if(pdfCurPageIndex === 1) return;
if(pdfCurPageIndex <= 1) return pdfCurPageIndex = 1;
pdfCurPageIndex --;
pdfPromise.then(function(pdf){renderPdf(pdf)})
};
$scope.nextPaging = function(){
if(pdfCurPageIndex === pdfSumPages) return;
if(pdfCurPageIndex >= pdfSumPages) return pdfCurPageIndex = pdfSumPages;
pdfCurPageIndex ++;
pdfPromise.then(function(pdf){renderPdf(pdf)})
};
......
......@@ -355,6 +355,7 @@
<div class="TDL-query-val">
<select ng-model="queryFieldModel.companyName" class="form-control radius3"
title="{{queryFieldModel.companyName}}" required placeholder="{{'PleaseSelected' | translate}}">
<option selected></option>
<option ng-repeat="(key,companyName) in companyNameOptionsMap"
ng-click="queryFieldModel.companyId = key"
value="{{companyName}}">{{companyName}}</option>
......@@ -614,7 +615,7 @@
{{'Duration' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<input type='text' placeholder="{{'PleaseSelected' | translate}}" date-time-picker data-date-format="yyyy-mm-dd" style="width:320px;"
<input type='text' placeholder="{{'PleaseSelected' | translate}}" date-time-picker data-date-format="yyyy/mm/dd" style="width:320px;"
class="form-control" ng-model="editFieldModel.ownTime" required
data-min-view="2"/>
</div>
......@@ -624,7 +625,7 @@
{{'AvailabilityDate' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<input type='text' placeholder="{{'PleaseSelected' | translate}}" date-time-picker data-date-format="yyyy-mm-dd" style="width:320px;"
<input type='text' placeholder="{{'PleaseSelected' | translate}}" date-time-picker data-date-format="yyyy/mm/dd" style="width:320px;"
class="form-control" ng-model="editFieldModel.fileTime"
data-min-view="2"/>
</div>
......@@ -632,7 +633,7 @@
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label" translate="DueDate"></label>
<div class="col-sm-11" style="width:61.67%">
<input type='text' placeholder="{{'PleaseSelected' | translate}}" date-time-picker data-date-format="yyyy-mm-dd" style="width:320px;"
<input type='text' placeholder="{{'PleaseSelected' | translate}}" date-time-picker data-date-format="yyyy/mm/dd" style="width:320px;"
class="form-control" ng-model="editFieldModel.effectiveTime"
data-min-view="2"/>
</div>
......@@ -821,7 +822,7 @@
{{'Duration' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<input type='text' placeholder="{{'PleaseSelected' | translate}}" date-time-picker data-date-format="yyyy-mm-dd" style="width:280px;"
<input type='text' placeholder="{{'PleaseSelected' | translate}}" date-time-picker data-date-format="yyyy/mm/dd" style="width:280px;"
class="form-control" ng-model="editFieldItem.ownTime" required
data-min-view="2"/>
</div>
......@@ -831,7 +832,7 @@
{{'AvailabilityDate' | translate}}
</label>
<div class="col-sm-11" style="width:61.67%">
<input type='text' placeholder="{{'PleaseSelected' | translate}}" date-time-picker data-date-format="yyyy-mm-dd" style="width:280px;"
<input type='text' placeholder="{{'PleaseSelected' | translate}}" date-time-picker data-date-format="yyyy/mm/dd" style="width:280px;"
class="form-control" ng-model="editFieldItem.fileTime"
data-min-view="2"/>
</div>
......@@ -839,7 +840,7 @@
<div class="col-sm-6 form-group">
<label class="col-sm-3 control-label" translate="DueDate"></label>
<div class="col-sm-11" style="width:61.67%">
<input type='text' placeholder="{{'PleaseSelected' | translate}}" date-time-picker data-date-format="yyyy-mm-dd" style="width:280px;"
<input type='text' placeholder="{{'PleaseSelected' | translate}}" date-time-picker data-date-format="yyyy/mm/dd" style="width:280px;"
class="form-control" ng-model="editFieldItem.effectiveTime"
data-min-view="2"/>
</div>
......@@ -903,7 +904,7 @@
<div class="modal-content">
<div class="modal-header">
<span class="close" data-dismiss="modal" aria-hidden="true" ng-click="hideFilePreviewPop()">×</span>
<div class="modal-title">{{fileName}}</div>
<div class="modal-title">{{currentSheetName}}</div>
</div>
<div class="modal-body">
<div class="dx-viewport demo-container" id="preview_dataGrid">
......@@ -911,6 +912,37 @@
</div>
</div>
<button class="TDL-pdf-paging-btn TDL-pdf-paging-btn-prev" ng-click="prevPaging_xls()" title="上一页">&lt;</button>
<button class="TDL-pdf-paging-btn TDL-pdf-paging-btn-next" ng-click="nextPaging_xls()" title="下一页">&gt;</button>
</div>
</div>
<div class="modal fade" id="uploadResultPop" tabindex="-1" role="dialog" aria-labelledby="myModal" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" style="width:80%;" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title">提示讯息</div>
</div>
<div class="modal-body">
<p ng-if="multiUploadSuccessItems.length">{{multiUploadSuccessItems.length}}个档案上传成功</p>
<ul>
<li ng-repeat="item in multiUploadSuccessItems">
<span>{{item._file.name}}</span>
</li>
</ul>
<p ng-if="multiUploadErrorItems.length">{{multiUploadErrorItems.length}}个档案上传失败</p>
<ul>
<li ng-repeat="item in multiUploadErrorItems">
<span>{{item._file.name}}</span>
</li>
</ul>
</div>
<div class="modal-footer">
<button class="btn btn-primary" translate="Confirm" ng-click="confirmUploadResult()"></button>
<!--<button type="button" class="btn btn-third" data-dismiss="modal" translate="Cancel"></button>-->
</div>
</div>
</div>
</div>
......
......@@ -2,8 +2,8 @@
* Created by Administrator on 2019/3/1 0001.
*/
taxDocumentManageModule.factory('taxDocumentListService',
['$q', 'apiConfig', 'jqFetch','apiInterceptor',
function ($q, apiConfig, jqFetch,apiInterceptor) {
['$q', 'apiConfig', 'jqFetch', 'apiInterceptor',
function ($q, apiConfig, jqFetch, apiInterceptor) {
'use strict';
return {
fetchMainList: function (params) {
......@@ -15,33 +15,35 @@ taxDocumentManageModule.factory('taxDocumentListService',
editRecord: function (params) {
return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/edit', params);
},
verifyDuplicate:function(params){
verifyDuplicate: function (params) {
return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/queryWhetherData', params);
},
getFileInfoOptions:function(params){
getFileInfoOptions: function (params) {
return jqFetch.post(apiInterceptor.webApiHostUrl + '/fileTypes/query4SelectionBox', params);
},
getCompanyNameOptions:function(params){
getCompanyNameOptions: function (params) {
return jqFetch.get(apiInterceptor.webApiHostUrl + '/org/getMyOrgList', params);
},
delFileRecordItems:function(params){
delFileRecordItems: function (params) {
return jqFetch.post(apiInterceptor.webApiHostUrl + '/taxDoc/batchDelete', params);
},
getBinaryData:function(url){
getBinaryData: function (url) {
var defer = $q.defer();
var oReq = new XMLHttpRequest();
oReq.onload = function(e) {
oReq.onload = function (e) {
var arraybuffer = oReq.response;
console.info("arraybuffer:",arraybuffer);
console.info("arraybuffer:", arraybuffer);
defer.resolve(arraybuffer);
};
// oReq.open("GET", 'http://47.94.233.173:11007/static/erp_tax_system/3221D133-85B8-4E22-AE9B-DBEBD942D217?expire=1552361736&signiture=_Wz1_8Z6T8h5qnZAGpoRa8kNZeqmE7KoztKeehzYK4U=', true);
oReq.open("GET", url, true);
oReq.responseType = "arraybuffer";
oReq.send();
// return jqFetch.get(url,{},'arraybuffer');
return defer.promise;
}
};
}]);
\ 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