Commit 00839ba3 authored by eddie.woo's avatar eddie.woo

modify

parent 79b3576e
......@@ -48,7 +48,7 @@ public class ReportAnalysisController extends BaseController {
try {
return ApiResultDto.success(reportAnalysisService.getIncomeRate(projectId));
} catch (Exception e) {
logger.error("getDispersion error.", e);
logger.error("incomeRate error.", e);
}
return ApiResultDto.fail();
}
......@@ -61,7 +61,46 @@ public class ReportAnalysisController extends BaseController {
try {
return ApiResultDto.success(reportAnalysisService.getIncomeVolatility(projectId));
} catch (Exception e) {
logger.error("getDispersion error.", e);
logger.error("incomeVolatility error.", e);
}
return ApiResultDto.fail();
}
@GetMapping("/vatIncomeRate/{projectId}/{period}")
public ApiResultDto getVatIncomeRate(@PathVariable String projectId, @PathVariable Integer period) {
if (StringUtils.isBlank(projectId)) {
return ApiResultDto.success(Collections.emptyList());
}
try {
return ApiResultDto.success(reportAnalysisService.getVatIncomeRate(projectId, period));
} catch (Exception e) {
logger.error("getVatIncomeRate error.", e);
}
return ApiResultDto.fail();
}
@GetMapping("/vatIncomeLine/{projectId}")
public ApiResultDto getVatIncomeLine(@PathVariable String projectId) {
if (StringUtils.isBlank(projectId)) {
return ApiResultDto.success(Collections.emptyList());
}
try {
return ApiResultDto.success(reportAnalysisService.getVatIncomeLine(projectId));
} catch (Exception e) {
logger.error("getVatIncomeLine error.", e);
}
return ApiResultDto.fail();
}
@GetMapping("/deduction/{projectId}")
public ApiResultDto getDeduction(@PathVariable String projectId) {
if (StringUtils.isBlank(projectId)) {
return ApiResultDto.success(Collections.emptyList());
}
try {
return ApiResultDto.success(reportAnalysisService.getDeduction(projectId));
} catch (Exception e) {
logger.error("getDeduction error.", e);
}
return ApiResultDto.fail();
}
......
......@@ -5,17 +5,13 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.util.DateUtils;
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.dao.*;
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.entity.*;
import pwc.taxtech.atms.invoice.InputInvoiceMapper;
import pwc.taxtech.atms.vat.dao.PeriodCellDataMapper;
import pwc.taxtech.atms.vat.dao.PeriodCellTemplateMapper;
import pwc.taxtech.atms.vat.dao.PeriodDataSourceMapper;
......@@ -41,6 +37,8 @@ public class ReportAnalysisService extends BaseService {
@Resource
private ProjectMapper projectMapper;
@Resource
private OrganizationMapper organizationMapper;
@Resource
private StandardAccountDao standardAccountDao;
@Resource
private PeriodTemplateMapper periodTemplateMapper;
......@@ -50,6 +48,8 @@ public class ReportAnalysisService extends BaseService {
private PeriodCellDataMapper periodCellDataMapper;
@Resource
private PeriodDataSourceMapper periodDataSourceMapper;
@Resource
private InputInvoiceMapper inputInvoiceMapper;
/**
* 增值税负担率
......@@ -162,6 +162,66 @@ public class ReportAnalysisService extends BaseService {
return dto;
}
/**
* 增值税应税收入、增值税免、抵、退办法出口收入 占会计收入比例
*/
public BurdenRateDto getVatIncomeRate(String projectId, Integer period) {
BurdenRateDto dto = new BurdenRateDto();
BigDecimal val = getCellValue(projectId, period, "VAT001", 19, 18);
BigDecimal val2 = getCellValue(projectId, period, "VAT005", 26, 12);
dto.setVatAmount(Lists.newArrayList(val));
dto.setIncome(Lists.newArrayList(val2));
return dto;
}
/**
* 增值税应税收入、增值税免、抵、退办法出口收入 占会计收入比例 趋势
*/
public BurdenRateDto getVatIncomeLine(String projectId) {
BurdenRateDto dto = new BurdenRateDto();
List<BigDecimal> vatAmountList = Lists.newArrayList();
List<BigDecimal> incomeList = 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 sum = val.add(val2);
BigDecimal rate = sum.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
val.divide(sum, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal rate2 = sum.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
val2.divide(sum, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
vatAmountList.add(rate);
incomeList.add(rate2);
}
dto.setVatAmount(vatAmountList);
dto.setIncome(incomeList);
return dto;
}
/**
* 已抵扣进项税波动率
*/
public BurdenRateDto getDeduction(String projectId) {
BurdenRateDto dto = new BurdenRateDto();
List<BigDecimal> rateList = Lists.newArrayList();
Project project = projectMapper.selectByPrimaryKey(projectId);
Organization org = organizationMapper.selectByPrimaryKey(project.getOrganizationId());
for (int p = 1; p <= 12; p++) {
BigDecimal val = getCellValue(projectId, p, "VAT001", 19, 18);
InputInvoiceExample example = new InputInvoiceExample();
example.createCriteria().andGFSHEqualTo(org.getTaxPayerNumber()).andFPZTIn(Lists.newArrayList("0", "2"))
.andLRRQBetween(DateUtils.getPeriodBeginFormat(project.getYear(), p), DateUtils.getPeriodEndFormat(project.getYear(), p));
BigDecimal sum = inputInvoiceMapper.selectByExample(example).stream().map(o ->
NumberUtils.isParsable(o.getHJSE()) ? NumberUtils.createBigDecimal(o.getHJSE()) : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal rate = sum.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
val.divide(sum, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
rateList.add(rate);
}
dto.setRate(rateList);
return dto;
}
/**
* 根据借贷方向获取TB表科目的发生额
*/
......
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
<context-root>/</context-root>
<container-descriptor>
<prefer-application-packages>
<package-name>org.apache.commons.lang.*</package-name>
<package-name>antlr.*</package-name>
<package-name>javax.persistence.*</package-name>
<package-name>org.hibernate.*</package-name>
<package-name>org.apache.xerces.*</package-name>
<package-name>com.fasterxml.jackson.*</package-name>
</prefer-application-packages>
</container-descriptor>
</weblogic-web-app>
\ No newline at end of file
......@@ -48,27 +48,6 @@
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>DruidStatView</servlet-name>
<servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
<init-param>
<param-name>resetEnable</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>loginUsername</param-name>
<param-value>druid</param-value>
</init-param>
<init-param>
<param-name>loginPassword</param-name>
<param-value>druid</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>DruidStatView</servlet-name>
<url-pattern>/druid/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
......
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
<context-root>/</context-root>
<container-descriptor>
<prefer-application-packages>
<package-name>org.apache.commons.lang.*</package-name>
<package-name>antlr.*</package-name>
<package-name>javax.persistence.*</package-name>
<package-name>org.hibernate.*</package-name>
<package-name>org.apache.xerces.*</package-name>
<package-name>com.fasterxml.jackson.*</package-name>
</prefer-application-packages>
</container-descriptor>
</weblogic-web-app>
\ No newline at end of file
......@@ -7,6 +7,7 @@ vatModule.controller('VatModelAnalysisController', ['$scope', '$translate', '$ui
$scope.organizationId = vatSessionService.project.organizationID;
$scope.projectId = vatSessionService.project.id;
$scope.projectYear = vatSessionService.project.year;
$scope.projectPeriod = vatSessionService.month;
$scope.serviceTypeId = vatSessionService.project.serviceTypeID;
var xArray = ['1月', '2月', '3月', '4月', '5月', '6月',
......@@ -369,6 +370,224 @@ vatModule.controller('VatModelAnalysisController', ['$scope', '$translate', '$ui
})
}
//增值税应税收入、增值税免、抵、退办法出口收入 占会计收入比例
function getVatIncomeRateData(chart) {
var yArray = ['增值税应税收入', '增值税免、抵、退出口收入'];
var colors = ['#5793f3', '#d14a61', '#675bba'];
$http.get('/reportAnalysis/vatIncomeRate/' + $scope.projectId + "/" + $scope.projectPeriod, 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: {
type: 'scroll',
bottom: 5,
data: yArray
},
series: [
{
name: '占比',
type: 'pie',
radius: '55%',
center: ['50%', '60%'],
data: [
{value: res.data.vatAmount[0], name: '增值税应税收入'},
{value: res.data.income[0], name: '增值税免、抵、退出口收入'}
],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
chart.setOption(option);
}
})
}
//增值税应税收入、增值税免、抵、退办法出口收入 占会计收入比例 趋势
function getVatIncomeLineData(chart) {
var yArray = ['增值税应税收入', '增值税免、抵、退出口收入'];
var colors = ['#5793f3', '#d14a61', '#675bba'];
$http.get('/reportAnalysis/vatIncomeLine/' + $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: {
type: 'scroll',
bottom: 10,
data: yArray
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data: xArray
}
],
yAxis: [
{
type: 'value',
name: '占比',
// min: 0,
// max: 250,
position: 'right',
axisLine: {
lineStyle: {
color: colors[0]
}
},
axisLabel: {
formatter: function (val) {
return (val * 100) + ' %';
}
}
}
],
series: [
{
name: yArray[0],
type: 'line',
data: res.data.vatAmount
},
{
name: yArray[1],
type: 'line',
data: res.data.income
}
]
};
chart.setOption(option);
}
})
}
//已抵扣进项税波动率
function getDeductionData(chart) {
var yArray = ['占比', '基准值'];
var colors = ['#5793f3', '#d14a61', '#675bba'];
$http.get('/reportAnalysis/deduction/' + $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: {
type: 'scroll',
bottom: 10,
data: yArray
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data: xArray
}
],
yAxis: [
{
type: 'value',
name: '占比',
// max: 25,
position: 'left',
axisLine: {
lineStyle: {
color: colors[1]
}
},
axisLabel: {
formatter: function (val) {
return (val * 100) + ' %';
}
}
}
],
series: [
{
name: yArray[1],
type: 'line',
data: ['1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1']
},
{
name: yArray[0],
type: 'bar',
data: res.data.rate
}
]
};
chart.setOption(option);
}
})
}
function formatNum(strNum) {
if (strNum.length <= 3) {
return strNum;
......@@ -396,11 +615,17 @@ vatModule.controller('VatModelAnalysisController', ['$scope', '$translate', '$ui
var discreteAnalysisDiv = echarts.init(document.getElementById('discreteAnalysisDiv'));
var incomeRateDiv = echarts.init(document.getElementById('incomeRateDiv'));
var incomeVolatilityDiv = echarts.init(document.getElementById('incomeVolatilityDiv'));
var vatIncomeRateDiv = echarts.init(document.getElementById('vatIncomeRateDiv'));
var vatIncomeLineDiv = echarts.init(document.getElementById('vatIncomeLineDiv'));
var deductionDiv = echarts.init(document.getElementById('deductionDiv'));
getBurdenRateData(burdenRateDiv);
getDispersion(discreteAnalysisDiv);
getIncomeRateData(incomeRateDiv);
getIncomeVolatilityData(incomeVolatilityDiv);
getVatIncomeRateData(vatIncomeRateDiv);
getVatIncomeLineData(vatIncomeLineDiv);
getDeductionData(deductionDiv);
}
(function () {
......
......@@ -25,6 +25,14 @@
<div id="vatIncomeLineDiv" name="p_chart"></div>
</div>
</div>
<div class="row">
<div class="col-lg-5 col-md-5">
<div id="deductionDiv" name="p_chart"></div>
</div>
<div class="col-lg-5 col-md-5 col-md-offset-1 col-lg-offset-1">
<div id="" name="p_chart"></div>
</div>
</div>
</div>
<style>
......
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