Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skboot-zhongye
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
a1f8032c
由
康伟
编写于
2024-11-05 09:40:52 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
kangwei :采购计划,去年数量类型改为string
到货记录,添加供应商名称
1 个父辈
1aa71f8e
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
418 行增加
和
168 行删除
sk-module-biz/src/main/java/com/skua/modules/algorithm/controller/SysCommandCentreController.java
sk-module-biz/src/main/java/com/skua/modules/algorithm/service/impl/ReportItemvService.java
sk-module-biz/src/main/java/com/skua/modules/algorithm/vo/ReportItemVO.java
sk-module-datafill/src/main/java/com/skua/modules/report/mapper/xml/FReportItemvMapper.xml
sk-module-equipment/src/main/java/com/skua/modules/equipment/service/impl/DrugConsumptionAnalusisServiceImpl.java
sk-module-system/src/main/java/com/skua/modules/system/service/ISysFactoryInfoService.java
sk-module-biz/src/main/java/com/skua/modules/algorithm/controller/SysCommandCentreController.java
查看文件 @
a1f8032
package
com
.
skua
.
modules
.
algorithm
.
controller
;
import
com.skua.common.report.ReportViewUtil
;
import
com.skua.core.api.vo.Result
;
import
com.skua.core.aspect.annotation.AutoLog
;
import
com.skua.core.context.BaseContextHandler
;
import
com.skua.core.context.SpringContextUtils
;
import
com.skua.modules.algorithm.service.ICommandCentreService
;
import
com.skua.modules.algorithm.service.impl.ReportItemvService
;
import
com.skua.modules.algorithm.vo.*
;
...
...
@@ -21,9 +20,9 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.time.LocalDate
;
import
java.time.YearMonth
;
...
...
@@ -89,161 +88,77 @@ public class SysCommandCentreController {
@AutoLog
(
value
=
"指挥中心-运行负荷率分析"
)
@ApiOperation
(
value
=
"指挥中心-运行负荷率分析"
,
notes
=
"指挥中心-运行负荷率分析"
)
//指挥中心-运行负荷率分析
@GetMapping
(
value
=
"/statisticsByLoadRate"
)
public
Result
<
DepartLoadRateResultVO
>
statisticsByLoadRate
(
ReportItemvParam
reportItemvParam
)
throws
Exception
{
DepartLoadRateResultVO
loadRateResultVO
=
new
DepartLoadRateResultVO
();
//SysAlgorithmStatisticsLibraryVO sysAlgorithmLibraryVO = JSONObject.toJavaObject(jsonObject, SysAlgorithmStatisticsLibraryVO.class);
// 运行负荷率分析 = CSL/规模
String
departId
=
BaseContextHandler
.
getDeparts
();
String
startTime
=
reportItemvParam
.
getStartDate
();
String
endTime
=
reportItemvParam
.
getEndDate
();
String
dataViewName2119
=
ReportViewUtil
.
buildView
(
ReportViewUtil
.
view2119
,
"CSL"
,
departId
,
startTime
,
endTime
);
// 部门、时间
//报表数据项值
String
reitId
=
sysConfigService
.
queryValueByKey
(
"REIT_ID_CSL"
);
public
Result
<
DepartLoadRateResultVO
>
statisticsByLoadRate
(
String
startTime
,
String
endTime
,
Integer
loadRateType
)
throws
Exception
{
Result
<
DepartLoadRateResultVO
>
result
=
new
Result
<>();
String
departIds
=
BaseContextHandler
.
getDeparts
();
//1818214519948836864,1711662624459804674
if
(
loadRateType
==
null
)
loadRateType
=
1
;
DepartLoadRateResultVO
departLoadRateResultVO
=
reportItemvService
.
statisticsByLoadRate
(
departIds
,
startTime
,
endTime
,
loadRateType
);
result
.
setSuccess
(
true
);
result
.
setResult
(
departLoadRateResultVO
);
return
result
;
}
reportItemvParam
.
setReitId
(
reitId
);
if
(
reportItemvParam
.
getLoadRateType
()
==
null
){
reportItemvParam
.
setLoadRateType
(
1
);
////默认查询
}
List
<
DepartLoadRateVO
>
departLoadRateVOList
=
commandCentreService
.
statisticsByLoadRate
(
reportItemvParam
);
if
(
departLoadRateVOList
!=
null
&&
!
departLoadRateVOList
.
isEmpty
()){
for
(
DepartLoadRateVO
departLoadRateVO
:
departLoadRateVOList
){
departLoadRateVO
.
accuracy
();
//计算精度
}
}
loadRateResultVO
.
setDepartLoadRateVOList
(
departLoadRateVOList
);
//统计总数
int
normalNum
=
commandCentreService
.
statisticsByLoadRateNum
(
1
,
reitId
,
reportItemvParam
.
getStartDate
(),
reportItemvParam
.
getEndDate
());
//正常
int
lowLoadNum
=
commandCentreService
.
statisticsByLoadRateNum
(
3
,
reitId
,
reportItemvParam
.
getStartDate
(),
reportItemvParam
.
getEndDate
());
//低负荷
int
overloadNum
=
commandCentreService
.
statisticsByLoadRateNum
(
2
,
reitId
,
reportItemvParam
.
getStartDate
(),
reportItemvParam
.
getEndDate
());
//超负荷
loadRateResultVO
.
setNormalNum
(
normalNum
);
loadRateResultVO
.
setLowLoadNum
(
lowLoadNum
);
loadRateResultVO
.
setOverloadNum
(
overloadNum
);
Result
<
DepartLoadRateResultVO
>
result
=
new
Result
<>();
@AutoLog
(
value
=
"指挥中心-运行负荷率分析"
)
@ApiOperation
(
value
=
"指挥中心-运行负荷率分析---列表详情"
,
notes
=
"指挥中心-运行负荷率分析----列表详情"
)
//指挥中心-运行负荷率分析
@GetMapping
(
value
=
"/statisticsByLoadRateList"
)
public
Result
<
List
<
DepartLoadRateVO
>
>
statisticsByLoadRateList
(
String
startTime
,
String
endTime
)
throws
Exception
{
Result
<
List
<
DepartLoadRateVO
>
>
result
=
new
Result
<>();
String
departIds
=
BaseContextHandler
.
getDeparts
();
//1818214519948836864,1711662624459804674
List
<
DepartLoadRateVO
>
departLoadRateResultVO
=
reportItemvService
.
statisticsByLoadRateList
(
departIds
,
startTime
,
endTime
,
null
);
result
.
setSuccess
(
true
);
result
.
setResult
(
l
oadRateResultVO
);
return
result
;
result
.
setResult
(
departL
oadRateResultVO
);
return
result
;
}
//cement水泥 electricity
@AutoLog
(
value
=
"指挥中心-泥量统计"
)
@ApiOperation
(
value
=
"指挥中心-泥量统计"
,
notes
=
"指挥中心-泥量统计"
)
@GetMapping
(
value
=
"/statisticsByCement"
)
public
Result
<
List
<
FRportlCommandCenterVO
>>
statisticsByCement
(
ReportItemvParam
reportItemvParam
)
throws
Exception
{
Result
<
List
<
FRportlCommandCenterVO
>>
result
=
new
Result
<>();
//将jsonObject转sysAlgorithmStatisticsLibraryVO对象
//SysAlgorithmStatisticsLibraryVO sysAlgorithmLibraryVO = JSONObject.toJavaObject(jsonObject, SysAlgorithmStatisticsLibraryVO.class);
//String reportId = "3a243d5715b9e1a3753c180872ca0df9";//报表编号
//String reportItemCode = "WNL";//查询字段
//报表数据项值
String
reitId
=
sysConfigService
.
queryValueByKey
(
"REIT_ID_WNL"
);
// reportItemvParam.setReportItemCode(reportItemCode);
//reportItemvParam.setReportId(reportId);
//初始化查询参数
reportItemvParam
.
initData
(
reitId
,
reportItemvParam
.
getStartDate
()
,
reportItemvParam
.
getEndDate
());
//ReportItemvParam reportItemvParam = new ReportItemvParam(reportId,reportItemCode ,sysAlgorithmLibraryVO.getStartDate() ,sysAlgorithmLibraryVO.getEndDate());
List
<
FRportlCommandCenterVO
>
fReportItemvList
=
new
ArrayList
<>();
//返回集合对象
//月统计
FRportlCommandCenterVO
reportMonthData
=
commandCentreService
.
getReportItemvMonthDataByReitId
(
reportItemvParam
);
fReportItemvList
.
add
(
reportMonthData
);
// 日均统计
FRportlCommandCenterVO
reportDayData
=
commandCentreService
.
getReportItemvDayDataByReitId
(
reportItemvParam
);
fReportItemvList
.
add
(
reportDayData
);
//单位换算
if
(
fReportItemvList
!=
null
&&
!
fReportItemvList
.
isEmpty
()){
String
value
=
null
;
String
valueHb
=
null
;
String
valueTb
=
null
;
for
(
FRportlCommandCenterVO
reportDayData3
:
fReportItemvList
){
value
=
DigitalUtils
.
division
(
reportDayData3
.
getValue
(),
"1"
);
reportDayData3
.
setValue
(
value
);
valueHb
=
DigitalUtils
.
division
(
reportDayData3
.
getValueHb
(),
"1"
);
reportDayData3
.
setValueHb
(
valueHb
);
valueTb
=
DigitalUtils
.
division
(
reportDayData3
.
getValueTb
(),
"1"
);
reportDayData3
.
setValueTb
(
valueTb
);
}
}
/* FReportItemv currenteportItemv = commandCentreService.getReportItemvByReitIdAndDate(reportId, reportItemCode,startDate , endDate );
//上月数据
FReportItemv lastMonthReportItemv = commandCentreService.getReportItemvByReitIdAndDate(reportId, reportItemCode,reportItemvParam.getLastMonthStartDate() , reportItemvParam.getLastMonthEndDate() );
//去年数据
FReportItemv lastYearReportItemv = commandCentreService.getReportItemvByReitIdAndDate(reportId, reportItemCode, reportItemvParam.getLastYearStartDate() , reportItemvParam.getLastYearEndDate() );
//整理数据
// SysCommandCentreResultVO commandCentreResultVO = convertSysAlgorithmStatisticsResultNumberVO(currenteportItemv , lastMonthReportItemv,lastYearReportItemv);
List<FRportlCommandCenterVO> fReportItemvList = arrangeFRportlCommandCenterVO(currenteportItemv , lastMonthReportItemv,lastYearReportItemv);*/
//
// FReportItemv waterCurrenteportItemv = ifReportItemvService.getReportItemvByReitIdAndDate(reportId, reportItemCode,startDate , endDate );
//commandCentreResultVO.setTotalData( factoryInfoService.querySumProScale() );
//出水量 月统计、上月统计、去年同期统计
//String waterReportId = "2119ecbf53a1d2d0708258ff67cfd9e1";//报表编号
//String waterReportItemCode = "CSL";//查询字段
reitId
=
sysConfigService
.
queryValueByKey
(
"REIT_ID_CSL"
);
reportItemvParam
.
setReitId
(
reitId
);
// 出水量 月统计
FRportlCommandCenterVO
waterReportMonthData
=
commandCentreService
.
getReportItemvMonthDataByReitId
(
reportItemvParam
);
FRportlCommandCenterVO
statisticsData
=
new
FRportlCommandCenterVO
(
"0.0"
,
"0.0"
,
"0.0"
);
//需要查询统计数据 = 公式== 污泥量 / 出水量
if
(
reportMonthData
!=
null
&&
waterReportMonthData
!=
null
){
waterReportMonthData
.
setValue
(
DigitalUtils
.
division
(
reportMonthData
.
getValue
()
,
waterReportMonthData
.
getValue
()
));
// 当月统计 污泥量 / 出水量
waterReportMonthData
.
setValueTb
(
DigitalUtils
.
division
(
reportMonthData
.
getValueTb
()
,
waterReportMonthData
.
getValueTb
()
));
// 上月同期 统计
waterReportMonthData
.
setValueHb
(
DigitalUtils
.
division
(
reportMonthData
.
getValueHb
()
,
waterReportMonthData
.
getValueHb
()
)
);
//去年同期 统计
}
fReportItemvList
.
add
(
statisticsData
);
//todo 演示暂时注释
result
.
setSuccess
(
true
);
result
.
setResult
(
fReportItemvList
);
public
Result
<
List
<
FRportlCommandCenterVO
>>
statisticsByCement
(
String
startTime
,
String
endTime
)
throws
Exception
{
Result
<
List
<
FRportlCommandCenterVO
>>
result
=
new
Result
();
String
departIds
=
BaseContextHandler
.
getDeparts
();
//1818214519948836864,1711662624459804674
List
<
FRportlCommandCenterVO
>
dataList
=
reportItemvService
.
statisticsByCement
(
departIds
,
startTime
,
endTime
);
result
.
setResult
(
dataList
);
return
result
;
}
@AutoLog
(
value
=
"指挥中心-泥量统计"
)
@ApiOperation
(
value
=
"指挥中心-泥量统计--详情列表"
,
notes
=
"指挥中心-泥量统计--详情列表"
)
//指挥中心-泥量统计--详情列表
@GetMapping
(
value
=
"/statisticsByCementList"
)
public
Result
<
List
<
ReportItemVO
>>
statisticsByCementList
(
String
startTime
,
String
endTime
)
throws
Exception
{
Result
<
List
<
ReportItemVO
>>
result
=
new
Result
();
String
departIds
=
BaseContextHandler
.
getDeparts
();
//1818214519948836864,1711662624459804674
List
<
ReportItemVO
>
dataList
=
reportItemvService
.
statisticsByCementList
(
departIds
,
startTime
,
endTime
);
result
.
setResult
(
dataList
);
return
result
;
}
//cement水泥 electricity
@AutoLog
(
value
=
"指挥中心-能耗分析"
)
@ApiOperation
(
value
=
"指挥中心-能耗分析"
,
notes
=
"指挥中心-能耗分析"
)
@GetMapping
(
value
=
"/statisticsByElectricity"
)
public
Result
<
List
<
FRportlCommandCenterVO
>>
statisticsByElectricity
(
ReportItemvParam
reportItemvParam
)
throws
Exception
{
Result
<
List
<
FRportlCommandCenterVO
>>
result
=
new
Result
<>();
List
<
FRportlCommandCenterVO
>
fRportlCommandCenterVOList
=
new
ArrayList
<>();
DateVO
dateVO
=
new
DateVO
(
reportItemvParam
.
getStartDate
());
//电耗
String
nowMonthValue
=
reportItemvService
.
getSumDLHJ
(
null
,
dateVO
.
getNowMonthStartDate
(),
dateVO
.
getNowMonthEndDate
());
String
lastMonthValue
=
reportItemvService
.
getSumDLHJ
(
null
,
dateVO
.
getLastMonthStartTime
(),
dateVO
.
getLastMonthEndTime
());
String
lastYearValue
=
reportItemvService
.
getSumDLHJ
(
null
,
dateVO
.
getLastYearMonthStartTime
(),
dateVO
.
getLastYearMonthEndTime
());
//出水量
String
nowMonthCSL
=
reportItemvService
.
getSumCSL
(
null
,
dateVO
.
getNowMonthStartDate
(),
dateVO
.
getNowMonthEndDate
());
String
lastMonthCSL
=
reportItemvService
.
getSumCSL
(
null
,
dateVO
.
getLastMonthStartTime
(),
dateVO
.
getLastMonthEndTime
());
String
lastYearCSL
=
reportItemvService
.
getSumCSL
(
null
,
dateVO
.
getLastYearMonthStartTime
(),
dateVO
.
getLastYearMonthEndTime
());
long
nowDifferDay
=
DateUtils
.
differenceDay
(
dateVO
.
getNowMonthStartDate
(),
dateVO
.
getNowMonthEndDate
());
long
lastMonthDifferDay
=
DateUtils
.
differenceDay
(
dateVO
.
getLastMonthStartTime
(),
dateVO
.
getLastMonthEndTime
());
long
lastYearDifferDay
=
DateUtils
.
differenceDay
(
dateVO
.
getLastYearMonthStartTime
(),
dateVO
.
getLastYearMonthEndTime
());
//当月数据/环比、同比
FRportlCommandCenterVO
nowMonthVO
=
new
FRportlCommandCenterVO
(
"月总电耗("
,
JSUtils
.
format
(
nowMonthValue
),
JSUtils
.
format
(
lastMonthValue
),
JSUtils
.
format
(
lastYearValue
));
//日均数据:/环比/同比
FRportlCommandCenterVO
lastMonthVO
=
new
FRportlCommandCenterVO
(
"日均电耗"
,
JSUtils
.
divide
(
nowMonthValue
,
nowDifferDay
)
,
JSUtils
.
divide
(
lastMonthValue
,
lastMonthDifferDay
),
JSUtils
.
divide
(
lastYearValue
,
lastYearDifferDay
)
);
//吨水消耗
FRportlCommandCenterVO
lastYearVo
=
new
FRportlCommandCenterVO
(
"吨水电耗"
,
JSUtils
.
divide
(
nowMonthValue
,
nowMonthCSL
)
,
JSUtils
.
divide
(
lastMonthValue
,
lastMonthCSL
),
JSUtils
.
divide
(
lastYearValue
,
lastYearCSL
));
fRportlCommandCenterVOList
.
add
(
nowMonthVO
)
;
fRportlCommandCenterVOList
.
add
(
lastMonthVO
)
;
fRportlCommandCenterVOList
.
add
(
lastYearVo
)
;
//todo 演示暂时注释
result
.
setSuccess
(
true
);
result
.
setResult
(
fRportlCommandCenterVOList
);
public
Result
<
List
<
FRportlCommandCenterVO
>>
statisticsByElectricity
(
String
startTime
,
String
endTime
)
throws
Exception
{
Result
<
List
<
FRportlCommandCenterVO
>>
result
=
new
Result
();
String
departId
=
"1818214519948836864,1711662624459804674"
;
List
<
FRportlCommandCenterVO
>
dataList
=
reportItemvService
.
statisticsByElectricity
(
departId
,
startTime
,
endTime
);
result
.
setResult
(
dataList
);
return
result
;
}
@AutoLog
(
value
=
"指挥中心-能耗分析"
)
@ApiOperation
(
value
=
"指挥中心-能耗分析--详情列表"
,
notes
=
"指挥中心-能耗分析--详情列表"
)
@GetMapping
(
value
=
"/statisticsByElectricityList"
)
public
Result
<
List
<
ReportItemVO
>>
statisticsByElectricityList
(
String
startTime
,
String
endTime
)
throws
Exception
{
Result
<
List
<
ReportItemVO
>>
result
=
new
Result
();
String
departIds
=
BaseContextHandler
.
getDeparts
();
//1818214519948836864,1711662624459804674
List
<
ReportItemVO
>
dataList
=
reportItemvService
.
statisticsByElectricityList
(
departIds
,
startTime
,
endTime
);
result
.
setResult
(
dataList
);
return
result
;
}
//cement水泥 electricity
@AutoLog
(
value
=
"指挥中心-水量电耗趋势"
)
@ApiOperation
(
value
=
"指挥中心-水量电耗趋势"
,
notes
=
"指挥中心-水量电耗趋势"
)
...
...
@@ -256,30 +171,22 @@ public class SysCommandCentreController {
//报表数据项值
String
reitId
=
sysConfigService
.
queryValueByKey
(
"REIT_ID_DLHJ"
);
//reportItemvParam.setReportItemCode(reportItemCode);
//reportItemvParam.setReportId(reportId);
reportItemvParam
.
setReitId
(
reitId
);
//电
List
<
ReportDateTrendVO
>
electricityMapList
=
commandCentreService
.
getReportItemvByReitIdAndDate7Day
(
reportItemvParam
);
//reportId = "2119ecbf53a1d2d0708258ff67cfd9e1";//报表编号
//reportItemCode = "CSL";//查询字段
reitId
=
sysConfigService
.
queryValueByKey
(
"REIT_ID_CSL"
);
//水集合
reportItemvParam
.
setReitId
(
reitId
);
List
<
ReportDateTrendVO
>
waterMapList
=
commandCentreService
.
getReportItemvByReitIdAndDate7Day
(
reportItemvParam
);
List
<
String
>
dateList
=
new
ArrayList
<>();
//日期数据
List
<
String
>
electricityList
=
new
ArrayList
<>();
//电能数据数据;
List
<
String
>
waterList
=
new
ArrayList
<>();
// 水集合
List
<
String
>
consumeList
=
new
ArrayList
<>();
//电小号集合
List
<
String
>
dateTimeList
=
DateUtil
.
getInstance
().
getBetweenDate
(
reportItemvParam
.
getStartDate
(),
reportItemvParam
.
getEndDate
(),
null
);
Map
<
String
,
String
>
electricityMap
=
new
HashMap
<
String
,
String
>();
//电能数据数据;
Map
<
String
,
String
>
waterMap
=
new
HashMap
<
String
,
String
>();
//水
if
(
electricityMapList
!=
null
){
...
...
@@ -329,8 +236,6 @@ public class SysCommandCentreController {
return
result
;
}
/***
* 整理数据: 月统计数据、日统计数据,添加去年月数据、日数据、年数据
* @param currenteportItemv
...
...
@@ -383,10 +288,8 @@ public class SysCommandCentreController {
@ApiOperation
(
value
=
"指挥中心-费用趋势"
,
notes
=
"指挥中心-费用趋势"
)
@GetMapping
(
value
=
"/statisticsByFy"
)
public
Result
<
StackedAreaChartDataVO
>
statisticsByFy
(
ReportItemvParam
reportItemvParam
)
{
//费用
List
<
ReportDateTrendVO
>
fyMapList
=
commandCentreService
.
getFyData
(
reportItemvParam
);
String
reitId
=
sysConfigService
.
queryValueByKey
(
"REIT_ID_CSL"
);
//水集合
reportItemvParam
.
setReitId
(
reitId
);
...
...
@@ -397,7 +300,6 @@ public class SysCommandCentreController {
List
<
String
>
waterList
=
new
ArrayList
<>();
// 水集合
List
<
String
>
dateTimeList
=
getMonthsBetween
(
reportItemvParam
.
getStartDate
(),
reportItemvParam
.
getEndDate
());
Map
<
String
,
String
>
electricityMap
=
new
HashMap
<
String
,
String
>();
//电能数据数据;
Map
<
String
,
String
>
waterMap
=
new
HashMap
<
String
,
String
>();
//水
if
(
fyMapList
!=
null
){
...
...
@@ -421,7 +323,6 @@ public class SysCommandCentreController {
fyList
.
add
(
electricity
)
;
waterList
.
add
(
water
)
;
dateList
.
add
(
dateTime
)
;
}
StackedAreaChartDataVO
stackedAreaChartDataVO
=
new
StackedAreaChartDataVO
();
stackedAreaChartDataVO
.
setElectricityList
(
fyList
);
//费用集合
stackedAreaChartDataVO
.
setWaterList
(
waterList
);
//水集合
...
...
@@ -441,12 +342,12 @@ public class SysCommandCentreController {
}
@AutoLog
(
value
=
"指挥中心-药剂趋势"
)
@ApiOperation
(
value
=
"指挥中心-药剂趋势"
,
notes
=
"指挥中心-药剂趋势"
)
@GetMapping
(
value
=
"/statisticsByYjqs"
)
public
Result
<
DepartDrugResult
>
statisticsByYjqs
(
String
month
)
{
DepartDrugResult
departDrugResult
=
commandCentreService
.
getYhTotal
(
month
);
public
Result
<
DepartDrugResult
>
statisticsByYjqs
(
@RequestParam
(
name
=
"month"
,
required
=
true
)
String
month
)
{
DateVO
dateVO
=
new
DateVO
(
month
);
DepartDrugResult
departDrugResult
=
commandCentreService
.
getYhTotal
(
dateVO
.
getNowMonth
());
Result
<
DepartDrugResult
>
result
=
new
Result
<>();
result
.
setSuccess
(
true
);
result
.
setResult
(
departDrugResult
);
...
...
@@ -454,10 +355,10 @@ public class SysCommandCentreController {
}
//指挥中心----运行负荷率分析----处理水量详情
@AutoLog
(
value
=
"指挥中心-
药剂趋势
"
)
@ApiOperation
(
value
=
"指挥中心-
运行负荷率分析-处理水量详情"
,
notes
=
"指挥中心-运行负荷率分析-
处理水量详情"
)
@AutoLog
(
value
=
"指挥中心-
处理水量详情
"
)
@ApiOperation
(
value
=
"指挥中心-处理水量详情"
)
@GetMapping
(
"/getCLSLXQ"
)
public
Result
<
List
<
WaterTreatmentVO
>>
getCLSLXQ
(
String
time
){
public
Result
<
List
<
WaterTreatmentVO
>>
getCLSLXQ
(
@RequestParam
(
name
=
"time"
,
required
=
true
)
String
time
){
Result
<
List
<
WaterTreatmentVO
>>
result
=
new
Result
<>();
//String departIds = "1818215093192753152,1818214519948836864,1818214145808531456";
List
<
WaterTreatmentVO
>
waterTrendVOList
=
commandCentreService
.
statisticsCLSLXQ
(
time
,
BaseContextHandler
.
getDeparts
());
...
...
sk-module-biz/src/main/java/com/skua/modules/algorithm/service/impl/ReportItemvService.java
查看文件 @
a1f8032
...
...
@@ -2,9 +2,26 @@ package com.skua.modules.algorithm.service.impl;
import
com.skua.common.report.ReportViewUtil
;
import
com.skua.core.context.SpringContextUtils
;
import
com.skua.core.util.ConvertUtils
;
import
com.skua.modules.algorithm.vo.DepartLoadRateResultVO
;
import
com.skua.modules.algorithm.vo.ReportItemVO
;
import
com.skua.modules.algorithm.vo.WaterTreatmentVO
;
import
com.skua.modules.common.vo.DateVO
;
import
com.skua.modules.quartz.util.BaseUtil
;
import
com.skua.modules.report.vo.DepartLoadRateVO
;
import
com.skua.modules.report.vo.FRportlCommandCenterVO
;
import
com.skua.tool.util.DateUtils
;
import
com.skua.tool.util.JSUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.jdbc.core.BeanPropertyRowMapper
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @auther kangwei
...
...
@@ -12,25 +29,238 @@ import org.springframework.stereotype.Service;
*/
@Service
(
"reportItemvService"
)
public
class
ReportItemvService
{
String
view2119
=
"2119ecbf53a1d2d0708258ff67cfd9e1"
;
// 水 COD TP TN NH3H
String
view3a24
=
"3a243d5715b9e1a3753c180872ca0df9"
;
//能耗报表
private
JdbcTemplate
getJdbcTemplate
(){
//主库数据源
JdbcTemplate
masterDB
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"master"
);
return
masterDB
;
}
//指挥中心-泥量统计
public
List
<
FRportlCommandCenterVO
>
statisticsByCement
(
String
departIds
,
String
startTime
,
String
endTime
)
{
List
<
FRportlCommandCenterVO
>
fRportlCommandCenterVOList
=
new
ArrayList
<>();
DateVO
dateVO
=
new
DateVO
(
startTime
);
String
dataViewName3a24
=
ReportViewUtil
.
buildViewLike
(
view3a24
,
"WNL"
,
departIds
,
startTime
,
endTime
);
String
sql
=
"select sum(aaa.WNL) from "
+
dataViewName3a24
+
"aaa"
;
String
nowMonthValue
=
getSumValue
(
view3a24
,
"WNL"
,
departIds
,
dateVO
.
getNowMonthStartDate
(),
dateVO
.
getNowMonthEndDate
());
String
lastMonthValue
=
getSumValue
(
view3a24
,
"WNL"
,
departIds
,
dateVO
.
getLastMonthStartTime
(),
dateVO
.
getLastMonthEndTime
());
String
lastYearValue
=
getSumValue
(
view3a24
,
"WNL"
,
departIds
,
dateVO
.
getLastYearMonthStartTime
(),
dateVO
.
getLastYearMonthEndTime
());
String
nowMonthCSL
=
getSumCSL
(
departIds
,
dateVO
.
getNowMonthStartDate
(),
dateVO
.
getNowMonthEndDate
());
String
lastMonthCSL
=
getSumCSL
(
departIds
,
dateVO
.
getLastMonthStartTime
(),
dateVO
.
getLastMonthEndTime
());
String
lastYearCSL
=
getSumCSL
(
departIds
,
dateVO
.
getLastYearMonthStartTime
(),
dateVO
.
getLastYearMonthEndTime
());
long
nowDifferDay
=
DateUtils
.
differenceDay
(
dateVO
.
getNowMonthStartDate
(),
dateVO
.
getNowMonthEndDate
());
long
lastMonthDifferDay
=
DateUtils
.
differenceDay
(
dateVO
.
getLastMonthStartTime
(),
dateVO
.
getLastMonthEndTime
());
long
lastYearDifferDay
=
DateUtils
.
differenceDay
(
dateVO
.
getLastYearMonthStartTime
(),
dateVO
.
getLastYearMonthEndTime
());
//当月数据/环比、同比
FRportlCommandCenterVO
nowMonthVO
=
new
FRportlCommandCenterVO
(
"月总数据("
,
JSUtils
.
format
(
nowMonthValue
),
JSUtils
.
format
(
lastMonthValue
),
JSUtils
.
format
(
lastYearValue
));
//日均数据:/环比/同比
FRportlCommandCenterVO
lastMonthVO
=
new
FRportlCommandCenterVO
(
"日均数据"
,
JSUtils
.
divide
(
nowMonthValue
,
nowDifferDay
)
,
JSUtils
.
divide
(
lastMonthValue
,
lastMonthDifferDay
),
JSUtils
.
divide
(
lastYearValue
,
lastYearDifferDay
)
);
//吨水消耗
FRportlCommandCenterVO
lastYearVo
=
new
FRportlCommandCenterVO
(
"吨水数据"
,
JSUtils
.
divide
(
nowMonthValue
,
nowMonthCSL
)
,
JSUtils
.
divide
(
lastMonthValue
,
lastMonthCSL
),
JSUtils
.
divide
(
lastYearValue
,
lastYearCSL
));
fRportlCommandCenterVOList
.
add
(
nowMonthVO
)
;
fRportlCommandCenterVOList
.
add
(
lastMonthVO
)
;
fRportlCommandCenterVOList
.
add
(
lastYearVo
)
;
return
fRportlCommandCenterVOList
;
}
//指挥中心-泥量统计
public
List
<
ReportItemVO
>
statisticsByCementList
(
String
departIds
,
String
startTime
,
String
endTime
)
{
List
<
ReportItemVO
>
dateList
=
statisticsByField
(
departIds
,
startTime
,
endTime
,
view3a24
,
"WNL"
);
return
dateList
;
}
/***
* 能耗分析
* @param endTime
*/
public
List
<
FRportlCommandCenterVO
>
statisticsByElectricity
(
String
departId
,
String
startTime
,
String
endTime
)
{
List
<
FRportlCommandCenterVO
>
fRportlCommandCenterVOList
=
new
ArrayList
<>();
DateVO
dateVO
=
new
DateVO
(
startTime
);
String
dataViewName3a24
=
ReportViewUtil
.
buildViewLike
(
view3a24
,
"DLHJ"
,
departId
,
startTime
,
endTime
);
String
sql
=
"select sum(aaa.DLHJ) from "
+
dataViewName3a24
+
"aaa"
;
String
nowMonthValue
=
getSumDLHJ
(
departId
,
dateVO
.
getNowMonthStartDate
(),
dateVO
.
getNowMonthEndDate
());
String
lastMonthValue
=
getSumDLHJ
(
departId
,
dateVO
.
getLastMonthStartTime
(),
dateVO
.
getLastMonthEndTime
());
String
lastYearValue
=
getSumDLHJ
(
departId
,
dateVO
.
getLastYearMonthStartTime
(),
dateVO
.
getLastYearMonthEndTime
());
String
nowMonthCSL
=
getSumCSL
(
departId
,
dateVO
.
getNowMonthStartDate
(),
dateVO
.
getNowMonthEndDate
());
String
lastMonthCSL
=
getSumCSL
(
departId
,
dateVO
.
getLastMonthStartTime
(),
dateVO
.
getLastMonthEndTime
());
String
lastYearCSL
=
getSumCSL
(
departId
,
dateVO
.
getLastYearMonthStartTime
(),
dateVO
.
getLastYearMonthEndTime
());
long
nowDifferDay
=
DateUtils
.
differenceDay
(
dateVO
.
getNowMonthStartDate
(),
dateVO
.
getNowMonthEndDate
());
long
lastMonthDifferDay
=
DateUtils
.
differenceDay
(
dateVO
.
getLastMonthStartTime
(),
dateVO
.
getLastMonthEndTime
());
long
lastYearDifferDay
=
DateUtils
.
differenceDay
(
dateVO
.
getLastYearMonthStartTime
(),
dateVO
.
getLastYearMonthEndTime
());
//当月数据/环比、同比
FRportlCommandCenterVO
nowMonthVO
=
new
FRportlCommandCenterVO
(
"月总电耗("
,
JSUtils
.
format
(
nowMonthValue
),
JSUtils
.
format
(
lastMonthValue
),
JSUtils
.
format
(
lastYearValue
));
//日均数据:/环比/同比
FRportlCommandCenterVO
lastMonthVO
=
new
FRportlCommandCenterVO
(
"日均电耗"
,
JSUtils
.
divide
(
nowMonthValue
,
nowDifferDay
)
,
JSUtils
.
divide
(
lastMonthValue
,
lastMonthDifferDay
),
JSUtils
.
divide
(
lastYearValue
,
lastYearDifferDay
)
);
//吨水消耗
FRportlCommandCenterVO
lastYearVo
=
new
FRportlCommandCenterVO
(
"吨水电耗"
,
JSUtils
.
divide
(
nowMonthValue
,
nowMonthCSL
)
,
JSUtils
.
divide
(
lastMonthValue
,
lastMonthCSL
),
JSUtils
.
divide
(
lastYearValue
,
lastYearCSL
));
fRportlCommandCenterVOList
.
add
(
nowMonthVO
)
;
fRportlCommandCenterVOList
.
add
(
lastMonthVO
)
;
fRportlCommandCenterVOList
.
add
(
lastYearVo
)
;
return
fRportlCommandCenterVOList
;
}
/***
* 能耗分析--详情列表
* @param endTime
*/
public
List
<
ReportItemVO
>
statisticsByElectricityList
(
String
departIds
,
String
startTime
,
String
endTime
)
{
List
<
ReportItemVO
>
dateList
=
statisticsByField
(
departIds
,
startTime
,
endTime
,
view3a24
,
"DLHJ"
);
return
dateList
;
}
/***
* 指挥中心----运行负荷率分析----处理水量详情
* @param time
* @return
*/
public
List
<
WaterTreatmentVO
>
statisticsCLSLXQ
(
String
time
,
String
departIds
){
List
<
WaterTreatmentVO
>
dateList
=
null
;
DateVO
dateVO
=
new
DateVO
(
time
);
//转换后的时间参数
long
differenceDay
=
DateUtils
.
differenceDay
(
dateVO
.
getNowMonthStartDate
(),
dateVO
.
getNowMonthEndDate
());
String
departIdsParam
=
BaseUtil
.
quoteEach
(
departIds
,
","
);
String
factorySql
=
"select group_concat(fi.depart_id) from sys_factory_info fi , sys_depart d where fi.depart_id = d.id and d.depart_type =1 "
;
if
(
departIdsParam
!=
null
){
factorySql
+=
" and d.id in("
+
departIdsParam
+
") "
;
}
//水厂部门编号集合
departIds
=
getJdbcTemplate
().
queryForObject
(
factorySql
,
String
.
class
);
//月产水量
Map
<
String
,
String
>
cslMap
=
commonQueryCsl
(
departIds
,
dateVO
.
getNowMonthStartDate
(),
dateVO
.
getNowMonthEndDate
());
String
dataViewName2119
=
ReportViewUtil
.
buildViewLike
(
view2119
,
"CSL"
,
departIds
,
dateVO
.
getNowMonthStartDate
(),
dateVO
.
getNowMonthEndDate
());
String
sql
=
"select aaa.CSL 'csl' ,aaa.depart_id , d.depart_name, fi.pro_scale*10000 'pro_scale' from "
+
dataViewName2119
+
" aaa"
;
sql
+=
" left join sys_factory_info fi on fi.depart_id = aaa.depart_id"
;
sql
+=
" left join sys_depart d on d.id = aaa.depart_id"
;
sql
+=
" order by aaa.CSL desc "
;
dateList
=
getJdbcTemplate
().
query
(
sql
,
new
BeanPropertyRowMapper
<
WaterTreatmentVO
>(
WaterTreatmentVO
.
class
));
//环比:月产水量
Map
<
String
,
String
>
hbCslMap
=
commonQueryCsl
(
departIds
,
dateVO
.
getLastMonthStartTime
(),
dateVO
.
getLastMonthEndTime
());
//同比:月产水量
Map
<
String
,
String
>
tbCslMap
=
commonQueryCsl
(
departIds
,
dateVO
.
getLastYearMonthStartTime
(),
dateVO
.
getLastYearMonthEndTime
());
int
index
=
1
;
if
(
dateList
!=
null
){
for
(
WaterTreatmentVO
waterTreatmentVO
:
dateList
){
waterTreatmentVO
.
setRank
(
index
++);
//设置排名
if
(
waterTreatmentVO
.
getCSL
()
!=
null
){
waterTreatmentVO
.
setDayCsl
(
waterTreatmentVO
.
getCSL
()
/
differenceDay
);
}
/* waterTreatmentVO.setRank( index++);//设置排名
if(cslMap.get(waterTreatmentVO.getDepartId()) != null ){
waterTreatmentVO.setCsl(Double.parseDouble(cslMap.get(waterTreatmentVO.getDepartId())) );
waterTreatmentVO.setDayCsl( waterTreatmentVO.getCsl() / differenceDay );
}*/
if
(
hbCslMap
.
get
(
waterTreatmentVO
.
getDepartId
())
!=
null
){
waterTreatmentVO
.
setHbcsl
(
Double
.
parseDouble
(
hbCslMap
.
get
(
waterTreatmentVO
.
getDepartId
()))
);
}
if
(
tbCslMap
.
get
(
waterTreatmentVO
.
getDepartId
())
!=
null
){
waterTreatmentVO
.
setTbcsl
(
Double
.
parseDouble
(
tbCslMap
.
get
(
waterTreatmentVO
.
getDepartId
()))
);
}
}
}
return
dateList
;
}
/***
* 通用方法
* @param departIds
* @param startTime
* @param endTime
* @param dataViewName
* @param field
* @return
*/
public
List
<
ReportItemVO
>
statisticsByField
(
String
departIds
,
String
startTime
,
String
endTime
,
String
dataViewName
,
String
field
)
{
List
<
ReportItemVO
>
dateList
=
null
;
DateVO
dateVO
=
new
DateVO
(
startTime
);
//转换后的时间参数
long
differenceDay
=
DateUtils
.
differenceDay
(
dateVO
.
getNowMonthStartDate
(),
dateVO
.
getNowMonthEndDate
());
String
departIdsParam
=
BaseUtil
.
quoteEach
(
departIds
,
","
);
String
factorySql
=
"select fi.depart_id, d.depart_name from sys_factory_info fi , sys_depart d where fi.depart_id = d.id and d.depart_type =1 "
;
if
(
StringUtils
.
isNotEmpty
(
departIdsParam
)){
factorySql
+=
" and d.id in("
+
departIdsParam
+
") "
;
}
//水厂部门编号集合
dateList
=
getJdbcTemplate
().
query
(
factorySql
,
new
BeanPropertyRowMapper
<
ReportItemVO
>(
ReportItemVO
.
class
));
//月产水量 Map<部门编号,环比数据>
Map
<
String
,
String
>
valueMap
=
commonQueryByField
(
departIds
,
dateVO
.
getNowMonthStartDate
(),
dateVO
.
getNowMonthEndDate
(),
dataViewName
,
field
);
//环比:月产水量 Map<部门编号,环比数据>
Map
<
String
,
String
>
hbValueMap
=
commonQueryByField
(
departIds
,
dateVO
.
getLastMonthStartTime
(),
dateVO
.
getLastMonthEndTime
(),
dataViewName
,
field
);
//同比:月产水量 Map<部门编号,同比比数据>
Map
<
String
,
String
>
tbValueMap
=
commonQueryByField
(
departIds
,
dateVO
.
getLastYearMonthStartTime
(),
dateVO
.
getLastYearMonthEndTime
(),
dataViewName
,
field
);
//月产水量
Map
<
String
,
String
>
cslMap
=
commonQueryCsl
(
departIds
,
dateVO
.
getNowMonthStartDate
(),
dateVO
.
getNowMonthEndDate
());
if
(
dateList
!=
null
)
{
for
(
ReportItemVO
reportItemVO
:
dateList
)
{
//月数据
reportItemVO
.
setValue
(
JSUtils
.
format
(
valueMap
.
get
(
reportItemVO
.
getDepartId
()))
);
//日均
reportItemVO
.
setAvgDayValue
(
JSUtils
.
divide
(
valueMap
.
get
(
reportItemVO
.
getDepartId
()),
differenceDay
)
);
//环比
reportItemVO
.
setValueHb
(
JSUtils
.
format
(
hbValueMap
.
get
(
reportItemVO
.
getDepartId
()))
);
//同比
reportItemVO
.
setValueTb
(
JSUtils
.
format
(
tbValueMap
.
get
(
reportItemVO
.
getDepartId
()))
);
//吨水泥产量
reportItemVO
.
setDscnl
(
JSUtils
.
divide
(
reportItemVO
.
getValue
(),
cslMap
.
get
(
reportItemVO
.
getDepartId
()
)
)
);
}
}
return
dateList
;
}
//通用csl查询,返回Map<部门编号,CSL出水量>
private
Map
<
String
,
String
>
commonQueryCsl
(
String
departIds
,
String
startTime
,
String
endTime
){
Map
<
String
,
String
>
cslMap
=
new
HashMap
<>();
String
dataViewName2119
=
ReportViewUtil
.
buildViewLike
(
view2119
,
"CSL"
,
departIds
,
startTime
,
endTime
);
// System.out.println("dataViewName2119 ="+dataViewName2119 );
List
<
Map
<
String
,
Object
>>
dataMapList
=
getJdbcTemplate
().
queryForList
(
dataViewName2119
);
if
(
dataMapList
!=
null
){
for
(
Map
<
String
,
Object
>
dataMap
:
dataMapList
){
cslMap
.
put
(
ConvertUtils
.
getString
(
dataMap
.
get
(
"depart_id"
))
,
ConvertUtils
.
getString
(
dataMap
.
get
(
"CSL"
)));
}
}
return
cslMap
;
}
private
Map
<
String
,
String
>
commonQueryByField
(
String
departIds
,
String
startTime
,
String
endTime
,
String
dataViewName
,
String
field
){
Map
<
String
,
String
>
cslMap
=
new
HashMap
<>();
String
dataViewNameSql
=
ReportViewUtil
.
buildViewLike
(
dataViewName
,
field
,
departIds
,
startTime
,
endTime
);
System
.
out
.
println
(
"dataViewNameSql ="
+
dataViewNameSql
);
List
<
Map
<
String
,
Object
>>
dataMapList
=
getJdbcTemplate
().
queryForList
(
dataViewNameSql
);
if
(
dataMapList
!=
null
){
for
(
Map
<
String
,
Object
>
dataMap
:
dataMapList
){
cslMap
.
put
(
ConvertUtils
.
getString
(
dataMap
.
get
(
"depart_id"
))
,
ConvertUtils
.
getString
(
dataMap
.
get
(
field
)));
}
}
return
cslMap
;
}
/***
* 获取CSL
* @param departId
* @param startTime
* @param endTime
* @return
*/
public
String
getSumCSL
(
String
departId
,
String
startTime
,
String
endTime
){
String
dataViewName2119
=
ReportViewUtil
.
buildViewLike
(
ReportViewUtil
.
view2119
,
"CSL"
,
departId
,
startTime
,
endTime
);
String
dataViewName2119
=
ReportViewUtil
.
buildViewLike
(
ReportViewUtil
.
view2119
,
"CSL"
,
departId
,
startTime
,
endTime
);
String
sql
=
"select sum(aaa.CSL) from "
+
dataViewName2119
+
"aaa"
;
String
csl
=
getJdbcTemplate
().
queryForObject
(
sql
,
String
.
class
);
return
csl
;
}
/* public List<Map<String,Object>> getDeptCSL(String departId , String startTime , String endTime){
}*/
public
String
getSumDLHJ
(
String
departId
,
String
startTime
,
String
endTime
){
String
dataViewName3a24
=
ReportViewUtil
.
buildViewLike
(
ReportViewUtil
.
view3a24
,
"DLHJ"
,
departId
,
startTime
,
endTime
);
...
...
@@ -38,6 +268,67 @@ public class ReportItemvService {
String
dlhj
=
getJdbcTemplate
().
queryForObject
(
sql
,
String
.
class
);
return
dlhj
;
}
public
String
getSumValue
(
String
viewName
,
String
fileds
,
String
departId
,
String
startTime
,
String
endTime
){
String
dataViewName3a24
=
ReportViewUtil
.
buildViewLike
(
viewName
,
fileds
,
departId
,
startTime
,
endTime
);
String
sql
=
"select sum(aaa."
+
fileds
+
") from "
+
dataViewName3a24
+
"aaa"
;
String
dlhj
=
getJdbcTemplate
().
queryForObject
(
sql
,
String
.
class
);
return
dlhj
;
}
//指挥中心-运行负荷率分析
public
DepartLoadRateResultVO
statisticsByLoadRate
(
String
departIds
,
String
startTime
,
String
endTime
,
Integer
loadRateType
)
{
DepartLoadRateResultVO
departLoadRateResultVO
=
new
DepartLoadRateResultVO
();
//int loadRateType = 1;
String
dataViewName2119
=
ReportViewUtil
.
buildView
(
view2119
,
"CSL"
,
departIds
,
startTime
,
endTime
);
// 部门、时间
//列表数据
List
<
DepartLoadRateVO
>
dataList
=
statisticsByLoadRateList
(
departIds
,
startTime
,
endTime
,
loadRateType
);
//统计总数
int
normalNum
=
getJdbcTemplate
().
queryForObject
(
getStatisticsByLoadRate
(
dataViewName2119
,
1
),
Integer
.
class
);
//正常
int
lowLoadNum
=
getJdbcTemplate
().
queryForObject
(
getStatisticsByLoadRate
(
dataViewName2119
,
3
),
Integer
.
class
);
//低负荷
int
overloadNum
=
getJdbcTemplate
().
queryForObject
(
getStatisticsByLoadRate
(
dataViewName2119
,
2
),
Integer
.
class
);
//超负荷
departLoadRateResultVO
.
setLowLoadNum
(
lowLoadNum
);
departLoadRateResultVO
.
setNormalNum
(
normalNum
);
departLoadRateResultVO
.
setOverloadNum
(
overloadNum
);
departLoadRateResultVO
.
setDepartLoadRateVOList
(
dataList
);
return
departLoadRateResultVO
;
}
//指挥中心-运行负荷率分析---列表详情
public
List
<
DepartLoadRateVO
>
statisticsByLoadRateList
(
String
departIds
,
String
startTime
,
String
endTime
,
Integer
loadRateType
)
{
String
dataViewName2119
=
ReportViewUtil
.
buildView
(
view2119
,
"CSL"
,
departIds
,
startTime
,
endTime
);
// 部门、时间
// 运行负荷率分析 = CSL/规模
String
sql
=
" select round(sum(aaa.CSL),2) 'waterYieldMonth' ,aaa.depart_id , d.depart_name , round( (sum(aaa.CSL)/(fi.pro_scale*10000) ),2) 'loadRate' from "
+
dataViewName2119
+
" aaa"
;
sql
+=
" left join sys_factory_info fi on fi.depart_id = aaa.depart_id "
;
sql
+=
" left join sys_depart d on d.id = aaa.depart_id group by aaa.depart_id"
;
if
(
loadRateType
!=
null
){
if
(
1
==
loadRateType
)
sql
+=
" having loadRate <=120 and loadRate>=60"
;
if
(
2
==
loadRateType
)
sql
+=
" having loadRate > 120 "
;
if
(
3
==
loadRateType
)
sql
+=
" having loadRate <60"
;
}
//System.out.println("sql = "+sql);
List
<
DepartLoadRateVO
>
dataList
=
getJdbcTemplate
().
query
(
sql
,
new
BeanPropertyRowMapper
<
DepartLoadRateVO
>(
DepartLoadRateVO
.
class
));
return
dataList
;
}
private
String
getStatisticsByLoadRate
(
String
dataViewName2119
,
Integer
loadRateType
){
String
sql
=
"select count(1) from ( "
;
sql
+=
" select aaa.depart_id , round( (sum(aaa.CSL)/(fi.pro_scale*10000) ),2) 'loadRate' from "
+
dataViewName2119
+
" aaa"
;
sql
+=
" left join sys_factory_info fi on fi.depart_id = aaa.depart_id "
;
sql
+=
" group by aaa.depart_id "
;
if
(
loadRateType
!=
null
){
if
(
1
==
loadRateType
)
sql
+=
" having loadRate <=120 and loadRate>=60"
;
if
(
2
==
loadRateType
)
sql
+=
" having loadRate > 120 "
;
if
(
3
==
loadRateType
)
sql
+=
" having loadRate <60"
;
}
sql
+=
" ) bbb "
;
//System.out.println("sql = "+sql);
return
sql
;
}
/* public List<Map<String,Object>> getDeptDLHJ(String departId , String startTime , String endTime){
}*/
...
...
sk-module-biz/src/main/java/com/skua/modules/algorithm/vo/ReportItemVO.java
0 → 100644
查看文件 @
a1f8032
package
com
.
skua
.
modules
.
algorithm
.
vo
;
import
com.skua.tool.util.JSUtils
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
value
=
"指挥中心:ReportItemVO"
,
description
=
"指挥中心:ReportItemVO详情类)"
)
public
class
ReportItemVO
{
@ApiModelProperty
(
value
=
"厂站编号"
)
private
String
departId
;
@ApiModelProperty
(
value
=
"厂站名称"
)
private
String
departName
;
@ApiModelProperty
(
value
=
"时间"
)
private
String
time
;
@ApiModelProperty
(
value
=
"label描述"
)
private
String
label
;
@ApiModelProperty
(
value
=
"结果"
)
private
String
value
;
@ApiModelProperty
(
value
=
"日均数据"
)
private
String
avgDayValue
;
@ApiModelProperty
(
value
=
"同比"
)
private
String
valueTb
;
@ApiModelProperty
(
value
=
"同比比例"
)
private
String
valueTbBl
;
/* @ApiModelProperty(value = "同比差值")
private String valueTbDifference;*/
@ApiModelProperty
(
value
=
"环比"
)
private
String
valueHb
;
@ApiModelProperty
(
value
=
"环比比例"
)
private
String
valueHbBl
;
@ApiModelProperty
(
value
=
"吨水产泥量"
)
private
String
dscnl
;
/* @ApiModelProperty(value = "环比差值")
private String valueHbDifference;
@ApiModelProperty(value = "单位")
private String unit;
*/
public
String
getValueTbBl
()
{
valueTbBl
=
JSUtils
.
executeExpression
(
"("
+
this
.
getValue
()
+
" - "
+
this
.
getValueTb
()
+
") / "
+
this
.
getValueTb
(),
"0.00"
)
;
return
valueTbBl
;
}
public
String
getValueHbBl
()
{
valueHbBl
=
JSUtils
.
executeExpression
(
"("
+
this
.
getValue
()
+
" - "
+
this
.
getValueHb
()
+
") / "
+
this
.
getValueHb
(),
"0.00"
)
;
return
valueHbBl
;
}
}
sk-module-datafill/src/main/java/com/skua/modules/report/mapper/xml/FReportItemvMapper.xml
查看文件 @
a1f8032
...
...
@@ -142,7 +142,7 @@
FROM
report_electric_cost
WHERE
month BETWEEN
'2024-01' AND '2024-10'
month BETWEEN
#{startDate} AND ${endDate}
GROUP BY month
</select>
...
...
sk-module-equipment/src/main/java/com/skua/modules/equipment/service/impl/DrugConsumptionAnalusisServiceImpl.java
查看文件 @
a1f8032
...
...
@@ -74,7 +74,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
Map
<
String
,
Object
>
dsyhMap
=
queryForMap
(
sql
.
toString
());
// getJdbcTemplate().queryForMap(sql.toString());
if
(
dsyhMap
!=
null
){
displayVO
.
setLszddsyh
(
dsyhMap
.
get
(
"dsyh"
)+
""
);
displayVO
.
setLszddsyh
(
ConvertUtils
.
getString
(
dsyhMap
.
get
(
"dsyh"
),
"0"
)
);
displayVO
.
setLszddsyhyf
(
dsyhMap
.
get
(
"time"
)+
""
);
}
...
...
sk-module-system/src/main/java/com/skua/modules/system/service/ISysFactoryInfoService.java
查看文件 @
a1f8032
...
...
@@ -102,6 +102,8 @@ public interface ISysFactoryInfoService extends IService<SysFactoryInfo> {
List
<
SysFactoryInfoVO
>
getFactoryListByWrapper
(
QueryWrapper
<
SysFactoryInfoVO
>
queryWrapper
);
/**
* 获取总的设计规模
* @return
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论