Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skboot-zhongye
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
e8480097
由
康伟
编写于
2024-12-17 11:50:53 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
kangwei: 重构电耗分析相关接口,数据查询将pg数据改为日报报数
1 个父辈
4914a3cd
全部展开
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
276 行增加
和
164 行删除
sk-base-common/src/main/java/com/skua/common/report/vo/DataViewVO.java
sk-base-common/src/main/java/com/skua/common/report/vo/DrugChartsVO.java
sk-base-common/src/main/java/com/skua/tool/util/JSUtils.java
sk-module-equipment/src/main/java/com/skua/modules/equipment/dto/TonOfWaterAndLoadRateDto.java
sk-module-equipment/src/main/java/com/skua/modules/equipment/dto/TonOfWaterTrendDto.java
sk-module-equipment/src/main/java/com/skua/modules/equipment/mapper/ComprehensiveSupervisionMapper.java
sk-module-equipment/src/main/java/com/skua/modules/equipment/mapper/xml/ComprehensiveSupervisionMapper.xml
sk-module-equipment/src/main/java/com/skua/modules/equipment/service/impl/PowerConsumptionAnalusisServiceImpl.java
sk-module-equipment/src/main/java/com/skua/modules/equipment/service/impl/PowerConsumptionAnalusisServiceImplBak.java
sk-base-common/src/main/java/com/skua/common/report/vo/DataViewVO.java
0 → 100644
查看文件 @
e848009
package
com
.
skua
.
common
.
report
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
/**
* 水质水量报表
* @auther kangwei
* @create 2024-11-27-9:10
*/
@Data
public
class
DataViewVO
{
@ApiModelProperty
(
value
=
"时间"
)
private
String
time
;
@ApiModelProperty
(
value
=
"水厂"
)
private
String
departId
;
@ApiModelProperty
(
value
=
"负荷率"
)
private
String
fhl
;
@ApiModelProperty
(
value
=
"进水量"
)
private
BigDecimal
JSL
;
@ApiModelProperty
(
value
=
"出水量"
)
private
BigDecimal
CSL
;
@ApiModelProperty
(
value
=
"处理水量"
)
private
BigDecimal
CLSL
;
@ApiModelProperty
(
value
=
"进水总磷"
)
private
String
JSZL
;
@ApiModelProperty
(
value
=
"进水总磷"
)
private
String
CSZL
;
@ApiModelProperty
(
value
=
"进水COD"
)
private
String
JSCOD
;
@ApiModelProperty
(
value
=
"进水COD"
)
private
String
CSCOD
;
@ApiModelProperty
(
value
=
"进水氨氮"
)
private
String
JSAD
;
@ApiModelProperty
(
value
=
"出水氨氮"
)
private
String
CSAD
;
@ApiModelProperty
(
value
=
"进水总氮"
)
private
String
JSZD
;
@ApiModelProperty
(
value
=
"出水总氮"
)
private
String
CSTN
;
@ApiModelProperty
(
value
=
"进水PH"
)
private
String
JSPH
;
@ApiModelProperty
(
value
=
"出水PH"
)
private
String
CSPH
;
@ApiModelProperty
(
value
=
"进水SS"
)
private
String
JSSS
;
@ApiModelProperty
(
value
=
"出水SS"
)
private
String
CSSS
;
public
DataViewVO
(){
}
public
void
initData
(){
this
.
JSL
=
BigDecimal
.
ZERO
;
this
.
CSL
=
BigDecimal
.
ZERO
;
this
.
JSZL
=
"0.0"
;
this
.
JSAD
=
"0.0"
;
this
.
CSSS
=
"0.0"
;
this
.
JSSS
=
"0.0"
;
this
.
CSPH
=
"0.0"
;
this
.
JSPH
=
"0.0"
;
this
.
JSZL
=
"0.0"
;
this
.
CSZL
=
"0.0"
;
this
.
JSCOD
=
"0.0"
;
this
.
CSCOD
=
"0.0"
;
this
.
JSAD
=
"0.0"
;
this
.
CSAD
=
"0.0"
;
this
.
JSZD
=
"0.0"
;
this
.
CSTN
=
"0.0"
;
}
//计算一组数据的标准差
public
void
calculateStandardDeviation
(){
}
}
sk-base-common/src/main/java/com/skua/common/report/vo/DrugChartsVO.java
0 → 100644
查看文件 @
e848009
package
com
.
skua
.
common
.
report
.
vo
;
import
com.skua.core.util.ConvertUtils
;
import
com.skua.tool.util.JSUtils
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @auther kangwei
* @create 2024-11-26-15:21
*/
@Data
@ApiModel
(
value
=
"折线图对象"
,
description
=
"折线图对象"
)
public
class
DrugChartsVO
{
@ApiModelProperty
(
value
=
"时间参数"
)
private
List
<
String
>
timeList
;
@ApiModelProperty
(
value
=
"value:数值数组"
)
private
List
<
String
>
valueList
;
@ApiModelProperty
(
value
=
"同比:数值数组"
)
private
List
<
String
>
valueTBList
;
@ApiModelProperty
(
value
=
"总电耗数值数组"
)
private
List
<
String
>
dhDataList
;
@ApiModelProperty
(
value
=
"吨水电耗数值数组"
)
private
List
<
String
>
dsdhDataList
;
@ApiModelProperty
(
value
=
"(负荷率)数值数组"
)
private
List
<
String
>
fhlDataList
;
@ApiModelProperty
(
value
=
"(COD)数值数组"
)
private
List
<
String
>
codDataList
;
@ApiModelProperty
(
value
=
"(氨氮)数值数组"
)
private
List
<
String
>
adDataList
;
@ApiModelProperty
(
value
=
"(总磷)数值数组"
)
private
List
<
String
>
zlDataList
;
public
DrugChartsVO
(){
}
public
void
setDsdhData
(
String
time
,
String
dsdh
){
this
.
getTimeList
().
add
(
time
);
this
.
getDsdhDataList
().
add
(
ConvertUtils
.
getString
(
dsdh
,
"0.0"
));
}
public
void
setDsdhData
(
String
time
,
String
dsdh
,
String
fhl
){
this
.
getTimeList
().
add
(
time
);
this
.
getDsdhDataList
().
add
(
ConvertUtils
.
getString
(
dsdh
,
"0.0"
));
this
.
getFhlDataList
().
add
(
ConvertUtils
.
getString
(
fhl
,
"0.0"
)
);
}
public
void
setFhlData
(
String
time
,
String
fhl
){
this
.
getTimeList
().
add
(
time
);
this
.
getFhlDataList
().
add
(
ConvertUtils
.
getString
(
fhl
,
"0.0"
)
);
}
//设置污染物
public
void
setCodAdZlData
(
String
time
,
String
cod
,
String
ad
,
String
zl
){
this
.
getTimeList
().
add
(
time
);
this
.
getCodDataList
().
add
(
ConvertUtils
.
getString
(
cod
,
"0.0"
)
);
this
.
getAdDataList
().
add
(
ConvertUtils
.
getString
(
ad
,
"0.0"
));
this
.
getZlDataList
().
add
(
ConvertUtils
.
getString
(
zl
,
"0.0"
)
);
}
//设置污染物去除率
public
void
setCodAdZlRateData
(
DataViewVO
dataViewVO2119
){
this
.
getTimeList
().
add
(
dataViewVO2119
.
getTime
());
String
expressionCod
=
"("
+
dataViewVO2119
.
getJSCOD
()
+
"-"
+
dataViewVO2119
.
getCSAD
()
+
") *100/ "
+
dataViewVO2119
.
getJSCOD
();
this
.
getCodDataList
().
add
(
JSUtils
.
executeExpression
(
expressionCod
,
"0.0"
));
String
expressionAD
=
"("
+
dataViewVO2119
.
getJSAD
()
+
"-"
+
dataViewVO2119
.
getCSAD
()
+
") *100/ "
+
dataViewVO2119
.
getJSAD
();
this
.
getAdDataList
().
add
(
JSUtils
.
executeExpression
(
expressionAD
,
"0.0"
));
String
expressionZL
=
"("
+
dataViewVO2119
.
getJSZL
()
+
"-"
+
dataViewVO2119
.
getCSZL
()
+
") *100/ "
+
dataViewVO2119
.
getJSZL
();
this
.
getZlDataList
().
add
(
JSUtils
.
executeExpression
(
expressionZL
,
"0.0"
));
}
//设置进水浓度
public
void
setJSCodAdZlData
(
DataViewVO
dataViewVO2119
){
this
.
getTimeList
().
add
(
dataViewVO2119
.
getTime
());
this
.
getCodDataList
().
add
(
dataViewVO2119
.
getJSCOD
()
);
this
.
getAdDataList
().
add
(
dataViewVO2119
.
getJSAD
());
this
.
getZlDataList
().
add
(
dataViewVO2119
.
getJSZL
());
}
//设置出水浓度
public
void
setCSCodAdZlData
(
DataViewVO
dataViewVO2119
){
this
.
getTimeList
().
add
(
dataViewVO2119
.
getTime
());
this
.
getCodDataList
().
add
(
dataViewVO2119
.
getCSCOD
()
);
this
.
getAdDataList
().
add
(
dataViewVO2119
.
getCSCOD
());
this
.
getZlDataList
().
add
(
dataViewVO2119
.
getCSZL
());
}
public
List
<
String
>
getValueList
()
{
if
(
valueList
==
null
)
valueList
=
new
ArrayList
<>();
return
valueList
;
}
public
List
<
String
>
getValueTBList
()
{
if
(
valueTBList
==
null
)
valueTBList
=
new
ArrayList
<>();
return
valueTBList
;
}
public
List
<
String
>
getTimeList
()
{
if
(
timeList
==
null
)
timeList
=
new
ArrayList
<>();
return
timeList
;
}
public
List
<
String
>
getDsdhDataList
()
{
if
(
dsdhDataList
==
null
)
dsdhDataList
=
new
ArrayList
<>();
return
dsdhDataList
;
}
public
List
<
String
>
getFhlDataList
()
{
if
(
fhlDataList
==
null
)
fhlDataList
=
new
ArrayList
<>();
return
fhlDataList
;
}
public
List
<
String
>
getCodDataList
()
{
if
(
codDataList
==
null
)
codDataList
=
new
ArrayList
<>();
return
codDataList
;
}
public
List
<
String
>
getAdDataList
()
{
if
(
adDataList
==
null
)
adDataList
=
new
ArrayList
<>();
return
adDataList
;
}
public
List
<
String
>
getZlDataList
()
{
if
(
zlDataList
==
null
)
zlDataList
=
new
ArrayList
<>();
return
zlDataList
;
}
}
sk-base-common/src/main/java/com/skua/tool/util/JSUtils.java
查看文件 @
e848009
...
...
@@ -7,10 +7,9 @@ import javax.script.ScriptEngineManager;
import
javax.script.ScriptException
;
import
java.math.BigDecimal
;
import
java.text.DecimalFormat
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Scanner
;
import
java.util.Stack
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
...
...
@@ -377,6 +376,28 @@ public class JSUtils {
return
str
;
}
/***
* 计算时间的前几个月的月份
* @param month
* @param time
* @return
*/
public
static
String
getMonthBytime
(
int
month
,
String
time
)
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM"
);
Calendar
calendar
=
Calendar
.
getInstance
();
try
{
calendar
.
setTime
(
format
.
parse
(
time
));
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
calendar
.
add
(
Calendar
.
MONTH
,
month
);
return
format
.
format
(
calendar
.
getTime
());
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
getMonthBytime
(-
12
,
"2024-12"
));
}
/* ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript");
Object eval = null;
try {
...
...
sk-module-equipment/src/main/java/com/skua/modules/equipment/dto/TonOfWaterAndLoadRateDto.java
查看文件 @
e848009
...
...
@@ -10,4 +10,13 @@ public class TonOfWaterAndLoadRateDto {
private
String
dsdh
;
private
String
fhl
;
public
TonOfWaterAndLoadRateDto
(){
}
public
TonOfWaterAndLoadRateDto
(
String
time
,
String
dsdh
,
String
fhl
)
{
this
.
time
=
time
;
this
.
dsdh
=
dsdh
;
this
.
fhl
=
fhl
;
}
}
...
...
sk-module-equipment/src/main/java/com/skua/modules/equipment/dto/TonOfWaterTrendDto.java
查看文件 @
e848009
...
...
@@ -7,4 +7,12 @@ public class TonOfWaterTrendDto {
private
String
time
;
private
String
v
;
public
TonOfWaterTrendDto
(){
}
public
TonOfWaterTrendDto
(
String
time
,
String
v
)
{
this
.
time
=
time
;
this
.
v
=
v
;
}
}
...
...
sk-module-equipment/src/main/java/com/skua/modules/equipment/mapper/ComprehensiveSupervisionMapper.java
查看文件 @
e848009
...
...
@@ -73,28 +73,6 @@ public interface ComprehensiveSupervisionMapper {
String
selectMetricNameById
(
String
id
);
/**
* 月度电耗水耗统计
*
* @return
*/
ConsumptionDto
selectMonthlyPowerConsumption
(
@Param
(
"dataStr"
)
String
dataStr
,
@Param
(
"departIds"
)
List
<
String
>
departIds
);
/**
* 月度药耗统计
*
* @return
*/
DrugConsumptionDto
selectMonthlyDrugConsumptionStatistics
(
@Param
(
"dataStr"
)
String
dataStr
,
@Param
(
"departIds"
)
List
<
String
>
departIds
);
/**
* 天出水量统计
*
* @return
*/
Integer
selectShByDay
(
@Param
(
"date"
)
String
date
,
@Param
(
"departIds"
)
List
<
String
>
departIds
);
/**
...
...
sk-module-equipment/src/main/java/com/skua/modules/equipment/mapper/xml/ComprehensiveSupervisionMapper.xml
查看文件 @
e848009
...
...
@@ -230,144 +230,8 @@
select metric_name from sys_monitor_metric_info
where id=#{id}
</select>
<select
id=
"selectMonthlyPowerConsumption"
resultType=
"com.skua.modules.equipment.dto.ConsumptionDto"
>
SELECT
dateStr AS TIME,
sum( dh ) AS dh,
FORMAT(
sum( dh )/ sum( csl ),2) AS dsdh
FROM
(
SELECT
v.item_value AS dh,
DATE_FORMAT( v.data_time, '%Y-%m' ) AS dateStr,
0 AS csl
FROM
f_report_item i
LEFT JOIN f_report_itemv v ON i.id = v.reit_id
WHERE
i.report_id = '07079703413c58fd96d79298f23af854'
AND i.item_code = 'dhkwh64bc'
and v.depart_id in
<foreach
collection=
"departIds"
item=
"departId"
open=
"("
separator=
","
close=
")"
>
#{departId}
</foreach>
AND DATE_FORMAT( v.data_time, '%Y-%m' ) = #{dataStr} UNION ALL
SELECT
0 AS dh,
DATE_FORMAT( v.data_time, '%Y-%m' ) AS dateStr,
v.item_value AS csl
FROM
f_report_item i
LEFT JOIN f_report_itemv v ON i.id = v.reit_id
WHERE
i.report_id = '2044b09220b8413eeda84ce4c861305b'
AND i.item_code = 'csl50c'
and v.depart_id in
<foreach
collection=
"departIds"
item=
"departId"
open=
"("
separator=
","
close=
")"
>
#{departId}
</foreach>
AND DATE_FORMAT( v.data_time, '%Y-%m' ) = #{dataStr}
) AS d
GROUP BY
dateStr
</select>
<select
id=
"selectMonthlyDrugConsumptionStatistics"
resultType=
"com.skua.modules.equipment.dto.DrugConsumptionDto"
>
SELECT dateStr AS TIME,
sum(yh) AS yh,
FORMAT(
sum(yh) / sum(csl),2) AS dsyh
FROM (SELECT DATE_FORMAT(v.data_time, '%Y-%m') as dateStr,
v.item_value AS yh,
0 AS csl
FROM f_report_item i
LEFT JOIN f_report_itemv v ON i.id = v.reit_id
WHERE i.report_id = '07079703413c58fd96d79298f23af854'
AND i.item_code IN (
'lsytgtxhldc44',
'lsytytxhlda760',
'sysytxhld95e',
'pamylzgtxhldb77',
'pamylzgtxhldb0f',
'fmhxtgtxhldc0',
'klhxtgtxhldfc1d',
'jhlytxhld4f41',
'jhlgtxhld17d',
'lygtxhldf2d5',
'fhtyytxhld55ce',
'fhtygtxhld046f',
'pttgtxhlda01c',
'pttytxhldea55',
'clsnnacloytxhld09ea',
'qljgtxhldf9e1',
'yyytxhld84d',
'gyygtxhlde2ca',
'nmsytxhld245a',
'zgjytxhld49a5',
'qyhnnaohgtxhld2fde',
'qyhnnaohytxhld8bae',
'tsnna2cogtxhld6e21',
'jhlstytxhld29d8',
'nlsytxhld6dff',
'xpjgtxhldc22',
'cfjytxhlda2a1',
'hyjnahsogtxhlde7e',
'fyhsjjytxhld959',
'chjcyyxhldbcd6',
'jzytxhldea44',
'mzyqxjytxhld52f',
'lsqengtxhlde976',
'edta4nagtxhld06e2',
'qthxyj1xhldf66f',
'qthxyj2xhld2f0a',
'qthxyjxhldb97b',
'qthxyj4xhld2645',
'qthxyj5xhldaf94',
'qthxyj6xhld2152'
)
AND v.depart_id in
<foreach
collection=
"departIds"
item=
"departId"
open=
"("
separator=
","
close=
")"
>
#{departId}
</foreach>
AND DATE_FORMAT(v.data_time, '%Y-%m') = #{dataStr}
UNION ALL
SELECT DATE_FORMAT(v.data_time, '%Y-%m') as dateStr,
0 AS yh,
v.item_value AS csl
FROM f_report_item i
LEFT JOIN f_report_itemv v ON i.id = v.reit_id
WHERE i.report_id = '2044b09220b8413eeda84ce4c861305b'
AND i.item_code = 'csl50c'
AND v.depart_id in
<foreach
collection=
"departIds"
item=
"departId"
open=
"("
separator=
","
close=
")"
>
#{departId}
</foreach>
AND DATE_FORMAT(v.data_time, '%Y-%m') = #{dataStr}) d
GROUP BY dateStr
</select>
<select
id=
"selectShByDay"
resultType=
"java.lang.Integer"
>
SELECT sum(b.item_value)
FROM (SELECT v.item_value,
DATE_FORMAT(v.data_time, '%Y-%m-%d') AS dateStr
FROM f_report_item i
LEFT JOIN f_report_itemv v ON i.id = v.reit_id
WHERE-- 今日出水
i.report_id = '2044b09220b8413eeda84ce4c861305b'
AND i.item_code = 'csl50c'
AND v.depart_id in
<foreach
collection=
"departIds"
item=
"departId"
open=
"("
separator=
","
close=
")"
>
#{departId}
</foreach>
AND DATE_FORMAT(v.data_time, '%Y-%m-%d') = #{date}) AS b
GROUP BY dateStr
</select>
<select
id=
"selectCountAlarmByYearForDay"
resultType=
"com.skua.modules.equipment.dto.AlarmCountDto"
>
select count(1),
DATE_FORMAT(create_time, '%Y-%m-%d') as dateStr
...
...
@@ -416,9 +280,9 @@
</select>
<select
id=
"selectClslByMonths"
resultType=
"java.util.HashMap"
>
select
sum(item_value
) as v,DATE_FORMAT(data_time, '%Y-%m') as time from f_report_itemv a
select
round(sum(item_value),2
) as v,DATE_FORMAT(data_time, '%Y-%m') as time from f_report_itemv a
left join f_report_item b on b.id=a.reit_id
where b.item_code='
csl503c
'
where b.item_code='
CSL
'
and a.depart_id = #{factoryId}
<if
test=
"list!=null and list.size>0"
>
and DATE_FORMAT(data_time, '%Y-%m') in
...
...
sk-module-equipment/src/main/java/com/skua/modules/equipment/service/impl/PowerConsumptionAnalusisServiceImpl.java
查看文件 @
e848009
此文件的差异被折叠,
点击展开。
sk-module-equipment/src/main/java/com/skua/modules/equipment/service/impl/PowerConsumptionAnalusisServiceImplBak.java
0 → 100644
查看文件 @
e848009
此文件的差异被折叠,
点击展开。
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论