<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>首页</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="../../layui/css/layui.css" media="all"/>
<link rel="stylesheet" href="../../css/main.css" media="all"/>
<style>
body.childrenBody {
background: #f2f2f2;
margin: 24px;
}
.chart-view {
width: 100%;
height: 380px;
}
.collect-row.big-padding {
height: 128px;
padding: 24px;
border-radius: 2px;
background: #fff;
}
.collect-row.big-padding div {
height: 80px;
}
.collect-row.big-padding div .title {
font-family: MicrosoftYaHei;
font-size: 16px;
color: #333;
height: 21px;
line-height: 21px;
font-weight: 400;
margin-bottom: 8px;
}
.collect-row.big-padding div .content {
font-size: 44px;
font-weight: 700;
}
.collect-row .icon-bg-1 {
background: url(../../images/bg/bg-icon1.png) no-repeat right center;
background-size: 80px 80px;
}
.collect-row .icon-bg-2 {
background: url(../../images/bg/bg-icon2.png) no-repeat right center;
background-size: 80px 80px;
}
.collect-row .icon-bg-3 {
background: url(../../images/bg/bg-icon3.png) no-repeat right center;
background-size: 80px 80px;
cursor: pointer;
}
.collect-row .icon-bg-4 {
background: url(../../images/bg/bg-icon4.png) no-repeat right center;
background-size: 80px 80px;
cursor: pointer;
}
.collect-row .icon-bg-5 {
background: url(../../images/bg/bg-icon5.png) no-repeat right center;
background-size: 80px 80px;
cursor: pointer;
}
.icon-bg-1 .title .org,
.icon-bg-2 .title .org {
color: #2F5855;
}
.icon-bg-3 .title .org,
.icon-bg-4 .title .org {
color: #3B4F7B;
}
.collect-row .icon-bg-1 .content {
color: #2EA79C;
}
.collect-row .icon-bg-2 .content {
color: #FB5B5D;
}
.collect-row .icon-bg-3 .content {
color: #5C8FFF;
}
.collect-row .icon-bg-4 .content {
color: #FF8142;
}
.collect-row .icon-bg-5 .content {
color: #FFB800;
}
.collect-card .layui-card-header {
font-size: 16px;
color: #333;
font-family: MicrosoftYaHei;
}
.collect-card .layui-card-header span {
font-family: MicrosoftYaHeiHeavy;
font-size: 18px;
color: #2F5855;
letter-spacing: 0;
line-height: 24px;
font-weight: 900;
}
.collect-card .layui-card-header span.org1018 {
color: #2F5855;
}
.collect-card .layui-card-header span.org8018 {
color: #3B4F7B;
}
.layui-card-header:before {
content: ' ';
display: inline-block;
vertical-align: -2px;
width: 123px;
height: 4px;
position: absolute;
left: 24px;
bottom: 19px;
border-radius: 2px;
margin-right: 8px;
}
.layui-card-header.header1018:before {
background: rgba(26, 160, 148, 0.20);
}
.layui-card-header.header8018:before {
background: rgba(92, 143, 255, 0.20);
}
.layui-card-header.header-sys:before {
width: 155px;
}
@media screen and (max-width: 432px) {
.chart-view {
height: 332px;
}
}
</style>
</head>
<body class="childrenBody">
<div class="layui-row layui-col-space15">
<div class="layui-col-xs12 layui-col-sm12 layui-col-md2">
<div class="collect-row big-padding" id="db">
<div class="icon-bg-5">
<p class="title">
<span class="org">1018</span>-我的待办
</p>
<p class="content" id="wddb">
</p>
</div>
</div>
</div>
<div class="layui-col-xs12 layui-col-sm12 layui-col-md5">
<div class="layui-row layui-col-space15">
<div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
<div class="collect-row big-padding">
<div class="icon-bg-1">
<p class="title">
<span class="org">1018</span>-待处理包数
</p>
<p class="content" id="dclbs">
</p>
</div>
</div>
</div>
<div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
<div class="collect-row big-padding">
<div class="icon-bg-2">
<p class="title"><span class="org">1018</span>-差异金额(万元)</p>
<p class="content" id="cyje">
</p>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-xs12 layui-col-sm12 layui-col-md5">
<div class="layui-row layui-col-space15">
<div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
<div class="collect-row big-padding">
<div class="icon-bg-3">
<p class="title"><span class="org">8018</span>-待处理包数</p>
<p class="content" id="80dclbs">
</p>
</div>
</div>
</div>
<div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
<div class="collect-row big-padding">
<div class="icon-bg-4">
<p class="title"><span class="org">8018</span>-差异金额(万元)</p>
<p class="content" id="80cyje">
</p>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
<div class="layui-card collect-card">
<div class="layui-card-header header1018 header-sys"><span class="org1018">1018</span>-差异系统情况</div>
<div class="layui-card-body">
<div class="chart-view" id="chart_1"></div>
</div>
</div>
</div>
<div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
<div class="layui-card collect-card">
<div class="layui-card-header header1018"><span class="org1018">1018</span>-差异包数</div>
<div class="layui-card-body">
<div class="chart-view" id="chart_2"></div>
</div>
</div>
</div>
<div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
<div class="layui-card collect-card">
<div class="layui-card-header header1018"><span class="org1018">1018</span>-差异天数</div>
<div class="layui-card-body">
<div class="chart-view" id="chart_3"></div>
</div>
</div>
</div>
<div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
<div class="layui-card collect-card">
<div class="layui-card-header header8018 header-sys"><span class="org8018">8018</span>-差异系统情况</div>
<div class="layui-card-body">
<div class="chart-view" id="chart1_1"></div>
</div>
</div>
</div>
<div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
<div class="layui-card collect-card">
<div class="layui-card-header header8018"><span class="org8018">8018</span>-差异包数</div>
<div class="layui-card-body">
<div class="chart-view" id="chart2_2"></div>
</div>
</div>
</div>
<div class="layui-col-xs12 layui-col-sm6 layui-col-md4">
<div class="layui-card collect-card">
<div class="layui-card-header header8018"><span class="org8018">8018</span>-差异天数</div>
<div class="layui-card-body">
<div class="chart-view" id="chart3_3"></div>
</div>
</div>
</div>
<div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
<div class="layui-card collect-card">
<div class="layui-card-header header1018"><span class="org1018">1018</span>-差异金额</div>
<div class="layui-card-body">
<div class="chart-view chart-qushi loadding" id="chart_5"></div>
</div>
</div>
</div>
<div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
<div class="layui-card collect-card">
<div class="layui-card-header header8018"><span class="org8018">8018</span>-差异金额</div>
<div class="layui-card-body">
<div class="chart-view chart-qushi loadding" id="chart5_5"></div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script type="text/javascript" src="js/home.js"></script>
</body>
</html>
JS
layui.config({
base: '../../layui/lib/' //静态资源所在路径(使用时,根据自己的结构改动),
}).extend({
echarts: 'extend/echarts', //主入口模块
echartsTheme: 'extend/echartsTheme'
}).use(['jquery', 'layer', 'element', 'common', 'echarts', 'echartsTheme'
], function () {
var $ = layui.jquery,
layer = parent.layer === undefined ? layui.layer : parent.layer,
element = layui.element,
echarts = layui.echarts,
eTheme = layui.echartsTheme;
console.log(echarts);
eTheme.register(echarts);
var user = JSON.parse(sessionStorage.getItem("userInfo"));
var userCode = user.userCode;
//1018我的待办
$.ajax({
method: 'post',
url: layui.common.umsBaseURL + "DiffAnalys/getMyDbNum?updateuser=" + userCode,
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
"Access-Token": sessionStorage.getItem("token")
},
async: false,
dataType: "json",
success: function (res) {
if (res.code = '0') {
$('#wddb').html(res.data);
}
}
});
// 饼图
var systemSum;
var data2;
var years = getyear();
//1018待处理包数,差异金额
$.ajax({
method: 'post',
url: layui.common.umsBaseURL + "DiffAnalys/getCountDiff",
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
"Access-Token": sessionStorage.getItem("token")
},
async: false,
dataType: "json",
success: function (res) {
if (res.code = '0') {
$('#dclbs').html(res.data.countpackage);
$('#cyje').html(res.data.status);
}
}
});
//8018待处理包数,差异金额
$.ajax({
method: 'post',
url: layui.common.umsBaseURL + "DiffAnalys8018/getCountDiff",
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
"Access-Token": sessionStorage.getItem("token")
},
async: false,
dataType: "json",
success: function (res) {
if (res.code = '0') {
$('#80dclbs').html(res.data.countpackage);
$('#80cyje').html(res.data.status);
}
}
});
$.ajax({
method: 'post',
url: layui.common.umsBaseURL + "DiffAnalys/getDiffCountSourcsys",
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
"Access-Token": sessionStorage.getItem("token")
},
async: false,
dataType: "json",
success: function (res) {
if (res.code = '0') {
systemSum = res.msg;
data1 = res.data;
}
}
});
var color = ['#66CCCC', '#CCFF66', '#FF99CC', '#FF9999', '#FFCC99'
, '#FF6666', '#FFFF66', '#99CC66', '#666699', '#FF9999'
, '#99CC33', '#FF9900', '#FFCC00', '#FF0033', '#FF9966'
, '#FF9900', '#CCFF00', '#CC3399', '#99CC33', '#FF6600'
, '#993366', '#666633', '#CC0066', '#009999', '#FFCC33']
var optionPieChart1 = getPieOption(systemSum,
'1018-差异系统情况',
data1,
color);
var pieChart1 = echarts.init($('#chart_1')[0], 'tk-green');
pieChart1.setOption(optionPieChart1, true);
var systemSum80;
var data2;
$.ajax({
method: 'post',
url: layui.common.umsBaseURL + "DiffAnalys8018/getDiffCountSourcsys",
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
"Access-Token": sessionStorage.getItem("token")
},
async: false,
dataType: "json",
success: function (res) {
if (res.code = '0') {
systemSum80 = res.msg;
data2 = res.data;
}
}
});
var optionPieChart2 = getPieOption(systemSum80,
'8018-差异系统情况',
data2,
color);
var pieChart2 = echarts.init($('#chart1_1')[0], 'tk-green');
pieChart2.setOption(optionPieChart2, true);
//1018待处理包数,差异金额
var year;
var afteryear;
var diffyear;
$.ajax({
method: 'post',
url: layui.common.umsBaseURL + "DiffAnalys/getDiffCountDate",
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
"Access-Token": sessionStorage.getItem("token")
},
async: false,
dataType: "json",
success: function (res) {
if (res.code = '0') {
year = res.data[0];
afteryear = res.data[1];
diffyear = res.data[2];
}
}
});
var year80;
var afteryear80;
var diffyear80;
$.ajax({
method: 'post',
url: layui.common.umsBaseURL + "DiffAnalys8018/getDiffCountDate",
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
"Access-Token": sessionStorage.getItem("token")
},
async: false,
dataType: "json",
success: function (res) {
if (res.code = '0') {
year80 = res.data[0];
afteryear80 = res.data[1];
diffyear80 = res.data[2];
}
}
});
// 折线图
var optionLine1 = getLineTotalOption(
[years, years - 1],
['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'], [
year,
afteryear
],
['#1AA094', '#FFB800']);
var lineChart1 = echarts.init($('#chart_2')[0], 'tk-green');
lineChart1.setOption(optionLine1, true);
var optionLine2 = getLineTotalOption(
[years, years - 1],
['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'], [
year80,
afteryear80
],
['#5C8FFF', '#FF8142']);
var lineChart2 = echarts.init($('#chart2_2')[0], 'tk-green');
lineChart2.setOption(optionLine2, true);
// 柱状图
var optionBar1 = getBarOption(
[years],
['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'], [
diffyear
],
['#1AA094']);
var barChart1 = echarts.init($('#chart_3')[0], 'tk-green');
barChart1.setOption(optionBar1, true);
var optionBar2 = getBarOption(
[years],
['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'], [
diffyear80
],
['#5C8FFF']);
var barChart2 = echarts.init($('#chart3_3')[0], 'tk-green');
barChart2.setOption(optionBar2, true);
var Surplus;
$.ajax({
method: 'post',
url: layui.common.umsBaseURL + "DiffAnalys/getDiffCountSurplus",
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
"Access-Token": sessionStorage.getItem("token")
},
async: false,
dataType: "json",
success: function (res) {
if (res.code = '0') {
Surplus = res.data;
}
}
});
var Surplus80;
$.ajax({
method: 'post',
url: layui.common.umsBaseURL + "DiffAnalys8018/getDiffCountSurplus",
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
"Access-Token": sessionStorage.getItem("token")
},
async: false,
dataType: "json",
success: function (res) {
if (res.code = '0') {
Surplus80 = res.data;
}
}
});
// 折线图-区域面积
var optionTotalLine1 = getLineOption(
['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
Surplus,
'#1AA094',
['rgba(20,133,123, 0.7)', 'rgba(20,133,123, 0.3)', 'rgba(20,133,123, 0.1)']);
var lineTotalChart1 = echarts.init($('#chart_5')[0], 'tk-green');
lineTotalChart1.setOption(optionTotalLine1, true);
var optionTotalLine2 = getLineOption(
['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
Surplus80,
'#5C8FFF',
['rgba(92,143,255, 0.7)', 'rgba(92,143,255, 0.3)', 'rgba(92,143,255, 0.1)']);
var lineTotalChart2 = echarts.init($('#chart5_5')[0], 'tk-green');
lineTotalChart2.setOption(optionTotalLine2, true);
// 获取环形饼图
function getPieOption(systemSum, seriesName, data, color) {
var lengendData = [];
for (var i = 0; i < data.length; i++) {
lengendData.push(data[i].name);
}
// 这步主要是为了让小圆点的颜色和饼状图的块对应,如果圆点的颜色是统一的,只需要把itemStyle写在series里面
function setLabel(data) {
var opts = [];
for (var i = 0; i < data.length; i++) {
var item = {};
item.name = data[i].name;
item.value = data[i].value;
item.label = {
normal: {
//控制引导线上文字颜色和位置,此处a是显示文字区域,b做一个小圆圈在引导线尾部显示
show: true,
//a和b来识别不同的文字区域
formatter: [
'{a|{d}% {b}}', //引导线上面文字
'{b|}' //引导线下面文字
].join('\n'), //用\n来换行
rich: {
a: {
left: 20,
padding: [0, -80, -15, -80]
},
b: {
height: 5,
width: 5,
lineHeight: 5,
marginBottom: 10,
padding: [0, -5],
borderRadius: 5,
backgroundColor: color[i], // 圆点颜色和饼图块状颜色一致
}
},
}
}
opts.push(item)
}
return opts;
}
var pieOption = {
backgroundColor: '#fff',
animation: true,
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b}: {c} ({d}%)'
},
title: {
text: '{name|总计}\n{val|' + systemSum + '}',
top: '45%',
left: '28%',
textAlign: 'center',
textVerticalAlign: 'middle',
textStyle: {
rich: {
name: {
fontSize: 14,
fontWeight: 'normal',
color: '#666666',
padding: [10, 0],
align: 'center',
},
val: {
fontSize: 18,
fontWeight: 'bold',
color: '#333333',
align: 'center',
}
}
}
},
legend: {
type: 'scroll',
orient: 'vertical',
right: '36',
top: '96',
bottom: '49',
selectedMode: true,
itemGap: 20,
icon: 'pin',
data: lengendData,
textStyle: {
color: '#666666',
rich: {
uname: {
color: '#333',
width: 30,
fontWeight: 'bolder'
},
unum: {
padding: [0, 0, 0, 15],
color: '#666',
fontWeight: 'bolder',
align: 'right'
}
}
},
formatter: function (name) {
var len = data.length;
var tarValue = 0;
var Value = 0;
for (var j = 0; j < len; j++) {
if (data[j].name == name) {
tarValue = data[j].percentage;
Value = data[j].value;
break;
}
}
return '{uname|' + name + '}{unum|' + tarValue + '}{unum|' + Value + '}'
}
},
series: [{
color: color,
name: seriesName,
type: 'pie',
radius: ['45%', '60%'],
center: ['30%', '50%'],
avoidLabelOverlap: false,
startAngle: 315,
label: {
show: false
},
labelLine: {
show: false
},
data: data
}]
}
return pieOption;
}
//获取折线图-堆叠折线图
function getLineTotalOption(legendData, xData, yData, color) {
return {
tooltip: {
show: true,
padding: 10,
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
},
formatter: function (params) {
return '月份:' + params.name + '月<br />数量:' + params.value;//+ ' 万'
}
},
grid: {
top: 10,
left: 15,
right: 15,
bottom: 24,
containLabel: true
},
xAxis: {
axisLabel: {
textStyle: {
color: '#333',
fontSize: 12
}
},
axisLine: {
lineStyle: {
color: '#E8E8E8;'
}
},
axisTick: {
show: false
},
data: xData
},
yAxis: [{
type: 'value',
splitLine: {
show: true,
lineStyle: {
type: 'solid',
color: '#E8E8E8'
}
},
splitArea: {
show: !0,
areaStyle: {
color: ["#fff"]
}
},
axisLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
textStyle: {
color: '#333'
}
}
}],
series: [{
name: legendData[0],
type: 'line',
symbol: 'circle',
symbolSize: 1,
smooth: false,
itemStyle: {
normal: {
color: color[0],
}
},
lineStyle: {
width: 2
},
data: yData[0]
},
{
name: legendData[1],
type: 'line',
symbol: 'circle',
symbolSize: 1,
smooth: false,
itemStyle: {
normal: {
color: color[1],
}
},
lineStyle: {
width: 2
},
data: yData[1]
}
]
}
}
//获取柱状图
function getBarOption(legendData, xData, yData, color) {
var itemStyle = {
normal: {
barBorderRadius: [2, 2, 0, 0]
}
};
var barOption = {
grid: {
y: '10%',
left: 15,
right: 15,
bottom: 24,
containLabel: true
},
tooltip: {
trigger: 'axis'
},
color: color,
// legend: {
// data: legendData
// },
xAxis: [{
type: 'category',
data: xData,
axisTick: {
show: false
},
boundaryGap: true,
axisLine: {
lineStyle: {
color: '#B4B4B4'
}
}
}],
yAxis: [{
type: 'value',
splitLine: {
show: true,
lineStyle: {
type: 'solid',
color: '#E8E8E8'
}
},
splitArea: {
show: !0,
areaStyle: {
color: ["#fff"]
}
},
axisLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
textStyle: {
color: '#333'
}
}
}],
series: [{
name: legendData[0],
type: 'bar',
barGap: 0,
itemStyle: itemStyle,
data: yData[0]
},
{
name: legendData[1],
type: 'bar',
itemStyle: itemStyle,
data: yData[1]
}
]
};
return barOption;
}
// 获取折线图-区域面积图
function getLineOption(xData, yData, color, colorGradient) {
var lineOption = {
grid: {
y: '10%',
left: 15,
right: 15,
bottom: 24,
containLabel: true
},
tooltip: {
show: true,
padding: 10,
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
},
formatter: function (params) {
return '月份:' + params.name + '月<br />数量:' + params.value;//+ ' 万'
}
},
color: color,
xAxis: [{
// type:'category',
data: xData,
boundaryGap: true,
axisLine: {
lineStyle: {
color: '#E8E8E8;'
}
},
axisTick: {
show: false
}
}],
yAxis: [{
splitLine: {
show: true,
lineStyle: {
type: 'solid',
color: '#E8E8E8'
}
},
splitArea: {
show: !0,
areaStyle: {
color: ["#fff"]
}
},
axisLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
textStyle: {
color: '#333'
},
}
}],
series: [{
name: '折线图',
type: 'line',
smooth: true,
symbol: 'circle',
showSymbol: true,
symbolSize: 1,
yAxisIndex: 0,
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: colorGradient[0],
}, {
offset: 0.75,
color: colorGradient[1],
}, {
offset: 1,
color: colorGradient[2],
}],
false
)
}
},
itemStyle: {
normal: {
color: color
}
},
data: yData
}]
};
return lineOption;
}
$("#db").click(function () {
goPage('1018我的待办', 6, '../accountcheck/MyDB.html');
});
function goPage(title, type, page) {
var index = layui.layer.open({
title: title,
type: 2,
anim: 2,
skin: 'c-layer-back',
content: page + "?type=" + type
});
layui.layer.full(index);
}
// $(window).resize(function(){
// if (optionPieChart1)
// optionPieChart1.resize();
// if (optionPieChart2)
// optionPieChart2.resize();
// if (lineChart1)
// lineChart1.resize();
// if (lineChart2)
// lineChart2.resize();
// if (barChart1)
// barChart1.resize();
// if (barChart2)
// barChart2.resize();
// if (lineTotalChart1)
// lineTotalChart1.resize();
// if (lineTotalChart2)
// lineTotalChart2.resize();
// })
//数据格式化
function formatNumber(num) {
var reg = /(?=(\B)(\d{3})+$)/g;
return num.toString().replace(reg, ',');
}
function getyear() {
var date = new Date();
return date.getFullYear();
}
});
后台
package com.taikang.accountcheck.compare1018.controller;
import com.taikang.accountcheck.compare1018.action.DiffAnalysEreportAction;
import com.taikang.accountcheck.compare1018.action.impl.DiffAnalysEreportActionImpl;
import com.taikang.accountcheck.compare1018.dto.DiffAnalysEreportBO;
import com.taikang.check.comm.Result;
import com.taikang.check.datacompare.dto.ConditionVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@RestController
@ResponseBody
@RequestMapping(path = "/DiffAnalys", produces = "application/json;charset=utf-8")
public class DiffAnalysEreportController {
@Resource(name = DiffAnalysEreportActionImpl.ACTION_ID)
private DiffAnalysEreportAction diffAnalysEreportAction;
/**
* 1018我的待办数量
*
* @return
*/
@RequestMapping(value = "/getMyDbNum", method = {RequestMethod.POST})
@ResponseBody
public Result getMyDbNum(ConditionVo data) {
return new Result("0", "success", diffAnalysEreportAction.getMyDbNum(data));
}
/**
* 差异报数和差异金额
*
* @return
*/
@RequestMapping(value = "/getCountDiff", method = {RequestMethod.POST})
@ResponseBody
public Result<DiffAnalysEreportBO> getCountDiff() {
return new Result("0", "success", diffAnalysEreportAction.getCountDiff());
}
/**
* 获取1018每月的差异包数,和差异天数
*
* @return
*/
@RequestMapping(value = "/getDiffCountDate", method = {RequestMethod.POST})
@ResponseBody
public Result getDiffCountDate() {
List diffCountDate = diffAnalysEreportAction.getDiffCountDate();
return new Result("0", "success", diffCountDate);
}
/**
* 获取1018-差异金额
*
* @return
*/
@RequestMapping(value = "/getDiffCountSurplus", method = {RequestMethod.POST})
@ResponseBody
public Result getDiffCountSurplus() {
BigDecimal[] countsurplus = diffAnalysEreportAction.getDiffCountSurplus();
return new Result("0", "success", countsurplus);
}
/**
* 获取1018-差异系统情况
*
* @return
*/
@RequestMapping(value = "/getDiffCountSourcsys", method = {RequestMethod.POST})
@ResponseBody
public Result getDiffCountSourcsys() {
//获取全部机构名
List<DiffAnalysEreportBO> sourcsys = diffAnalysEreportAction.getSourcsyscode();
//计算总数
int sum = 0;
List list = new ArrayList();
List<DiffAnalysEreportBO> diffCountDate = diffAnalysEreportAction.getDiffCountSourcsys();
//取总数
for (DiffAnalysEreportBO diffAnalysEreport : diffCountDate) {
Integer countpackage = diffAnalysEreport.getCountpackage();
sum += countpackage;
}
for (int i = 0; i < sourcsys.size(); i++) {
Map map = new HashMap();
String sourcsyscode1 = sourcsys.get(i).getSourcsyscode();
int count = 0;
if (sum != 0) {
for (DiffAnalysEreportBO diffAnalysEreport : diffCountDate) {
Integer countpackage = diffAnalysEreport.getCountpackage();
String sourcsyscode = diffAnalysEreport.getSourcsyscode();
if (sourcsyscode.contains(sourcsyscode1)) {
count += countpackage;
}
}
map.put("value", count);
DecimalFormat df = new DecimalFormat("0.00");
map.put("percentage", (df.format((float) count / (float) sum * 100.00)) + "%");
} else {
map.put("value", 0);
map.put("percentage", "0%");
}
map.put("name", sourcsyscode1);
list.add(map);
}
return new Result("0", String.valueOf(sum), list);
}
}
package com.taikang.accountcheck.compare1018.service.impl;
import com.taikang.accountcheck.compare1018.dao.DiffAnalysEreportMapper;
import com.taikang.accountcheck.compare1018.dto.DiffAnalysEreportBO;
import com.taikang.accountcheck.compare1018.service.DiffAnalysEreportService;
import com.taikang.check.datacompare.dto.ConditionVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@Service(DiffAnalysEreportSreviceImpl.SERVICE_ID)
public class DiffAnalysEreportSreviceImpl implements DiffAnalysEreportService {
public static final String SERVICE_ID = "DiffAnalysEreportSreviceImpl";
@Autowired
@SuppressWarnings("all")
private DiffAnalysEreportMapper diffAnalysEreportDao;
@Override
public DiffAnalysEreportBO getCountDiff() {
DiffAnalysEreportBO countDiff = diffAnalysEreportDao.getCountDiff();
BigDecimal countsurplus = countDiff.getCountsurplus();
DecimalFormat df = new DecimalFormat("0.00");
String format = df.format(countsurplus.divide(BigDecimal.valueOf(10000)));
countDiff.setStatus(format);
return countDiff;
}
@Override
public List getDiffCountDate() {
DiffAnalysEreportBO diffAnalysEreportBO = new DiffAnalysEreportBO();
LocalDateTime now = LocalDateTime.now();
String year = String.valueOf(now.getYear());
List list = new ArrayList();
//当年包数,天数
int[] countPackgage = new int[12];
int[] countDate = new int[12];
//去年包数
int[] countPackgage2 = new int[12];
diffAnalysEreportBO.setYear(year);
List<DiffAnalysEreportBO> diffCountDate = diffAnalysEreportDao.getDiffCountDate(diffAnalysEreportBO);
//去年包数
List<DiffAnalysEreportBO> diffCountPackgage = diffAnalysEreportDao.getLastCountPackgage(diffAnalysEreportBO);
for (DiffAnalysEreportBO diffAnalysEreport : diffCountDate) {
countPackgage[diffAnalysEreport.getMonth() - 1] = diffAnalysEreport.getCountpackage();
countDate[diffAnalysEreport.getMonth() - 1] = diffAnalysEreport.getCountdate();
}
for(DiffAnalysEreportBO diffAnalysEreport : diffCountPackgage){
countPackgage2[diffAnalysEreport.getMonth() - 1] = diffAnalysEreport.getCountpackage();
}
list.add(countPackgage);
list.add(countPackgage2);
list.add(countDate);
return list;
}
@Override
public BigDecimal[] getDiffCountSurplus() {
DiffAnalysEreportBO diffAnalysEreportBO = new DiffAnalysEreportBO();
LocalDateTime now = LocalDateTime.now();
String year = String.valueOf(now.getYear());
BigDecimal[] countsurplus = new BigDecimal[12];
diffAnalysEreportBO.setYear(year);
List<DiffAnalysEreportBO> diffCountDate = diffAnalysEreportDao.getDiffCountSurplus(diffAnalysEreportBO);
for (DiffAnalysEreportBO diffAnalysEreport : diffCountDate) {
countsurplus[diffAnalysEreport.getMonth() - 1] = diffAnalysEreport.getSurplus();
}
for (int i = 0; i < countsurplus.length; i++) {
if (countsurplus[i] == null) {
countsurplus[i] = new BigDecimal("0.00");
}
}
return countsurplus;
}
@Override
public List<DiffAnalysEreportBO> getDiffCountSourcsys() {
List<DiffAnalysEreportBO> diffCountDate = diffAnalysEreportDao.getDiffCountSourcsys();
return diffCountDate;
}
@Override
public List<DiffAnalysEreportBO> getSourcsyscode() {
return diffAnalysEreportDao.getSourcsyscode();
}
@Override
public Integer getMyDbNum(ConditionVo data) {
return diffAnalysEreportDao.getMyDbNum(data);
}
}