Commit 6044f0ef authored by eddie.woo's avatar eddie.woo

modify

parent a07dcfd0
package pwc.taxtech.atms.controller;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.service.impl.ReportAnalysisService;
import javax.annotation.Resource;
import java.util.Collections;
@RestController
@RequestMapping("/api/v1/reportAnalysis")
public class ReportAnalysisController extends BaseController {
@Resource
private ReportAnalysisService reportAnalysisService;
@GetMapping("/burdenRateData/{projectId}")
public ApiResultDto getBurdenRateData(@PathVariable String projectId) {
if (StringUtils.isBlank(projectId)) {
return ApiResultDto.success(Collections.emptyList());
}
try {
return ApiResultDto.success(reportAnalysisService.getBurdenRateData(projectId));
} catch (Exception e) {
logger.error("getBurdenRateData error.", e);
}
return ApiResultDto.fail();
}
@GetMapping("/dispersion/{projectId}")
public ApiResultDto dispersion(@PathVariable String projectId) {
if (StringUtils.isBlank(projectId)) {
return ApiResultDto.success(Collections.emptyList());
}
try {
return ApiResultDto.success(reportAnalysisService.getDispersion(projectId));
} catch (Exception e) {
logger.error("getDispersion error.", e);
}
return ApiResultDto.fail();
}
@GetMapping("/incomeRate/{projectId}")
public ApiResultDto incomeRate(@PathVariable String projectId) {
if (StringUtils.isBlank(projectId)) {
return ApiResultDto.success(Collections.emptyList());
}
try {
return ApiResultDto.success(reportAnalysisService.getIncomeRate(projectId));
} catch (Exception e) {
logger.error("getDispersion error.", e);
}
return ApiResultDto.fail();
}
@GetMapping("/incomeVolatility/{projectId}")
public ApiResultDto incomeVolatility(@PathVariable String projectId) {
if (StringUtils.isBlank(projectId)) {
return ApiResultDto.success(Collections.emptyList());
}
try {
return ApiResultDto.success(reportAnalysisService.getIncomeVolatility(projectId));
} catch (Exception e) {
logger.error("getDispersion error.", e);
}
return ApiResultDto.fail();
}
}
package pwc.taxtech.atms.dao;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.service.impl.BaseService;
import pwc.taxtech.atms.vat.dao.GlBalanceMapper;
import pwc.taxtech.atms.vat.entity.GlBalance;
import pwc.taxtech.atms.vat.entity.GlBalanceExample;
import javax.annotation.Resource;
import java.util.Optional;
@Service
public class GlBalanceDao extends BaseService {
@Resource
private GlBalanceMapper glBalanceMapper;
/**
* 查找科目
*
* @param code code
* @return GlBalance
*/
public Optional<GlBalance> get(String code, String orgId, String period) {
GlBalanceExample example = new GlBalanceExample();
example.createCriteria().andSegment3EqualTo(code).andSegment1EqualTo(orgId).andPeriodNameEqualTo(period);
Optional<GlBalance> optional = glBalanceMapper.selectByExample(example).stream().findFirst();
if (optional.isPresent()) {
return optional;
}
GlBalanceExample example2 = new GlBalanceExample();
example2.createCriteria().andSegment4EqualTo(code).andSegment1EqualTo(orgId).andPeriodNameEqualTo(period);
return glBalanceMapper.selectByExample(example2).stream().findFirst();
}
}
package pwc.taxtech.atms.dto.vatdto;
import java.math.BigDecimal;
import java.util.List;
public class BurdenRateDto {
private List<BigDecimal> vatAmount;
private List<BigDecimal> income;
private List<BigDecimal> rate;
public List<BigDecimal> getVatAmount() {
return this.vatAmount;
}
public void setVatAmount(List<BigDecimal> vatAmount) {
this.vatAmount = vatAmount;
}
public List<BigDecimal> getIncome() {
return this.income;
}
public void setIncome(List<BigDecimal> income) {
this.income = income;
}
public List<BigDecimal> getRate() {
return this.rate;
}
public void setRate(List<BigDecimal> rate) {
this.rate = rate;
}
}
package pwc.taxtech.atms.service.impl;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.constant.enums.StdAccountEnum;
import pwc.taxtech.atms.dao.AccountMappingMapper;
import pwc.taxtech.atms.dao.GlBalanceDao;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dao.StandardAccountDao;
import pwc.taxtech.atms.dto.vatdto.BurdenRateDto;
import pwc.taxtech.atms.entity.AccountMapping;
import pwc.taxtech.atms.entity.AccountMappingExample;
import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.entity.StandardAccount;
import pwc.taxtech.atms.vat.dao.PeriodCellDataMapper;
import pwc.taxtech.atms.vat.dao.PeriodCellTemplateMapper;
import pwc.taxtech.atms.vat.dao.PeriodDataSourceMapper;
import pwc.taxtech.atms.vat.dao.PeriodTemplateMapper;
import pwc.taxtech.atms.vat.entity.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Optional;
@Service
public class ReportAnalysisService extends BaseService {
@Resource
private GlBalanceDao glBalanceDao;
@Resource
private AccountMappingMapper accountMappingMapper;
@Resource
private ProjectMapper projectMapper;
@Resource
private StandardAccountDao standardAccountDao;
@Resource
private PeriodTemplateMapper periodTemplateMapper;
@Resource
private PeriodCellTemplateMapper periodCellTemplateMapper;
@Resource
private PeriodCellDataMapper periodCellDataMapper;
@Resource
private PeriodDataSourceMapper periodDataSourceMapper;
/**
* 增值税负担率
*/
public BurdenRateDto getBurdenRateData(String projectId) {
BurdenRateDto dto = new BurdenRateDto();
List<BigDecimal> vatAmountList = Lists.newArrayList();
List<BigDecimal> incomeList = Lists.newArrayList();
List<BigDecimal> rateList = Lists.newArrayList();
for (int p = 1; p <= 12; p++) {
BigDecimal vat = getCellValue(projectId, p, "VAT001", 32, 18);
BigDecimal income = getTbValueByDirection("600101", projectId, p)
.add(getTbValueByDirection("600102", projectId, p))
.add(getTbValueByDirection("600103", projectId, p))
.add(getTbValueByDirection("600104", projectId, p))
.add(getTbValueByDirection("600105", projectId, p))
.add(getTbValueByDirection("600107", projectId, p))
.add(getTbValueByDirection("600111", projectId, p))
.add(getTbValueByDirection("600190", projectId, p));
vatAmountList.add(vat);
incomeList.add(income);
BigDecimal rate = income.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
vat.divide(income, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
rateList.add(rate);
}
dto.setVatAmount(vatAmountList);
dto.setIncome(incomeList);
dto.setRate(rateList);
return dto;
}
/**
* 增值税申报表收入与会计收入差异离散度分析
*/
public BurdenRateDto getDispersion(String projectId) {
BurdenRateDto dto = new BurdenRateDto();
List<BigDecimal> rateList = Lists.newArrayList();
for (int p = 1; p <= 12; p++) {
BigDecimal val = getCellValue(projectId, p, "VAT001", 19, 18);
BigDecimal val2 = getCellValue(projectId, p, "VAT005", 26, 12);
BigDecimal val3 = getTbValueByDirection("600101", projectId, p)
.add(getTbValueByDirection("600102", projectId, p)).add(getTbValueByDirection("600103", projectId, p))
.add(getTbValueByDirection("600104", projectId, p)).add(getTbValueByDirection("600105", projectId, p))
.add(getTbValueByDirection("600107", projectId, p)).add(getTbValueByDirection("600111", projectId, p))
.add(getTbValueByDirection("600190", projectId, p)).add(getTbValueByDirection("605101", projectId, p))
.add(getTbValueByDirection("612101", projectId, p)).add(getTbValueByDirection("630101", projectId, p))
.add(getTbValueByDirection("630102", projectId, p)).add(getTbValueByDirection("630103", projectId, p))
.add(getTbValueByDirection("630104", projectId, p)).add(getTbValueByDirection("630105", projectId, p))
.add(getTbValueByDirection("630106", projectId, p)).add(getTbValueByDirection("630107", projectId, p))
.add(getTbValueByDirection("630108", projectId, p)).add(getTbValueByDirection("630198", projectId, p));
BigDecimal rate = val3.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO : val.add(val2)
.divide(val3, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
rateList.add(rate);
}
dto.setRate(rateList);
return dto;
}
/**
* 进项税额占主营业务成本的比例
*/
public BurdenRateDto getIncomeRate(String projectId) {
BurdenRateDto dto = new BurdenRateDto();
List<BigDecimal> vatAmountList = Lists.newArrayList();
List<BigDecimal> incomeList = Lists.newArrayList();
List<BigDecimal> rateList = Lists.newArrayList();
for (int p = 1; p <= 12; p++) {
BigDecimal vat = getCellValue(projectId, p, "VAT001", 20, 18);
BigDecimal income = getTbValueByDirection("640101", projectId, p)
.add(getTbValueByDirection("640102", projectId, p))
.add(getTbValueByDirection("640103", projectId, p))
.add(getTbValueByDirection("640104", projectId, p))
.add(getTbValueByDirection("640105", projectId, p))
.add(getTbValueByDirection("640106", projectId, p))
.add(getTbValueByDirection("640107", projectId, p))
.add(getTbValueByDirection("640190", projectId, p))
.add(getTbValueByDirection("640201", projectId, p));
vatAmountList.add(vat);
incomeList.add(income);
BigDecimal rate = income.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
vat.divide(income, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
rateList.add(rate);
}
dto.setVatAmount(vatAmountList);
dto.setIncome(incomeList);
dto.setRate(rateList);
return dto;
}
/**
* 进项税转出额波动率
*/
public BurdenRateDto getIncomeVolatility(String projectId) {
BurdenRateDto dto = new BurdenRateDto();
List<BigDecimal> vatAmountList = Lists.newArrayList();
List<BigDecimal> incomeList = Lists.newArrayList();
List<BigDecimal> rateList = Lists.newArrayList();
for (int p = 1; p <= 12; p++) {
BigDecimal vat = getCellValue(projectId, p, "VAT001", 22, 18);
BigDecimal income = getCellValue(projectId, p, "VAT001", 20, 18);
vatAmountList.add(vat);
incomeList.add(income);
BigDecimal rate = income.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
vat.divide(income, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
rateList.add(rate);
}
dto.setVatAmount(vatAmountList);
dto.setIncome(incomeList);
dto.setRate(rateList);
return dto;
}
/**
* 根据借贷方向获取TB表科目的发生额
*/
public BigDecimal getTbValueByDirection(String code, String projectId, Integer period) {
try {
if (StringUtils.isBlank(projectId)) {
return BigDecimal.ZERO;
}
Project project = projectMapper.selectByPrimaryKey(projectId);
if (null == project) {
return BigDecimal.ZERO;
}
AccountMappingExample example = new AccountMappingExample();
example.createCriteria().andOrganizationIdEqualTo(project.getOrganizationId())
.andEnterpriseAccountSetIdEqualTo(project.getEnterpriseAccountSetId())
.andIndustryIdEqualTo(project.getIndustryId());
Optional<AccountMapping> mappingOptional = accountMappingMapper.selectByExample(example).stream().findFirst();
if (!mappingOptional.isPresent()) {
return BigDecimal.ZERO;
}
Optional<StandardAccount> accountOptional = standardAccountDao.getByCodeAndIndustryId(
mappingOptional.get().getStandardAccountCode(), mappingOptional.get().getIndustryId())
.stream().findFirst();
Optional<GlBalance> optional = glBalanceDao.get(code, project.getClientCode(), project.getYear() + "-" + period);
BigDecimal val;
if (optional.isPresent()) {
if (accountOptional.get().getDirection() == StdAccountEnum.Direction.Debit.getCode()) {
val = optional.get().getPtdDr();
} else {
val = optional.get().getPtdCr();
}
return val;
}
} catch (Exception e) {
logger.error("getTbValueByDirection error.", e);
}
return BigDecimal.ZERO;
}
/**
* 获取单元格计算的值
*
* @param projectId projectId
* @param period period
* @param sheet VAT001
* @param rowIndex rowIndex
* @param colIndex colIndex
* @return BigDecimal
*/
public BigDecimal getCellValue(String projectId, Integer period, String sheet, Integer rowIndex, Integer colIndex) {
try {
PeriodTemplateExample templateExample = new PeriodTemplateExample();
templateExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andCodeEqualTo(sheet);
Optional<PeriodTemplate> templateOptional = periodTemplateMapper.selectByExample(templateExample).stream().findFirst();
if (!templateOptional.isPresent()) {
return BigDecimal.ZERO;
}
PeriodCellTemplateExample cellTemplateExample = new PeriodCellTemplateExample();
cellTemplateExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period)
.andReportTemplateIdEqualTo(templateOptional.get().getTemplateId()).andRowIndexEqualTo(rowIndex)
.andColumnIndexEqualTo(colIndex);
Optional<PeriodCellTemplate> cellTemplateOptional = periodCellTemplateMapper.selectByExample(cellTemplateExample).stream().findFirst();
if (!cellTemplateOptional.isPresent()) {
return BigDecimal.ZERO;
}
//cell data数据源
PeriodCellDataExample cellDataExample = new PeriodCellDataExample();
cellDataExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andCellTemplateIdEqualTo(
cellTemplateOptional.get().getCellTemplateId());
BigDecimal sum = periodCellDataMapper.selectByExample(cellDataExample).stream().map(o -> NumberUtils.createBigDecimal(o.getData()))
.reduce(BigDecimal.ZERO, BigDecimal::add);
//manual data数据源
PeriodDataSourceExample dataSourceExample = new PeriodDataSourceExample();
dataSourceExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andCellTemplateIdEqualTo(
cellTemplateOptional.get().getCellTemplateId()).andTypeEqualTo(FormulaDataSourceType.KeyInSource.getCode());
sum = periodDataSourceMapper.selectByExample(dataSourceExample).stream().map(o -> o.getAmount()).reduce(sum, BigDecimal::add);
return sum;
} catch (Exception e) {
logger.error("getCellValue error", e);
}
return BigDecimal.ZERO;
}
}
......@@ -204,7 +204,8 @@ public class DataInitTest extends CommonIT {
@Test
public void initOutput() throws Exception {
Workbook workbook = WorkbookFactory.create(new File("C:\\Users\\Eddie Wu\\Desktop\\导入\\进销项/导入模板_销项主表_乐叶_201807.xlsx"));
// todo 导入前检查开票日期,给的文档日期经常不一样
Workbook workbook = WorkbookFactory.create(new File("C:\\Users\\Eddie Wu\\Desktop\\导入\\进销项/导入模板_销项主表_绿能_201809.xlsx"));
Sheet sheet = workbook.getSheetAt(0);
for (int r = 1; r <= sheet.getLastRowNum(); r++) {
try {
......@@ -219,6 +220,7 @@ public class DataInitTest extends CommonIT {
outputInvoice.setFPQQLSH(sheet.getRow(r).getCell(1).getStringCellValue());
outputInvoice.setFPDM(sheet.getRow(r).getCell(2).getStringCellValue());
outputInvoice.setFPHM(sheet.getRow(r).getCell(3).getStringCellValue());
// outputInvoice.setKPRQ(sheet.getRow(r).getCell(4).getStringCellValue() + " 00:00:00");
outputInvoice.setKPRQ(sheet.getRow(r).getCell(4).getStringCellValue());
String s = "000" + sheet.getRow(r).getCell(5).getStringCellValue();
outputInvoice.setFPLXDM(s.substring(s.length() - 3, s.length()));
......@@ -236,6 +238,8 @@ public class DataInitTest extends CommonIT {
// outputInvoice.setHTBH(sheet.getRow(r).getCell(54).getStringCellValue());
OutputInvoiceExample example = new OutputInvoiceExample();
example.createCriteria().andFPDMEqualTo(outputInvoice.getFPDM()).andFPHMEqualTo(outputInvoice.getFPHM());
//有重复数据 先删除
outputInvoiceMapper.deleteByExample(example);
if (outputInvoiceMapper.selectByExample(example).size() > 0) {
outputInvoiceMapper.updateByExampleSelective(outputInvoice, example);
} else {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -5,9 +5,9 @@
$log.debug('VatAnalysisMenuController.ctor()...');
$scope.menus = [
{ name: '.analyzeReport', text: "出口数据对比", icon: 'glyphicon glyphicon-flag', permission: constant.vatPermission.dataAnalysis.modelAnalysisCode, show: true },
{ name: 'analyzeOrganizeDashboard({id:"' + vatSessionService.project.organizationID + '"})', text: "进项税额差异分析", icon: 'glyphicon glyphicon-stats', permission: constant.vatPermission.dataAnalysis.dashboard.dashboardCode, show: true },
{ name: '.vatTaxDifference', text: $translate.instant('BookTaxDifference'), icon: 'glyphicon glyphicon-tree-conifer', show: true }
{ name: '.analyzeReport', text: "指标分析", icon: 'glyphicon glyphicon-stats', permission: constant.vatPermission.dataAnalysis.modelAnalysisCode, show: true },
// { name: 'analyzeOrganizeDashboard({id:"' + vatSessionService.project.organizationID + '"})', text: "进项税额差异分析", icon: 'glyphicon glyphicon-stats', permission: constant.vatPermission.dataAnalysis.dashboard.dashboardCode, show: true },
// { name: '.vatTaxDifference', text: $translate.instant('BookTaxDifference'), icon: 'glyphicon glyphicon-tree-conifer', show: true }
];
vatSessionService.querySummayDashboardModel = {
organizationID: vatSessionService.project.organizationID,
......
vatModule.controller('VatModelAnalysisController', ['$scope', '$translate', '$uibModal', 'vatSessionService', 'modelConfigurationService', '$compile', '$timeout', '$q', 'vatImportService', 'vatPreviewService', 'SweetAlert', 'enums', 'vatExportService',
function ($scope, $translate, $uibModal, vatSessionService, modelConfigurationService, $compile, $timeout, $q, vatImportService, vatPreviewService, SweetAlert, enums, vatExportService) {
vatModule.controller('VatModelAnalysisController', ['$scope', '$translate', '$uibModal', 'vatSessionService', 'modelConfigurationService', '$compile', '$timeout', '$q', 'SweetAlert', '$http', 'apiConfig',
function ($scope, $translate, $uibModal, vatSessionService, modelConfigurationService, $compile, $timeout, $q, SweetAlert, $http, apiConfig) {
'use strict';
//由 project 决定的在本页面中固定的变量
......@@ -9,176 +9,454 @@ vatModule.controller('VatModelAnalysisController', ['$scope', '$translate', '$ui
$scope.projectYear = vatSessionService.project.year;
$scope.serviceTypeId = vatSessionService.project.serviceTypeID;
/************* ViewModels BEGIN *************/
$scope.logOptions = {
isShown: false,
period: vatSessionService.month,
moduleId: enums.vatModuleEnum.Result_ModelAnalysisResult
};
$scope.modelType = 1;
$scope.periodFrom = 1;
$scope.periodTo = 12;
$scope.modelTreeList = [];
$scope.selectCategoryId = null;
$scope.resizableOptions = {
handles: "right",
Width: 250,
minWidth: 200,
maxWidth: 350
};
$scope.dirtyDataProcess = {
hasCheckedFinished: false,
intervalId: null,
progressBarValue: 0,
processBarMax: 100,
processBarModalInstance: null,
progressBarOptions: {
min: 0,
width: "90%",
bindingOptions: {
value: 'dirtyDataProcess.progressBarValue',
max: 'dirtyDataProcess.processBarMax'
},
statusFormat: function (value) {
return "计算进度: " + (value * 100).toFixed(0) + "%";
},
onComplete: function (e) {
$scope.dirtyDataProcess.processBarModalInstance.dismiss({$value: 'cancel'});
$scope.dirtyDataProcess.processBarModalInstance = null;
clearInterval($scope.dirtyDataProcess.intervalId);
$scope.dirtyDataProcess.intervalId = null;
loadTreeData();
}
}
};
/************* ViewModels END *************/
var loadTreeData = function () {
var apiFunc = modelConfigurationService.getModelCategory;
apiFunc($scope.organizationId, $scope.industryId, $scope.serviceTypeId).success(function (data) {
var dic = {};
for (var ix = 0; ix < data.length; ix++) {
var item = data[ix];
dic[item.categoryID] = {
id: item.modelID,
title: item.modelName,
isCategory: item.isCategory,
questionCount: item.questionCount,
totalCount: item.modelTotalCount,
categoryId: item.categoryID,
parentID: item.parentID,
modelType: item.modelType,
parentNode: null,
sort: item.sort,
data: item,
feature: item.feature,
nodes: [],
};
}
//查找每个节点是否存在父节点,并维护父节点与本节点的关系
for (var key in dic) {
if (!dic.hasOwnProperty(key))
continue;
var item = dic[key];
var parentId = item.parentID;
if (!parentId || !dic.hasOwnProperty(parentId))
continue;
var p = dic[parentId];
if (!p && p === item)
continue;
item.parentNode = p;
p.nodes.push(item);
}
var srcData = [];
for (var key in dic) {
if (!dic.hasOwnProperty(key))
continue;
var item = dic[key];
if (!item || item.parentNode)
continue;
srcData.push(item);
}
$scope.modelTreeList = srcData;
});
};
var getModelAnalysisPermission = function () {
var list = [];
var modelManageTemp = constant.vatPermission.dataAnalysis.modelAnalysis;
list.push(modelManageTemp.queryCode);
list.push(modelManageTemp.filterCode);
$scope.hasQueryPermission = false;
$scope.hasFilterIssuePermission = false;
$scope.$root.checkUserOrganizationPermissionList(list).success(function (data) {
$scope.hasQueryPermission = data[modelManageTemp.queryCode];
$scope.hasFilterIssuePermission = data[modelManageTemp.filterCode];
});
};
$scope.nodeSelected = function (node) {
$scope.selectCategoryId = node.categoryId;
$scope.modelType = node.feature;
};
var xArray = ['1月', '2月', '3月', '4月', '5月', '6月',
'7月', '8月', '9月', '10月', '11月', '12月'];
(function () {
getModelAnalysisPermission();
//检查是否有脏数据
modelConfigurationService.projectHasDirtyData($scope.projectId, $scope.serviceTypeId).success(function (result) {
if (!result) {
loadTreeData();
return;
}
SweetAlert.swal({
title: $translate.instant('OrganizationsHasDirtyData'),
text: '',
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: $translate.instant('Confirm'),
cancelButtonText: $translate.instant('Cancel'),
closeOnConfirm: true
}, function (isConfirm) {
if (!isConfirm) {
loadTreeData();
return;
//增值税负担率
function getBurdenRateData(chart) {
var yArray = ['应纳税额', '主营业务收入', '占比'];
var colors = ['#5793f3', '#d14a61', '#675bba'];
$http.get('/reportAnalysis/burdenRateData/' + $scope.projectId, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
var option = {
title: {
text: '增值税负担率'
},
color: colors,
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
grid: {
right: '20%'
},
toolbox: {
feature: {
dataView: {show: false, readOnly: false},
restore: {show: false},
saveAsImage: {show: true}
}
},
legend: {
data: yArray
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data: xArray
}
],
yAxis: [
{
type: 'value',
name: yArray[0],
// min: 0,
// max: 250,
position: 'right',
axisLine: {
lineStyle: {
color: colors[0]
}
},
axisLabel: {
formatter: function (val) {
return formatNum(val);
}
}
},
{
type: 'value',
name: yArray[1],
// min: 0,
// max: 250,
position: 'right',
offset: 80,
axisLine: {
lineStyle: {
color: colors[1]
}
},
axisLabel: {
formatter: function (val) {
return formatNum(val);
}
}
},
{
type: 'value',
name: yArray[2],
// min: 0,
// max: 25,
position: 'left',
axisLine: {
lineStyle: {
color: colors[2]
}
},
axisLabel: {
formatter: function (val) {
return (val * 100) + ' %';
}
}
}
],
series: [
{
name: yArray[0],
type: 'bar',
data: res.data.vatAmount
},
{
name: yArray[1],
type: 'bar',
yAxisIndex: 1,
data: res.data.income
},
{
name: yArray[2],
type: 'line',
yAxisIndex: 2,
data: res.data.rate
}
]
};
chart.setOption(option);
}
$scope.dirtyDataProcess.processBarModalInstance = $uibModal.open({
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
templateUrl: "vat-model-analysis-dirty-data-process-bar.html",
backdrop: 'static',
scope: $scope,
windowClass: "vat-model-analysis-dirty-data-process-bar"
});
$scope.dirtyDataProcess.intervalId = setInterval(function () {
$scope.dirtyDataProcess.progressBarValue++;
if (!$scope.dirtyDataProcess.hasCheckedFinished) {
$scope.dirtyDataProcess.processBarMax++;
})
}
//增值税申报表收入与会计收入差异离散度分析
function getDispersion(chart) {
$http.get('/reportAnalysis/burdenRateData/' + $scope.projectId, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
var data = [];
for (var i in xArray) {
data.push([xArray[i], res.data.rate[i]]);
}
}, 100);
//重新计算模型数据
modelConfigurationService.updateProjectModelDirtyDataSingleCard($scope.projectId, $scope.serviceTypeId).success(function () {
$scope.dirtyDataProcess.hasCheckedFinished = true;
});
});
});
var option = {
title: {
text: '增值税申报表收入与会计收入差异离散度分析'
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data: xArray
}
],
yAxis: {},
series: [{
// symbolSize: 20,
data: data,
type: 'scatter'
}],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
toolbox: {
feature: {
dataView: {show: false, readOnly: false},
restore: {show: false},
saveAsImage: {show: true}
}
}
};
chart.setOption(option);
}
})
}
//进项税额占主营业务成本的比例
function getIncomeRateData(chart) {
var yArray = ['进项税额', '主营业务成本', '占比'];
var colors = ['#5793f3', '#d14a61', '#675bba'];
$http.get('/reportAnalysis/incomeRate/' + $scope.projectId, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
var option = {
title: {
text: '进项税额占主营业务成本比例'
},
color: colors,
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
grid: {
right: '20%'
},
toolbox: {
feature: {
dataView: {show: false, readOnly: false},
restore: {show: false},
saveAsImage: {show: true}
}
},
legend: {
data: yArray
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data: xArray
}
],
yAxis: [
{
type: 'value',
name: yArray[0],
// min: 0,
// max: 250,
position: 'right',
axisLine: {
lineStyle: {
color: colors[0]
}
},
axisLabel: {
formatter: function (val) {
return formatNum(val);
}
}
},
{
type: 'value',
name: yArray[1],
// min: 0,
// max: 250,
position: 'right',
offset: 80,
axisLine: {
lineStyle: {
color: colors[1]
}
},
axisLabel: {
formatter: function (val) {
return formatNum(val);
}
}
},
{
type: 'value',
name: yArray[2],
// min: 0,
// max: 25,
position: 'left',
axisLine: {
lineStyle: {
color: colors[2]
}
},
axisLabel: {
formatter: function (val) {
return (val * 100) + ' %';
}
}
}
],
series: [
{
name: yArray[0],
type: 'bar',
data: res.data.vatAmount
},
{
name: yArray[1],
type: 'bar',
yAxisIndex: 1,
data: res.data.income
},
{
name: yArray[2],
type: 'line',
yAxisIndex: 2,
data: res.data.rate
}
]
};
chart.setOption(option);
}
})
}
//进项税转出额波动率
function getIncomeVolatilityData(chart) {
var yArray = ['本期进项税额转出额', '进项税额', '占比'];
var colors = ['#5793f3', '#d14a61', '#675bba'];
$http.get('/reportAnalysis/incomeVolatility/' + $scope.projectId, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
var option = {
title: {
text: '进项税转出额波动率'
},
color: colors,
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
grid: {
right: '20%'
},
toolbox: {
feature: {
dataView: {show: false, readOnly: false},
restore: {show: false},
saveAsImage: {show: true}
}
},
legend: {
data: yArray
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data: xArray
}
],
yAxis: [
{
type: 'value',
name: yArray[0],
// min: 0,
// max: 250,
position: 'right',
axisLine: {
lineStyle: {
color: colors[0]
}
},
axisLabel: {
formatter: function (val) {
return formatNum(val);
}
}
},
{
type: 'value',
name: yArray[1],
// min: 0,
// max: 250,
position: 'right',
offset: 80,
axisLine: {
lineStyle: {
color: colors[1]
}
},
axisLabel: {
formatter: function (val) {
return formatNum(val);
}
}
},
{
type: 'value',
name: yArray[2],
// min: 0,
// max: 25,
position: 'left',
axisLine: {
lineStyle: {
color: colors[2]
}
},
axisLabel: {
formatter: function (val) {
return (val * 100) + ' %';
}
}
}
],
series: [
{
name: yArray[0],
type: 'bar',
data: res.data.vatAmount
},
{
name: yArray[1],
type: 'bar',
yAxisIndex: 1,
data: res.data.income
},
{
name: yArray[2],
type: 'line',
yAxisIndex: 2,
data: res.data.rate
}
]
};
chart.setOption(option);
}
})
}
function formatNum(strNum) {
if (strNum.length <= 3) {
return strNum;
}
if (!/^(\+|-)?(\d+)(\.\d+)?$/.test(strNum)) {
return strNum;
}
var a = RegExp.$1,
b = RegExp.$2,
c = RegExp.$3;
var re = new RegExp();
re.compile("(\\d)(\\d{3})(,|$)");
while (re.test(b)) {
b = b.replace(re, "$1,$2$3");
}
return a + "" + b + "" + c;
}
function init() {
var width = $("div .row")[0].offsetWidth;
$('div[name="p_chart"]').css("width", (width / 2) - 80);
$('div[name="p_chart"]').css("height", 400);
var burdenRateDiv = echarts.init(document.getElementById('burdenRateDiv'));
var discreteAnalysisDiv = echarts.init(document.getElementById('discreteAnalysisDiv'));
var incomeRateDiv = echarts.init(document.getElementById('incomeRateDiv'));
var incomeVolatilityDiv = echarts.init(document.getElementById('incomeVolatilityDiv'));
getBurdenRateData(burdenRateDiv);
getDispersion(discreteAnalysisDiv);
getIncomeRateData(incomeRateDiv);
getIncomeVolatilityData(incomeVolatilityDiv);
}
(function () {
init();
})();
}
]);
\ No newline at end of file
<div class="vat-model-analysis ">
<div class="col-lg-12 col-md-12" style="margin-top:20px;">
<div >
<table border="1" width="95%" style="margin: auto">
<thead>
<tr class="th">
<th>遇到一个问题1</th>
<th>遇到一个问题1</th>
</tr>
</thead>
<tbody>
<tr class="tb">
<td>遇到一个问题</td>
<td>遇到一个问题</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="col-lg-5 col-md-5">
<div id="burdenRateDiv" name="p_chart"></div>
</div>
<div class="col-lg-5 col-md-5 col-md-offset-1 col-lg-offset-1">
<div id="discreteAnalysisDiv" name="p_chart"></div>
</div>
</div>
<div class="row">
<div class="col-lg-5 col-md-5">
<div id="incomeRateDiv" name="p_chart"></div>
</div>
<div class="col-lg-5 col-md-5 col-md-offset-1 col-lg-offset-1">
<div id="incomeVolatilityDiv" name="p_chart"></div>
</div>
</div>
</div>
<style>
.th>th{
.th > th {
text-align: center;
}
.tb>td{
.tb > td {
height: 30px;
text-align: center;
}
......
......@@ -12,50 +12,50 @@
$scope.element = $element;
// rangePicker 需要手动释放,否则经过多次操作后,页面中会存在多个 rangePicker 的 div
var rangePicker = null;
var initializePeriodRangePicker = function () {
//初始化期间选择控件
var input = $($scope.element).find(".right-container .menu .period-range input");
var monthList = [
$translate.instant('Month01'),
$translate.instant('Month02'),
$translate.instant('Month03'),
$translate.instant('Month04'),
$translate.instant('Month05'),
$translate.instant('Month06'),
$translate.instant('Month07'),
$translate.instant('Month08'),
$translate.instant('Month09'),
$translate.instant('Month10'),
$translate.instant('Month11'),
$translate.instant('Month12')
];
input = input.rangePicker({
minDate: [1, $scope.projectYear],
maxDate: [12, $scope.projectYear],
setDate: [
[1, $scope.projectYear],
[12, $scope.projectYear]
],
months: monthList,
ConfirmBtnText: $translate.instant('Confirm'),
CancelBtnText: $translate.instant('ButtonCancel')
});
input.on('datePicker.done', function (e, result) {
$scope.periodFrom = result[0][0];
$scope.periodTo = result[1][0];
});
rangePicker = $(input).data("_ranegPicker");
};
// var rangePicker = null;
//
// var initializePeriodRangePicker = function () {
// //初始化期间选择控件
// var input = $($scope.element).find(".right-container .menu .period-range input");
// var monthList = [
// $translate.instant('Month01'),
// $translate.instant('Month02'),
// $translate.instant('Month03'),
// $translate.instant('Month04'),
// $translate.instant('Month05'),
// $translate.instant('Month06'),
// $translate.instant('Month07'),
// $translate.instant('Month08'),
// $translate.instant('Month09'),
// $translate.instant('Month10'),
// $translate.instant('Month11'),
// $translate.instant('Month12')
// ];
// input = input.rangePicker({
// minDate: [1, $scope.projectYear],
// maxDate: [12, $scope.projectYear],
// setDate: [
// [1, $scope.projectYear],
// [12, $scope.projectYear]
// ],
// months: monthList,
// ConfirmBtnText: $translate.instant('Confirm'),
// CancelBtnText: $translate.instant('ButtonCancel')
// });
// input.on('datePicker.done', function (e, result) {
// $scope.periodFrom = result[0][0];
// $scope.periodTo = result[1][0];
// });
//
// rangePicker = $(input).data("_ranegPicker");
// };
(function () {
initializePeriodRangePicker();
// initializePeriodRangePicker();
$scope.$on("$destroy", function () {
rangePicker.destroy();
});
// $scope.$on("$destroy", function () {
// rangePicker.destroy();
// });
})();
}
};
......
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