Commit d28dd2cc authored by kevin's avatar kevin

Merge branch 'dev_mysql' of http://code.tech.tax.asia.pwcinternal.com/root/atms into dev_mysql

parents e60b519b aa1a4474
package pwc.taxtech.atms.common; package pwc.taxtech.atms.common;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Optional; import java.util.Optional;
public class POIUtil { public class POIUtil {
...@@ -88,6 +91,13 @@ public class POIUtil { ...@@ -88,6 +91,13 @@ public class POIUtil {
} }
public static void cloneSheetAndStyle(Sheet sheet, Sheet targetSheet,Workbook tWorkbook) { public static void cloneSheetAndStyle(Sheet sheet, Sheet targetSheet,Workbook tWorkbook) {
//设置合并单元格
List<CellRangeAddress> merges = sheet.getMergedRegions();
if(CollectionUtils.isNotEmpty(merges)){
for(CellRangeAddress merge : merges){
targetSheet.addMergedRegion(merge);
}
}
for (int r = sheet.getFirstRowNum(); r <= sheet.getLastRowNum(); r++) { for (int r = sheet.getFirstRowNum(); r <= sheet.getLastRowNum(); r++) {
Row row = sheet.getRow(r); Row row = sheet.getRow(r);
if (null == row) { if (null == row) {
......
...@@ -12,7 +12,8 @@ public enum EnumImportType { ...@@ -12,7 +12,8 @@ public enum EnumImportType {
CertifiedInvoicesList(8), CertifiedInvoicesList(8),
InvoiceRecord(9), InvoiceRecord(9),
ExtractFinancialData(10), ExtractFinancialData(10),
ExtractInvoiceData(11) ExtractInvoiceData(11),
RevenueMapping(12)
; ;
private Integer code; private Integer code;
......
package pwc.taxtech.atms.dto.revenuconf; package pwc.taxtech.atms.dto.revenuconf;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.common.util.PwCIdSerialize;
import pwc.taxtech.atms.constant.enums.RevenueConfEnum; import pwc.taxtech.atms.constant.enums.RevenueConfEnum;
import pwc.taxtech.atms.vat.entity.RevenueTypeMapping; import pwc.taxtech.atms.vat.entity.RevenueTypeMapping;
public class RevenueTypeResult extends RevenueTypeMapping { public class RevenueTypeResult extends RevenueTypeMapping {
@JsonSerialize(using = PwCIdSerialize.class)
private String id;
public String getStatusStr() { public String getStatusStr() {
return RevenueConfEnum.Status.MAPPING.get(this.getStatus()); return RevenueConfEnum.Status.MAPPING.get(this.getStatus());
} }
} }
...@@ -14,7 +14,7 @@ public class CurrentPeriodBo { ...@@ -14,7 +14,7 @@ public class CurrentPeriodBo {
} }
public CurrentPeriodBo fixedCurYear(int curYear) { public CurrentPeriodBo fixedCurYear(int curYear) {
this.curYear = +curYear; this.curYear +=curYear;
return this; return this;
} }
......
...@@ -41,6 +41,7 @@ public class RevenueConfService extends BaseService { ...@@ -41,6 +41,7 @@ public class RevenueConfService extends BaseService {
Page page = PageHelper.startPage(param.getPageInfo().getPageIndex(), param.getPageInfo().getPageSize()); Page page = PageHelper.startPage(param.getPageInfo().getPageIndex(), param.getPageInfo().getPageSize());
RevenueConfigExample example = new RevenueConfigExample(); RevenueConfigExample example = new RevenueConfigExample();
example.createCriteria().andOrgIdIn(orgDtoList.stream().map(OrgSelectDto::getId).collect(Collectors.toList())); example.createCriteria().andOrgIdIn(orgDtoList.stream().map(OrgSelectDto::getId).collect(Collectors.toList()));
example.setOrderByClause("org_id");
PageInfo<RevenueConfResult> pageInfo = new PageInfo<>(revenueConfigMapper.selectByExample(example).stream() PageInfo<RevenueConfResult> pageInfo = new PageInfo<>(revenueConfigMapper.selectByExample(example).stream()
.map(o -> beanUtil.copyProperties(o, new RevenueConfResult())).collect(Collectors.toList())); .map(o -> beanUtil.copyProperties(o, new RevenueConfResult())).collect(Collectors.toList()));
pageInfo.setTotal(page.getTotal()); pageInfo.setTotal(page.getTotal());
......
...@@ -53,6 +53,7 @@ public class RevenueTypeMappingService extends BaseService { ...@@ -53,6 +53,7 @@ public class RevenueTypeMappingService extends BaseService {
Page page = PageHelper.startPage(param.getPageInfo().getPageIndex(), param.getPageInfo().getPageSize()); Page page = PageHelper.startPage(param.getPageInfo().getPageIndex(), param.getPageInfo().getPageSize());
RevenueTypeMappingExample example = new RevenueTypeMappingExample(); RevenueTypeMappingExample example = new RevenueTypeMappingExample();
example.createCriteria().andOrgIdIn(orgDtoList.stream().map(OrgSelectDto::getId).collect(Collectors.toList())); example.createCriteria().andOrgIdIn(orgDtoList.stream().map(OrgSelectDto::getId).collect(Collectors.toList()));
example.setOrderByClause("org_id");
PageInfo<RevenueTypeResult> pageInfo = new PageInfo<>(typeMappingMapper.selectByExample(example).stream() PageInfo<RevenueTypeResult> pageInfo = new PageInfo<>(typeMappingMapper.selectByExample(example).stream()
.map(o -> beanUtil.copyProperties(o, new RevenueTypeResult())).collect(Collectors.toList())); .map(o -> beanUtil.copyProperties(o, new RevenueTypeResult())).collect(Collectors.toList()));
pageInfo.setTotal(page.getTotal()); pageInfo.setTotal(page.getTotal());
......
...@@ -1813,10 +1813,11 @@ public class ReportServiceImpl extends BaseService { ...@@ -1813,10 +1813,11 @@ public class ReportServiceImpl extends BaseService {
cellData.setFormulaExp(data.getKeyinData()); cellData.setFormulaExp(data.getKeyinData());
periodCellDataMapper.updateByPrimaryKeySelective(cellData); periodCellDataMapper.updateByPrimaryKeySelective(cellData);
} else if (data.getAmount() != null && cellData.getData() != data.getAmount().toString()) { } else if (data.getAmount() != null && cellData.getData() != data.getAmount().toString()) {
cellData.setData(data.getAmount().toString()); //TODO Eddie确认逻辑
if (StringUtils.isEmpty(cellData.getFormulaExp())) // cellData.setData(data.getAmount().toString());
cellData.setFormulaExp(data.getAmount().toString()); // if (StringUtils.isEmpty(cellData.getFormulaExp()))
periodCellDataMapper.updateByPrimaryKeySelective(cellData); // cellData.setFormulaExp(data.getAmount().toString());
// periodCellDataMapper.updateByPrimaryKeySelective(cellData);
} }
} }
......
...@@ -8,7 +8,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; ...@@ -8,7 +8,6 @@ import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction; 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.common.util.MyAsserts;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType; import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto; import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto;
import pwc.taxtech.atms.dto.vatdto.BBParasBo; import pwc.taxtech.atms.dto.vatdto.BBParasBo;
...@@ -112,9 +111,9 @@ public class BB extends FunctionBase implements FreeRefFunction { ...@@ -112,9 +111,9 @@ public class BB extends FunctionBase implements FreeRefFunction {
return cellValue; return cellValue;
} }
PeriodCellData cellData = null; PeriodCellData cellData = null;
String projectId = agent.getPastProjectId(curPeriod.getCurYear(), // String projectId = agent.getPastProjectId(curPeriod.getCurYear(),
formulaContext.getOrganizationId()); // formulaContext.getOrganizationId());
MyAsserts.assertNotEmpty(projectId, Exceptions.PROJECT_EMPTY); // MyAsserts.assertNotEmpty(projectId, Exceptions.PROJECT_EMPTY);
cellData = agent.getCellData(cellTemplateData.getReportTemplateId(), cellData = agent.getCellData(cellTemplateData.getReportTemplateId(),
cellTemplateData.getCellTemplateId(), curPeriod.getCurPeriod(), project==null?formulaContext.getProjectId():project.getId()); cellTemplateData.getCellTemplateId(), curPeriod.getCurPeriod(), project==null?formulaContext.getProjectId():project.getId());
List<PeriodDataSource> dss = agent.queryManualDataSource(Long.parseLong(cellTemplateData.getCellTemplateId()), List<PeriodDataSource> dss = agent.queryManualDataSource(Long.parseLong(cellTemplateData.getCellTemplateId()),
......
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
<select id = "selectReportData" resultType="pwc.taxtech.atms.dpo.AnalysisSalesValueDto"> <select id = "selectReportData" resultType="pwc.taxtech.atms.dpo.AnalysisSalesValueDto">
select cell_template.row_index as rowIndex, select cell_template.row_index as rowIndex,
cell_template.column_index as columnIndex, cell_template.column_index as columnIndex,
concat(CONVERT(cell_data.data, decimal(18, 4)) + if(data_source.amount is null, 0, data_source.amount)) as data concat(CONVERT(cell_data.data, decimal(18, 2)) + if(data_source.amount is null, 0, data_source.amount)) as data
from period_cell_data cell_data from period_cell_data cell_data
left join period_cell_template cell_template left join period_cell_template cell_template
on cell_data.cell_template_id = cell_template.cell_template_id on cell_data.cell_template_id = cell_template.cell_template_id
......
...@@ -1545,7 +1545,8 @@ constant.importFileType = { ...@@ -1545,7 +1545,8 @@ constant.importFileType = {
certifiedInvoicesList: 8, certifiedInvoicesList: 8,
invoiceRecord: 9, invoiceRecord: 9,
ExtractFinancialData: 10, ExtractFinancialData: 10,
ExtractInvoiceData: 11 ExtractInvoiceData: 11,
RevenueMapping: 12
}; };
constant.citImportFileType = { constant.citImportFileType = {
......
...@@ -106,6 +106,11 @@ ...@@ -106,6 +106,11 @@
//导入事件 //导入事件
var callFinancialApi = function () { var callFinancialApi = function () {
if (!$scope.formParam || !$scope.formParam.orgIds || !$scope.formParam.dataTypes
|| !$scope.formParam.period) {
SweetAlert.warning($translate.instant('PleaseSelectAtLeastOneItem'));
return;
}
dataImportService.callExtractFinancialData($scope.formParam).success(function (data) { dataImportService.callExtractFinancialData($scope.formParam).success(function (data) {
if (data) { if (data) {
getFinancialDataStatus(); getFinancialDataStatus();
......
...@@ -20,15 +20,17 @@ ...@@ -20,15 +20,17 @@
<div dx-date-box="dateBoxStart"></div> <div dx-date-box="dateBoxStart"></div>
</div> </div>
<label class="col-sm-1 control-label">{{'SelectedDataType' | translate}}:</label> <label class="col-sm-1 control-label">{{'SelectedDataType' | translate}}:</label>
<div class="col-sm-3"> <div class="col-sm-2">
<div dx-tag-box="selectTypeOptions"></div> <div dx-tag-box="selectTypeOptions"></div>
</div> </div>
<div class="col-sm-1"> <div class="col-sm-2">
<button type="button" atms-permission permission-control-type="ngIf" <button type="button" atms-permission permission-control-type="ngIf"
permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}" permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}"
class="btn btn-vat-primary" class="btn btn-vat-primary"
translate="ImportBtn" translate="ImportBtn" style="min-width: 50px;"
ng-click="callFinancialApi()"></button> ng-click="callFinancialApi()"></button>
<button type="button" class="btn btn-vat-primary" translate="Refresh"
ng-click="refreshConfigGrid()" style="min-width: 50px;"></button>
</div> </div>
</div> </div>
......
vatModule.controller('VatRevenueConfMappingController', ['$scope', '$log', '$translate', '$timeout', 'SweetAlert', '$q', vatModule.controller('VatRevenueConfMappingController', ['$scope', '$log', '$translate', '$timeout', 'SweetAlert', '$q',
'$interval','dxDataGridService','$http','apiConfig','Upload','apiInterceptor', '$interval','dxDataGridService','$http','apiConfig','Upload','apiInterceptor','templateService',
function ($scope, $log, $translate, $timeout, SweetAlert, $q, $interval,dxDataGridService,$http,apiConfig,Upload,apiInterceptor) { function ($scope, $log, $translate, $timeout, SweetAlert, $q, $interval,dxDataGridService,$http,apiConfig,Upload,
apiInterceptor,templateService) {
'use strict'; 'use strict';
//表格配置 //表格配置
...@@ -33,7 +34,7 @@ ...@@ -33,7 +34,7 @@
}).appendTo(container); }).appendTo(container);
$('<i class="fa fa-trash" style="cursor: pointer;margin-left: 5px;"></i>') $('<i class="fa fa-trash" style="cursor: pointer;margin-left: 5px;"></i>')
.on('click', function () { .on('click', function () {
$scope.editConfig(options.data); $scope.delConfig([options.data.id]);
}).appendTo(container); }).appendTo(container);
} }
catch (e) { catch (e) {
...@@ -48,7 +49,11 @@ ...@@ -48,7 +49,11 @@
mode: 'multiple', mode: 'multiple',
showCheckBoxesMode: 'always', showCheckBoxesMode: 'always',
allowSelectAll: true allowSelectAll: true
} },
onSelectionChanged: function (data) {
$scope.selectedItems = data.selectedRowsData;
$scope.selectedRecourdCount = data.selectedRowsData.length;
},
}); });
//刷新页面 //刷新页面
...@@ -71,9 +76,25 @@ ...@@ -71,9 +76,25 @@
$($scope.revenueConfAddDiv).modal('show'); $($scope.revenueConfAddDiv).modal('show');
}; };
//删除配置 $scope.batchDelConfig = function () {
$scope.delConfig = function () { if (!!$scope.selectedRecourdCount) {
SweetAlert.info('del'); $scope.delConfig(_.map($scope.selectedItems, function(item){ return item.id; }));
}else {
SweetAlert.warning($translate.instant('PleaseSelectAtLeastOneItem'));
}
};
///删除配置
$scope.delConfig = function (idList) {
$http.post('/revenueConfMapping/del',idList, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
SweetAlert.success($translate.instant('RevenueDelSuccess'));
$scope.refreshConfigGrid();
}else {
SweetAlert.error($translate.instant('SystemError'));
}
})
}; };
//添加配置 //添加配置
...@@ -85,6 +106,7 @@ ...@@ -85,6 +106,7 @@
SweetAlert.success($translate.instant('RevenueAddSuccess')); SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid(); $scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide'); $($scope.revenueConfAddDiv).modal('hide');
$scope.cancelModal();
}else { }else {
SweetAlert.error($translate.instant('SystemError')); SweetAlert.error($translate.instant('SystemError'));
} }
...@@ -96,6 +118,7 @@ ...@@ -96,6 +118,7 @@
SweetAlert.success($translate.instant('RevenueAddSuccess')); SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid(); $scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide'); $($scope.revenueConfAddDiv).modal('hide');
$scope.cancelModal();
}else { }else {
SweetAlert.error($translate.instant('SystemError')); SweetAlert.error($translate.instant('SystemError'));
} }
...@@ -182,6 +205,35 @@ ...@@ -182,6 +205,35 @@
}); });
}; };
$scope.downloadTemplate = function () {
templateService.downloadTemplate(constant.importFileType.RevenueMapping).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, "开票记录与收入类型映射模板");
} 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 = "开票记录与收入类型映射模板.xlsx";
document.body.appendChild(a);
a.click();
}
}
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
};
(function initialize() { (function initialize() {
......
...@@ -5,16 +5,16 @@ ...@@ -5,16 +5,16 @@
</div> </div>
<div id="tab_total"> <div id="tab_total">
<form class="form-inline"> <form class="form-inline">
<div class="form-group"> <div class="form-group" style="margin-top: 5px;">
<button type="button" class="btn btn-secondary" ng-click="addConfig()">{{'RevenueAddBtn' | translate }}</button>&nbsp;&nbsp;&nbsp; <button type="button" class="btn btn-secondary" ng-click="addConfig()">{{'RevenueAddBtn' | translate }}</button>&nbsp;&nbsp;&nbsp;
<button type="button" class="btn btn-third" ng-click="delConfig()">{{'RevenueDelBtn' | translate }}</button>&nbsp;&nbsp;&nbsp; <button type="button" class="btn btn-third" ng-click="batchDelConfig()">{{'RevenueDelBtn' | translate }}</button>&nbsp;&nbsp;&nbsp;
<label class="control-label">文件:</label> <label class="control-label">文件:</label>
<input class="form-control" type="text" name="fileName" ng-model="uploadFile.file.name" readonly placeholder=""/> <input class="form-control" type="text" name="fileName" ng-model="uploadFile.file.name" readonly placeholder=""/>
<button type="button" type="file" ngf-select ng-model="uploadFile.file" accept=".xls,.xlsx" class="btn btn-secondary browse">{{'SelectFile' | translate }}</button> <button type="button" type="file" ngf-select ng-model="uploadFile.file" accept=".xls,.xlsx" class="btn btn-secondary browse">{{'SelectFile' | translate }}</button>
<button type="button" class="btn btn-secondary" translate="CoverImportBtn" ng-click="upload()"></button> <button type="button" class="btn btn-secondary" translate="CoverImportBtn" ng-click="upload()"></button>
<button type="button" class="btn btn-secondary" translate="AddImportBtn" ng-click="upload()"></button> <button type="button" class="btn btn-secondary" translate="AddImportBtn" ng-click="upload()"></button>
<button type="button" class="btn btn-in-grid inline-div" ng-click="downEntepriseAccountTemplate()"><i <button type="button" class="btn btn-in-grid inline-div" ng-click="downloadTemplate()"><i
class="fa fa-download" aria-hidden="true"></i>下载模板 class="fa fa-download" aria-hidden="true"></i>下载模板
</button> </button>
</div> </div>
......
...@@ -108,6 +108,7 @@ ...@@ -108,6 +108,7 @@
SweetAlert.success($translate.instant('RevenueAddSuccess')); SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid(); $scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide'); $($scope.revenueConfAddDiv).modal('hide');
$scope.cancelModal();
}else { }else {
SweetAlert.error($translate.instant('SystemError')); SweetAlert.error($translate.instant('SystemError'));
} }
...@@ -119,6 +120,7 @@ ...@@ -119,6 +120,7 @@
SweetAlert.success($translate.instant('RevenueAddSuccess')); SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid(); $scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide'); $($scope.revenueConfAddDiv).modal('hide');
$scope.cancelModal();
}else { }else {
SweetAlert.error($translate.instant('SystemError')); SweetAlert.error($translate.instant('SystemError'));
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
</div> </div>
<div id="tab_total"> <div id="tab_total">
<form class="form-inline"> <form class="form-inline">
<div class="form-group"><div class="import-wrapper"> <div class="form-group" style="margin-top: 5px;"><div class="import-wrapper">
<button type="button" class="btn btn-primary" ng-click="addConfig()">{{'RevenueAddBtn' | translate }}</button>&nbsp;&nbsp;&nbsp; <button type="button" class="btn btn-primary" ng-click="addConfig()">{{'RevenueAddBtn' | translate }}</button>&nbsp;&nbsp;&nbsp;
<button type="button" class="btn btn-third" ng-click="batchDelConfig()">{{'RevenueDelBtn' | translate }}</button> <button type="button" class="btn btn-third" ng-click="batchDelConfig()">{{'RevenueDelBtn' | translate }}</button>
</div></div> </div></div>
......
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