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;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
public class POIUtil {
......@@ -88,6 +91,13 @@ public class POIUtil {
}
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++) {
Row row = sheet.getRow(r);
if (null == row) {
......
......@@ -12,7 +12,8 @@ public enum EnumImportType {
CertifiedInvoicesList(8),
InvoiceRecord(9),
ExtractFinancialData(10),
ExtractInvoiceData(11)
ExtractInvoiceData(11),
RevenueMapping(12)
;
private Integer code;
......
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.vat.entity.RevenueTypeMapping;
public class RevenueTypeResult extends RevenueTypeMapping {
@JsonSerialize(using = PwCIdSerialize.class)
private String id;
public String getStatusStr() {
return RevenueConfEnum.Status.MAPPING.get(this.getStatus());
}
}
......@@ -14,7 +14,7 @@ public class CurrentPeriodBo {
}
public CurrentPeriodBo fixedCurYear(int curYear) {
this.curYear = +curYear;
this.curYear +=curYear;
return this;
}
......
......@@ -41,6 +41,7 @@ public class RevenueConfService extends BaseService {
Page page = PageHelper.startPage(param.getPageInfo().getPageIndex(), param.getPageInfo().getPageSize());
RevenueConfigExample example = new RevenueConfigExample();
example.createCriteria().andOrgIdIn(orgDtoList.stream().map(OrgSelectDto::getId).collect(Collectors.toList()));
example.setOrderByClause("org_id");
PageInfo<RevenueConfResult> pageInfo = new PageInfo<>(revenueConfigMapper.selectByExample(example).stream()
.map(o -> beanUtil.copyProperties(o, new RevenueConfResult())).collect(Collectors.toList()));
pageInfo.setTotal(page.getTotal());
......
......@@ -53,6 +53,7 @@ public class RevenueTypeMappingService extends BaseService {
Page page = PageHelper.startPage(param.getPageInfo().getPageIndex(), param.getPageInfo().getPageSize());
RevenueTypeMappingExample example = new RevenueTypeMappingExample();
example.createCriteria().andOrgIdIn(orgDtoList.stream().map(OrgSelectDto::getId).collect(Collectors.toList()));
example.setOrderByClause("org_id");
PageInfo<RevenueTypeResult> pageInfo = new PageInfo<>(typeMappingMapper.selectByExample(example).stream()
.map(o -> beanUtil.copyProperties(o, new RevenueTypeResult())).collect(Collectors.toList()));
pageInfo.setTotal(page.getTotal());
......
......@@ -1813,10 +1813,11 @@ public class ReportServiceImpl extends BaseService {
cellData.setFormulaExp(data.getKeyinData());
periodCellDataMapper.updateByPrimaryKeySelective(cellData);
} else if (data.getAmount() != null && cellData.getData() != data.getAmount().toString()) {
cellData.setData(data.getAmount().toString());
if (StringUtils.isEmpty(cellData.getFormulaExp()))
cellData.setFormulaExp(data.getAmount().toString());
periodCellDataMapper.updateByPrimaryKeySelective(cellData);
//TODO Eddie确认逻辑
// cellData.setData(data.getAmount().toString());
// if (StringUtils.isEmpty(cellData.getFormulaExp()))
// cellData.setFormulaExp(data.getAmount().toString());
// periodCellDataMapper.updateByPrimaryKeySelective(cellData);
}
}
......
......@@ -8,7 +8,6 @@ import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto;
import pwc.taxtech.atms.dto.vatdto.BBParasBo;
......@@ -112,9 +111,9 @@ public class BB extends FunctionBase implements FreeRefFunction {
return cellValue;
}
PeriodCellData cellData = null;
String projectId = agent.getPastProjectId(curPeriod.getCurYear(),
formulaContext.getOrganizationId());
MyAsserts.assertNotEmpty(projectId, Exceptions.PROJECT_EMPTY);
// String projectId = agent.getPastProjectId(curPeriod.getCurYear(),
// formulaContext.getOrganizationId());
// MyAsserts.assertNotEmpty(projectId, Exceptions.PROJECT_EMPTY);
cellData = agent.getCellData(cellTemplateData.getReportTemplateId(),
cellTemplateData.getCellTemplateId(), curPeriod.getCurPeriod(), project==null?formulaContext.getProjectId():project.getId());
List<PeriodDataSource> dss = agent.queryManualDataSource(Long.parseLong(cellTemplateData.getCellTemplateId()),
......
......@@ -113,7 +113,7 @@
<select id = "selectReportData" resultType="pwc.taxtech.atms.dpo.AnalysisSalesValueDto">
select cell_template.row_index as rowIndex,
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
left join period_cell_template cell_template
on cell_data.cell_template_id = cell_template.cell_template_id
......
......@@ -1545,7 +1545,8 @@ constant.importFileType = {
certifiedInvoicesList: 8,
invoiceRecord: 9,
ExtractFinancialData: 10,
ExtractInvoiceData: 11
ExtractInvoiceData: 11,
RevenueMapping: 12
};
constant.citImportFileType = {
......
......@@ -106,6 +106,11 @@
//导入事件
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) {
if (data) {
getFinancialDataStatus();
......
......@@ -20,15 +20,17 @@
<div dx-date-box="dateBoxStart"></div>
</div>
<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>
<div class="col-sm-1">
<div class="col-sm-2">
<button type="button" atms-permission permission-control-type="ngIf"
permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}"
class="btn btn-vat-primary"
translate="ImportBtn"
translate="ImportBtn" style="min-width: 50px;"
ng-click="callFinancialApi()"></button>
<button type="button" class="btn btn-vat-primary" translate="Refresh"
ng-click="refreshConfigGrid()" style="min-width: 50px;"></button>
</div>
</div>
......
vatModule.controller('VatRevenueConfMappingController', ['$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) {
'$interval','dxDataGridService','$http','apiConfig','Upload','apiInterceptor','templateService',
function ($scope, $log, $translate, $timeout, SweetAlert, $q, $interval,dxDataGridService,$http,apiConfig,Upload,
apiInterceptor,templateService) {
'use strict';
//表格配置
......@@ -33,7 +34,7 @@
}).appendTo(container);
$('<i class="fa fa-trash" style="cursor: pointer;margin-left: 5px;"></i>')
.on('click', function () {
$scope.editConfig(options.data);
$scope.delConfig([options.data.id]);
}).appendTo(container);
}
catch (e) {
......@@ -48,7 +49,11 @@
mode: 'multiple',
showCheckBoxesMode: 'always',
allowSelectAll: true
}
},
onSelectionChanged: function (data) {
$scope.selectedItems = data.selectedRowsData;
$scope.selectedRecourdCount = data.selectedRowsData.length;
},
});
//刷新页面
......@@ -71,9 +76,25 @@
$($scope.revenueConfAddDiv).modal('show');
};
//删除配置
$scope.delConfig = function () {
SweetAlert.info('del');
$scope.batchDelConfig = function () {
if (!!$scope.selectedRecourdCount) {
$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 @@
SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide');
$scope.cancelModal();
}else {
SweetAlert.error($translate.instant('SystemError'));
}
......@@ -96,6 +118,7 @@
SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide');
$scope.cancelModal();
}else {
SweetAlert.error($translate.instant('SystemError'));
}
......@@ -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() {
......
......@@ -5,16 +5,16 @@
</div>
<div id="tab_total">
<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-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>
<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" 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-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>下载模板
</button>
</div>
......
......@@ -108,6 +108,7 @@
SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide');
$scope.cancelModal();
}else {
SweetAlert.error($translate.instant('SystemError'));
}
......@@ -119,6 +120,7 @@
SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide');
$scope.cancelModal();
}else {
SweetAlert.error($translate.instant('SystemError'));
}
......
......@@ -5,7 +5,7 @@
</div>
<div id="tab_total">
<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-third" ng-click="batchDelConfig()">{{'RevenueDelBtn' | translate }}</button>
</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