diff --git a/yanzhu-bigscreen/src/api/greenCarbon.js b/yanzhu-bigscreen/src/api/greenCarbon.js new file mode 100644 index 00000000..fd0e9cf6 --- /dev/null +++ b/yanzhu-bigscreen/src/api/greenCarbon.js @@ -0,0 +1,157 @@ +import request from "@/utils/request"; +import dayjs from 'dayjs' +const groupByAll = (data) => { + return new Promise((resolve) => { + return request({ + url: "/manage/greenCarbonData/groupByAll", + method: "get", + params: data, + }).then((d) => { + let tmps=(d.data||[]).map(it=>{ + it.sumEmissionReduction=(it.sumEstimateValue||0)-(it.sumPracticalValue||0); + it.emissionReduction=(it.estimateValue||0)-(it.practicalValue||0); + return it; + }) + let sumEmissionReduction=0; + let sumEstimateValue=0; + let sumPracticalValue=0; + let emissionReduction=0; + let estimateValue=0; + let practicalValue=0; + tmps.forEach(it=>{ + sumEmissionReduction+=(it.sumEmissionReduction||0); + sumEstimateValue+=(it.sumEstimateValue||0); + sumPracticalValue+=(it.sumPracticalValue||0); + emissionReduction+=(it.emissionReduction||0); + estimateValue+=(it.estimateValue||0); + practicalValue+=(it.practicalValue||0); + }); + tmps.push({ + factorType:0, + sumEmissionReduction:sumEmissionReduction, + sumEstimateValue:sumEstimateValue, + sumPracticalValue:sumPracticalValue, + emissionReduction:emissionReduction, + estimateValue:estimateValue, + practicalValue:practicalValue + }) + resolve(tmps) + }); + }); +}; + +const groupCurrentMonth = (data) => { + return new Promise((resolve) => { + return request({ + url: "/manage/greenCarbonData/groupCurrentMonth", + method: "get", + params: data, + }).then(d=>{ + let tmps=(d.data||[]).map(it=>{ + it.emissionReduction=(it.estimateValue||0)-(it.practicalValue||0); + return it; + }) + let emissionReduction=0; + let estimateValue=0; + let practicalValue=0; + tmps.forEach(it=>{ + emissionReduction+=(it.emissionReduction||0); + estimateValue+=(it.estimateValue||0); + practicalValue+=(it.practicalValue||0); + }); + tmps.push({ + factorType:0, + emissionReduction:emissionReduction, + estimateValue:estimateValue, + practicalValue:practicalValue + }) + resolve(tmps) + }); + }); +}; +const getGroupData=(tmps,data,factorType,dataType)=>{ + let titles=[]; + let res=[]; + let dt=dayjs(data.createTime); + for(let i=0;i<12;i++){ + let date=dt.add(i,"month"); + let year=date.$y; + let month=date.$M+1; + titles.push(month+"月"); + let objs=tmps.filter(it=>(it.factorType==factorType||factorType==0)&& it.comId==year && it.projectId==month); + let val=null; + if(objs.length>0){ + if(dataType==1){ + val=objs[0].estimateValue/1000.0 + } + if(dataType==2){ + val=objs[0].practicalValue/1000.0 + } + if(dataType==3){ + val=((objs[0].estimateValue||0) - (val=objs[0].practicalValue||0))/1000.0 + } + } + res.push(val); + } + return { + titles:titles, + datas:res + } +} + +const groupByYearMonth = (data) => { + return new Promise((resolve) => { + return request({ + url: "/manage/greenCarbonData/groupByYearMonth", + method: "get", + params: data, + }).then(d=>{ + let tmps=d.data||[]; + let buildData={ + //预估 + estimate: getGroupData(tmps,data,1,1), + //实际 + practical:getGroupData(tmps,data,1,2), + //减排 + emissionReduction:getGroupData(tmps,data,1,3), + }; + let oilData={ + //预估 + estimate: getGroupData(tmps,data,2,1), + //实际 + practical:getGroupData(tmps,data,2,2), + //减排 + emissionReduction:getGroupData(tmps,data,2,3), + }; + let powerData={ + //预估 + estimate: getGroupData(tmps,data,3,1), + //实际 + practical:getGroupData(tmps,data,3,2), + //减排 + emissionReduction:getGroupData(tmps,data,3,3), + }; + let totalData={ + //预估 + estimate: getGroupData(tmps,data,0,1), + //实际 + practical:getGroupData(tmps,data,0,2), + //减排 + emissionReduction:getGroupData(tmps,data,0,3), + }; + resolve({ + buildData:buildData, + oilData:oilData, + powerData:powerData, + totalData:totalData, + }) + + }); + }); +}; + +export default { + groupByAll, + groupCurrentMonth, + groupByYearMonth, +}; diff --git a/yanzhu-bigscreen/src/api/index.js b/yanzhu-bigscreen/src/api/index.js index 5ac86311..e3c273a9 100644 --- a/yanzhu-bigscreen/src/api/index.js +++ b/yanzhu-bigscreen/src/api/index.js @@ -4,11 +4,13 @@ import project from './project' import weather from './weather' import detail from './detail' import dict from './dict' +import greenCarbon from './greenCarbon' export default { http:axios, downFile:download, project, weather, detail, - dict + dict, + greenCarbon } \ No newline at end of file diff --git a/yanzhu-bigscreen/src/assets/icons/svg/power.svg b/yanzhu-bigscreen/src/assets/icons/svg/power.svg new file mode 100644 index 00000000..ea991568 --- /dev/null +++ b/yanzhu-bigscreen/src/assets/icons/svg/power.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yanzhu-bigscreen/src/views/greenCarbon.vue b/yanzhu-bigscreen/src/views/greenCarbon.vue index 0c0986bc..0b81f845 100644 --- a/yanzhu-bigscreen/src/views/greenCarbon.vue +++ b/yanzhu-bigscreen/src/views/greenCarbon.vue @@ -10,7 +10,7 @@
-
2222L
+
{{ leftOilData[0] }}L
施工用油
@@ -41,7 +41,7 @@
-
2999339
+
{{ leftPowerData[0] }}
kW
@@ -51,9 +51,9 @@
-
+
-
2999339
+
{{ (leftPowerData[1]/1000.0).toFixed(1) }}
(T CO₂)
@@ -63,9 +63,9 @@
-
+
-
2999339
+
{{ (leftPowerData[2]/1000.0).toFixed(1) }}
(T CO₂)
@@ -87,7 +87,7 @@ 碳排放预估总量(T CO₂)
- +
@@ -98,7 +98,7 @@ 碳排放监测累计总量(T CO₂)
- +
@@ -109,7 +109,7 @@ 当月碳排放监测量(T CO₂)
- +
@@ -136,10 +136,16 @@ + + +
@@ -157,6 +163,12 @@ export default { prjImgs: [], selProject: null, prjInfo: {}, + allData: [], + curMonthData: [], + yearMonthData: {}, + leftOilData: [0, 0, 0, 0], + leftPowerData:[0,0,0,40,60], + totalData:[0,0,0], } }, mounted() { @@ -184,12 +196,72 @@ export default { this.prjInfo = d.data || {}; this.prjImgs = (this.prjInfo?.setting?.orgImage || '').split(",").filter(d => d); }); + this.loadData(); + }, + loadData() { + let projectId = this.selProject.id; + let comId = this.selProject.comId; + let ajax = [ + this.$api.greenCarbon.groupByAll({ + projectId: projectId, + comId: comId + }), + this.$api.greenCarbon.groupCurrentMonth({ + projectId: projectId, + comId: comId, + createTime: this.$dt(new Date()).format("YYYY-MM-01"), + updateTime: this.$dt(new Date()).endOf("month").format("YYYY-MM-DD") + }), + this.$api.greenCarbon.groupByYearMonth({ + projectId: projectId, + comId: comId, + createTime: this.$dt(new Date()).add(-11, "month").format("YYYY-MM-01"), + updateTime: this.$dt(new Date()).endOf("month").format("YYYY-MM-DD") + }), + ]; + this.$api.http.all(ajax).then(res => { + console.log(res) + this.allData = res[0]; + this.curMonthData = res[1]; + this.yearMonthData = res[2]; + let tmps = this.allData.filter(it => it.factorType == 2); + this.leftOilData = tmps.length > 0 ? [ + tmps[0].practicalValue, + tmps[0].sumPracticalValue, + tmps[0].sumEmissionReduction, + (Math.round(tmps[0].sumEstimateValue / 10000) + 1) * 10, + ] : [0, 0, 0, 0]; + tmps = this.allData.filter(it => it.factorType == 3); + this.leftPowerData=tmps.length>0?[ + tmps[0].practicalValue, + tmps[0].sumPracticalValue, + tmps[0].sumEmissionReduction, + tmps[0].sumEstimateValue==0?0:tmps[0].sumPracticalValue*100/tmps[0].sumEstimateValue, + tmps[0].sumEstimateValue==0?0:tmps[0].sumEmissionReduction*100/tmps[0].sumEstimateValue, + + ]:[0,0,0,0,0]; + tmps = this.allData.filter(it => it.factorType == 0); + this.totalData[0]=tmps.length>0?tmps[0].sumEstimateValue:0; + this.totalData[1]=tmps.length>0?tmps[0].sumPracticalValue:0; + tmps=this.curMonthData.filter(it=>it.factorType==0); + this.totalData[2]=tmps.length>0?tmps[0].emissionReduction:0 + this.chartKey++; + }); }, renderChart1() { + let tmps = this.allData.filter(it => it.factorType == 1); + let datas = tmps.length > 0 ? [tmps[0].sumPracticalValue, tmps[0].sumEmissionReduction] : [0, 0]; let is1K = this.$dpi() == "1K"; let is2K = this.$dpi() == "2K"; let option = { color: ['#ff9f1a', '#00a4e6'], + tooltip: { + trigger: "item", + valueFormatter: (v) => { return v + 'T CO₂' }, + textStyle: { + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + }, legend: { bottom: is1K ? '0%' : is2K ? '10%' : '10%', left: 'center', @@ -214,7 +286,7 @@ export default { borderWidth: 2 }, label: { - formatter: ["{b|{b}}", "{c|{c}\nT CO₂}"].join("\n"),//"{b|b}\n{c|c T CO2}", + formatter: ["{b|{b}}", "{c|{c}\nT CO₂}"].join("\n"), rich: { b: { color: '#fff', @@ -234,9 +306,8 @@ export default { show: true }, data: [ - { value: 1048, name: '碳排放' }, - { value: 735, name: '碳减排' }, - + { value: (datas[0] / 1000.0).toFixed(1), name: '碳排放' }, + { value: (datas[1] / 1000.0).toFixed(1), name: '碳减排' }, ] } ] @@ -252,7 +323,7 @@ export default { type: 'gauge', startAngle: 180, endAngle: 0, - max: 6000, + max: this.leftOilData[3], center: ['50%', '90%'], radius: '120%', itemStyle: { @@ -310,7 +381,7 @@ export default { }, data: [ { - value: 4000, + value: (this.leftOilData[1] / 1000.0).toFixed(1), name: '碳排放(T CO₂)' } ] @@ -328,7 +399,7 @@ export default { type: 'gauge', startAngle: 180, endAngle: 0, - max: 6000, + max: this.leftOilData[3], center: ['50%', '90%'], radius: '120%', itemStyle: { @@ -386,7 +457,7 @@ export default { }, data: [ { - value: 4000, + value: (this.leftOilData[2] / 1000.0).toFixed(1), name: '碳减排(T CO₂)' } ] @@ -396,8 +467,19 @@ export default { return option; }, renderChart4() { + let sum=(objs)=>{ + let res=0; + objs.forEach(it=>{ + res+=(it||0); + }); + return res; + } let is1K = this.$dpi() == "1K"; let is2K = this.$dpi() == "2K"; + let datas=[0,0,0]; + datas[0]=this.yearMonthData.buildData?sum(this.yearMonthData.buildData.emissionReduction.datas):0; + datas[1]=this.yearMonthData.oilData?sum(this.yearMonthData.oilData.emissionReduction.datas):0; + datas[2]=this.yearMonthData.powerData?sum(this.yearMonthData.powerData.emissionReduction.datas):0; let option = { legend: { @@ -411,6 +493,13 @@ export default { fontSize: is1K ? 14 : is2K ? 20 : 30, } }, + tooltip: { + trigger: "item", + valueFormatter: (v) => { return v + 'T CO₂' }, + textStyle: { + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + }, color: ['#C060F6', '#5087EC', '#FFBB3A'], series: [ { @@ -424,9 +513,9 @@ export default { borderWidth: 2 }, data: [ - { value: 40000, name: '电力' }, - { value: 38888, name: '建材' }, - { value: 32222, name: '油耗' }, + { value: datas[2].toFixed(1), name: '电力' }, + { value: datas[0].toFixed(1), name: '建材' }, + { value: datas[1].toFixed(1), name: '油耗' }, ], label: { overflow: 'none', @@ -457,7 +546,467 @@ export default { let is1K = this.$dpi() == "1K"; let is2K = this.$dpi() == "2K"; let option = { - + grid: { + left: "5%", + right: "5%", + bottom: "0%", + top: "15%", + containLabel: true, + }, + tooltip: { + trigger: "axis", + valueFormatter: (v) => { return v?v:'- ' + 'T CO₂' }, + textStyle: { + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + }, + legend: { + top: is1K ? '0%' : is2K ? '0%' : '0%', + left: 'center', + itemWidth: is1K ? 25 : is2K ? 30 : 40, + itemHeight: is1K ? 14 : is2K ? 20 : 20, + itemGap: is1K ? 20 : is2K ? 30 : 40, + textStyle: { + color: "#fff", + fontSize: is1K ? 14 : is2K ? 20 : 30, + } + }, + calculable: true, + xAxis: [ + { + type: "category", + boundaryGap: false, + data: this.yearMonthData?.totalData?.emissionReduction?.titles||[], + axisLabel: { + fontSize: is1K ? 12 : is2K ? 14 : 24, + color: "#a2c8f9" + }, + splitLine: { + lineStyle: { + opacity: 0.1 + } + } + }, + ], + yAxis: [ + { + type: "value", + axisLabel: { + formatter: '{value}T CO₂', + color: "#2ec2b3", + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + splitLine: { + lineStyle: { + opacity: 0.1 + } + }, + }, + ], + series: [ + { + name: '碳预估', + type: "line", + smooth: true, + label: { + show: true, + color: "#4DAAFC", + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + lineStyle: { + color: "#7ddff2", + }, + itemStyle: { + normal: { areaStyle: { type: "default", color: "#7ddff2", opacity: 0.1 } }, + }, + data: this.yearMonthData?.totalData?.estimate?.datas||[], + }, + { + name: '碳排放', + type: "line", + smooth: true, + label: { + show: true, + color: "#4DAAFC", + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + lineStyle: { + color: "#006594", + }, + itemStyle: { + normal: { areaStyle: { type: "default", color: "#006594", opacity: 0.1 } }, + }, + data: this.yearMonthData?.totalData?.practical?.datas||[], + }, + { + name: '碳减排', + type: "line", + smooth: true, + label: { + show: true, + color: "#4DAAFC", + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + lineStyle: { + color: "#7db800", + }, + itemStyle: { + normal: { areaStyle: { type: "default", color: "#7db800", opacity: 0.1 } }, + }, + data: this.yearMonthData?.totalData?.emissionReduction?.datas||[], + }, + ], + }; + return option; + }, + renderChart6() { + let is1K = this.$dpi() == "1K"; + let is2K = this.$dpi() == "2K"; + let option = { + grid: { + left: "5%", + right: "5%", + bottom: "0%", + top: "15%", + containLabel: true, + }, + tooltip: { + trigger: "axis", + valueFormatter: (v) => { return v?v:' - ' + 'T CO₂' }, + textStyle: { + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + }, + legend: { + top: is1K ? '0%' : is2K ? '0%' : '0%', + left: 'center', + itemWidth: is1K ? 25 : is2K ? 30 : 40, + itemHeight: is1K ? 14 : is2K ? 20 : 20, + itemGap: is1K ? 20 : is2K ? 30 : 40, + textStyle: { + color: "#fff", + fontSize: is1K ? 14 : is2K ? 20 : 30, + } + }, + calculable: true, + xAxis: [ + { + type: "category", + boundaryGap: false, + data: this.yearMonthData?.buildData?.emissionReduction?.titles||[], + axisLabel: { + fontSize: is1K ? 12 : is2K ? 14 : 24, + color: "#a2c8f9" + }, + splitLine: { + lineStyle: { + opacity: 0.1 + } + } + }, + ], + yAxis: [ + { + type: "value", + axisLabel: { + formatter: '{value}T CO₂', + color: "#2ec2b3", + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + splitLine: { + lineStyle: { + opacity: 0.1 + } + }, + }, + ], + series: [ + { + name: '碳预估', + type: "bar", + smooth: true, + label: { + show: false, + color: "#4DAAFC", + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + lineStyle: { + color: "#7ddff2", + }, + itemStyle: { + normal: { areaStyle: { type: "default", color: "#7ddff2", opacity: 0.1 } }, + }, + data:this.yearMonthData?.buildData?.estimate?.datas||[], + }, + { + name: '碳排放', + type: "bar", + smooth: true, + label: { + show: false, + color: "#4DAAFC", + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + lineStyle: { + color: "#006594", + }, + itemStyle: { + normal: { areaStyle: { type: "default", color: "#006594", opacity: 0.1 } }, + }, + data: this.yearMonthData?.buildData?.practical?.datas||[], + }, + { + name: '碳减排', + type: "bar", + smooth: true, + label: { + show: false, + color: "#4DAAFC", + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + lineStyle: { + color: "#7db800", + }, + itemStyle: { + normal: { areaStyle: { type: "default", color: "#7db800", opacity: 0.1 } }, + }, + data: this.yearMonthData?.buildData?.emissionReduction?.datas||[], + }, + ], + }; + return option; + }, + renderChart7() { + let is1K = this.$dpi() == "1K"; + let is2K = this.$dpi() == "2K"; + let option = { + grid: { + left: "5%", + right: "5%", + bottom: "0%", + top: "15%", + containLabel: true, + }, + tooltip: { + trigger: "axis", + valueFormatter: (v) => { return v?v:' - ' + 'T CO₂' }, + textStyle: { + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + }, + legend: { + top: is1K ? '0%' : is2K ? '0%' : '0%', + left: 'center', + itemWidth: is1K ? 25 : is2K ? 30 : 40, + itemHeight: is1K ? 14 : is2K ? 20 : 20, + itemGap: is1K ? 20 : is2K ? 30 : 40, + textStyle: { + color: "#fff", + fontSize: is1K ? 14 : is2K ? 20 : 30, + } + }, + calculable: true, + xAxis: [ + { + type: "category", + boundaryGap: false, + data: this.yearMonthData?.oilData?.emissionReduction?.titles||[], + axisLabel: { + fontSize: is1K ? 12 : is2K ? 14 : 24, + color: "#a2c8f9" + }, + splitLine: { + lineStyle: { + opacity: 0.1 + } + } + }, + ], + yAxis: [ + { + type: "value", + axisLabel: { + formatter: '{value}T CO₂', + color: "#2ec2b3", + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + splitLine: { + lineStyle: { + opacity: 0.1 + } + }, + }, + ], + series: [ + { + name: '碳预估', + type: "line", + smooth: true, + label: { + show: true, + color: "#4DAAFC", + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + lineStyle: { + color: "#7ddff2", + }, + itemStyle: { + normal: { areaStyle: { type: "default", color: "#7ddff2", opacity: 0.1 } }, + }, + data: this.yearMonthData?.oilData?.estimate?.datas||[], + }, + { + name: '碳排放', + type: "line", + smooth: true, + label: { + show: true, + color: "#4DAAFC", + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + lineStyle: { + color: "#006594", + }, + itemStyle: { + normal: { areaStyle: { type: "default", color: "#006594", opacity: 0.1 } }, + }, + data: this.yearMonthData?.oilData?.practical?.datas||[], + }, + { + name: '碳减排', + type: "line", + smooth: true, + label: { + show: true, + color: "#4DAAFC", + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + lineStyle: { + color: "#7db800", + }, + itemStyle: { + normal: { areaStyle: { type: "default", color: "#7db800", opacity: 0.1 } }, + }, + data: this.yearMonthData?.oilData?.emissionReduction?.datas||[], + }, + ], + }; + return option; + }, + renderChart8() { + let is1K = this.$dpi() == "1K"; + let is2K = this.$dpi() == "2K"; + let option = { + grid: { + left: "5%", + right: "5%", + bottom: "0%", + top: "15%", + containLabel: true, + }, + tooltip: { + trigger: "axis", + valueFormatter: (v) => { return v?v:' - ' + 'T CO₂' }, + textStyle: { + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + }, + legend: { + top: is1K ? '0%' : is2K ? '0%' : '0%', + left: 'center', + itemWidth: is1K ? 25 : is2K ? 30 : 40, + itemHeight: is1K ? 14 : is2K ? 20 : 20, + itemGap: is1K ? 20 : is2K ? 30 : 40, + textStyle: { + color: "#fff", + fontSize: is1K ? 14 : is2K ? 20 : 30, + } + }, + calculable: true, + xAxis: [ + { + type: "category", + boundaryGap: false, + data: this.yearMonthData?.powerData?.emissionReduction?.titles||[], + axisLabel: { + fontSize: is1K ? 12 : is2K ? 14 : 24, + color: "#a2c8f9" + }, + splitLine: { + lineStyle: { + opacity: 0.1 + } + } + }, + ], + yAxis: [ + { + type: "value", + axisLabel: { + formatter: '{value}T CO₂', + color: "#2ec2b3", + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + splitLine: { + lineStyle: { + opacity: 0.1 + } + }, + }, + ], + series: [ + { + name: '碳预估', + type: "bar", + smooth: true, + label: { + show: false, + color: "#4DAAFC", + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + lineStyle: { + color: "#7ddff2", + }, + itemStyle: { + normal: { areaStyle: { type: "default", color: "#7ddff2", opacity: 0.1 } }, + }, + data:this.yearMonthData?.powerData?.estimate?.datas||[], + }, + { + name: '碳排放', + type: "bar", + smooth: true, + label: { + show: false, + color: "#4DAAFC", + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + lineStyle: { + color: "#006594", + }, + itemStyle: { + normal: { areaStyle: { type: "default", color: "#006594", opacity: 0.1 } }, + }, + data: this.yearMonthData?.powerData?.practical?.datas||[], + }, + { + name: '碳减排', + type: "bar", + smooth: true, + label: { + show: false, + color: "#4DAAFC", + fontSize: is1K ? 12 : is2K ? 14 : 24 + }, + lineStyle: { + color: "#7db800", + }, + itemStyle: { + normal: { areaStyle: { type: "default", color: "#7db800", opacity: 0.1 } }, + }, + data: this.yearMonthData?.powerData?.emissionReduction?.datas||[], + }, + ], }; return option; } @@ -1029,6 +1578,7 @@ export default { .el-col { &.et-chart1 { position: relative; + .time-img { position: absolute; width: 400px; diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/GreenCarbonData.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/GreenCarbonData.java index 2012672a..f8061161 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/GreenCarbonData.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/GreenCarbonData.java @@ -6,6 +6,7 @@ import org.apache.commons.lang3.builder.ToStringStyle; import com.yanzhu.common.core.annotation.Excel; import com.yanzhu.common.core.web.domain.BaseEntity; +import java.math.BigDecimal; import java.util.Date; /** * 建碳管理对象 green_carbon_data @@ -34,11 +35,11 @@ public class GreenCarbonData extends BaseEntity /** 预估使用数量 */ @Excel(name = "预估使用数量") - private Long estimateValue; + private BigDecimal estimateValue; /** 实际使用量 */ @Excel(name = " 实际使用量") - private Long practicalValue; + private BigDecimal practicalValue; /** 状态 */ @Excel(name = "状态") @@ -51,6 +52,25 @@ public class GreenCarbonData extends BaseEntity private Long factorType; private Date dataDate; + private BigDecimal sumEstimateValue; + private BigDecimal sumPracticalValue; + + public BigDecimal getSumEstimateValue() { + return sumEstimateValue; + } + + public void setSumEstimateValue(BigDecimal sumEstimateValue) { + this.sumEstimateValue = sumEstimateValue; + } + + public BigDecimal getSumPracticalValue() { + return sumPracticalValue; + } + + public void setSumPracticalValue(BigDecimal sumPracticalValue) { + this.sumPracticalValue = sumPracticalValue; + } + public Long getFactorType() { return factorType; } @@ -113,21 +133,21 @@ public class GreenCarbonData extends BaseEntity { return itemId; } - public void setEstimateValue(Long estimateValue) + public void setEstimateValue(BigDecimal estimateValue) { this.estimateValue = estimateValue; } - public Long getEstimateValue() + public BigDecimal getEstimateValue() { return estimateValue; } - public void setPracticalValue(Long practicalValue) + public void setPracticalValue(BigDecimal practicalValue) { this.practicalValue = practicalValue; } - public Long getPracticalValue() + public BigDecimal getPracticalValue() { return practicalValue; } diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/GreenCarbonItem.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/GreenCarbonItem.java index e22e71d1..aa6d5b90 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/GreenCarbonItem.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/GreenCarbonItem.java @@ -6,6 +6,7 @@ import org.apache.commons.lang3.builder.ToStringStyle; import com.yanzhu.common.core.annotation.Excel; import com.yanzhu.common.core.web.domain.BaseEntity; +import java.math.BigDecimal; import java.util.Date; /** @@ -49,7 +50,7 @@ public class GreenCarbonItem extends BaseEntity /** 碳排放因子 */ @Excel(name = "碳排放因子") - private Long carbonFactor; + private BigDecimal carbonFactor; @Excel(name = "说明") private String remark; @@ -137,12 +138,12 @@ public class GreenCarbonItem extends BaseEntity { return unit; } - public void setCarbonFactor(Long carbonFactor) + public void setCarbonFactor(BigDecimal carbonFactor) { this.carbonFactor = carbonFactor; } - public Long getCarbonFactor() + public BigDecimal getCarbonFactor() { return carbonFactor; } diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/mapper/GreenCarbonDataMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/mapper/GreenCarbonDataMapper.java index e785bff6..91d5cca4 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/mapper/GreenCarbonDataMapper.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/mapper/GreenCarbonDataMapper.java @@ -63,4 +63,16 @@ public interface GreenCarbonDataMapper * 按类型分组统计 */ List groupByFactorType(GreenCarbonData greenCarbonData); + /** + * 按大类分组统计 + */ + List groupByAll(GreenCarbonData where); + /** + * 当前月按大类分组统计 + */ + List groupCurrentMonth(GreenCarbonData where); + /** + * 最近12个月按大类和月份分组统计 + */ + List groupByYearMonth(GreenCarbonData where); } diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/GreenCarbonDataMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/GreenCarbonDataMapper.xml index 5ae0ef21..24961d4e 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/GreenCarbonDataMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/GreenCarbonDataMapper.xml @@ -12,6 +12,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -66,6 +68,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" GROUP BY g.carbon_factor_type + + +