Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skboot-zhongye
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
6a6f6fb0
由
康伟
编写于
2024-10-31 12:09:13 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
kangwei :对外集团大屏数据接口
1 个父辈
280a35af
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
46 行增加
和
24 行删除
sk-module-biz/src/main/java/com/skua/modules/quartz/util/BaseUtil.java
sk-module-biz/src/main/java/com/skua/modules/threedimensional/controller/JTDisplayScreenController.java
sk-module-biz/src/main/java/com/skua/modules/threedimensional/service/IJTDisplayScreenService.java
sk-module-biz/src/main/java/com/skua/modules/threedimensional/service/impl/JTDisplayScreenServiceImpl.java
sk-module-biz/src/main/java/com/skua/modules/quartz/util/BaseUtil.java
查看文件 @
6a6f6fb
...
...
@@ -15,6 +15,25 @@ import java.util.regex.Pattern;
public
class
BaseUtil
{
/***
* 计算时间的前几个月的月份
* @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
String
dateformat
(
String
date
,
String
format
)
{
SimpleDateFormat
sformat
=
new
SimpleDateFormat
(
format
);
Date
_date
=
null
;
...
...
sk-module-biz/src/main/java/com/skua/modules/threedimensional/controller/JTDisplayScreenController.java
查看文件 @
6a6f6fb
...
...
@@ -46,9 +46,9 @@ public class JTDisplayScreenController {
@AutoLog
(
value
=
"水量趋势"
)
@ApiOperation
(
value
=
"水量趋势"
,
notes
=
"水量趋势"
)
@GetMapping
(
"/waterTrend"
)
public
Result
<
List
<
WaterTrendVO
>>
waterTrend
(
String
departId
,
String
startTime
,
String
endTime
){
public
Result
<
List
<
WaterTrendVO
>>
waterTrend
(
String
departId
,
String
time
){
Result
<
List
<
WaterTrendVO
>>
result
=
new
Result
<>();
List
<
WaterTrendVO
>
list
=
displayScreenService
.
queryWaterTrend
(
departId
,
startTime
,
endTime
);
List
<
WaterTrendVO
>
list
=
displayScreenService
.
queryWaterTrend
(
departId
,
time
);
result
.
setResult
(
list
);
return
result
;
}
...
...
@@ -64,9 +64,9 @@ public class JTDisplayScreenController {
@AutoLog
(
value
=
"水质水量:右侧图表"
)
@ApiOperation
(
value
=
"水质水量:右侧图表"
,
notes
=
"水质水量:右侧图表"
)
@GetMapping
(
"/waterQualityCchart"
)
public
Result
<
List
<
WaterQualityChartVO
>>
waterQualityCchart
(
String
departId
,
String
startTime
,
String
endTime
){
public
Result
<
List
<
WaterQualityChartVO
>>
waterQualityCchart
(
String
departId
,
String
time
){
Result
<
List
<
WaterQualityChartVO
>>
result
=
new
Result
<>();
List
<
WaterQualityChartVO
>
waterTrendVOList
=
displayScreenService
.
queryWaterQualityChart
(
departId
,
startTime
,
endT
ime
);
List
<
WaterQualityChartVO
>
waterTrendVOList
=
displayScreenService
.
queryWaterQualityChart
(
departId
,
t
ime
);
result
.
setResult
(
waterTrendVOList
);
return
result
;
}
...
...
sk-module-biz/src/main/java/com/skua/modules/threedimensional/service/IJTDisplayScreenService.java
查看文件 @
6a6f6fb
...
...
@@ -27,11 +27,9 @@ public interface IJTDisplayScreenService {
/***
* 水量趋势
* @param departId
* @param startTime
* @param endTime
* @return
*/
List
<
WaterTrendVO
>
queryWaterTrend
(
String
departId
,
String
startTime
,
String
endT
ime
);
List
<
WaterTrendVO
>
queryWaterTrend
(
String
departId
,
String
t
ime
);
/***
* 水质水量数据
...
...
@@ -44,11 +42,9 @@ public interface IJTDisplayScreenService {
/***
* 水质水量图标数据
* @param departId
* @param startTime
* @param endTime
* @return
*/
List
<
WaterQualityChartVO
>
queryWaterQualityChart
(
String
departId
,
String
startTime
,
String
endTime
);
List
<
WaterQualityChartVO
>
queryWaterQualityChart
(
String
departId
,
String
time
);
/***
* 生态效益
...
...
sk-module-biz/src/main/java/com/skua/modules/threedimensional/service/impl/JTDisplayScreenServiceImpl.java
查看文件 @
6a6f6fb
...
...
@@ -4,8 +4,10 @@ import com.skua.common.report.ReportViewUtil;
import
com.skua.core.context.SpringContextUtils
;
import
com.skua.core.util.ConvertUtils
;
import
com.skua.core.util.DateUtils
;
import
com.skua.modules.common.vo.DateVO
;
import
com.skua.modules.guest.util.DateUtil
;
import
com.skua.modules.quartz.util.BaseUtil
;
import
com.skua.modules.threedimensional.service.IJTDisplayScreenService
;
import
com.skua.modules.threedimensional.vo.*
;
import
com.skua.tool.util.DigitalUtils
;
...
...
@@ -14,10 +16,7 @@ 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
;
import
java.util.*
;
/**
...
...
@@ -148,17 +147,21 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService {
/***
* 水量趋势
* @param departId
* @param startTime
* @param endTime
* @return
*/
public
List
<
WaterTrendVO
>
queryWaterTrend
(
String
departId
,
String
startTime
,
String
endTime
){
public
List
<
WaterTrendVO
>
queryWaterTrend
(
String
departId
,
String
time
){
if
(
time
==
null
){
time
=
DateUtils
.
format
(
new
Date
(),
"yyyy-MM"
);
}
//查询当前时间往前推12个月的数据
String
startTime
=
BaseUtil
.
getMonthBytime
(-
6
,
time
)+
"-01"
;
String
endTime
=
BaseUtil
.
getMonthBytime
(-
1
,
time
)+
"-31"
;
//月产水量
String
dataViewName2119
=
ReportViewUtil
.
buildView
(
view2119
,
"CSL,JSL"
,
null
,
startTime
,
endTime
);
//System.out.println("dataViewName2119 ="+dataViewName2119);
StringBuffer
sql
=
new
StringBuffer
(
"select date_format(bbb.time,'%Y-%m') 'time' ,round(sum(bbb.JSL),2) 'jsl',round(sum(bbb.CSL)
',2)
csl' from "
);
StringBuffer
sql
=
new
StringBuffer
(
"select date_format(bbb.time,'%Y-%m') 'time' ,round(sum(bbb.JSL),2) 'jsl',round(sum(bbb.CSL)
,2) '
csl' from "
);
sql
.
append
(
dataViewName2119
);
sql
.
append
(
" bbb group by date_format(bbb.time,'%Y-%m') ORDER BY time"
);
sql
.
append
(
" bbb group by date_format(bbb.time,'%Y-%m') ORDER BY
bbb.
time"
);
List
<
WaterTrendVO
>
waterTrendList
=
getJdbcTemplate
().
query
(
sql
.
toString
(),
new
BeanPropertyRowMapper
<
WaterTrendVO
>(
WaterTrendVO
.
class
));
...
...
@@ -192,18 +195,22 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService {
/***
* 水质水量图标数据
* @param departId
* @param startTime
* @param endTime
* @return
*/
public
List
<
WaterQualityChartVO
>
queryWaterQualityChart
(
String
departId
,
String
startTime
,
String
endTime
){
public
List
<
WaterQualityChartVO
>
queryWaterQualityChart
(
String
departId
,
String
time
){
if
(
time
==
null
){
time
=
DateUtils
.
format
(
new
Date
(),
"yyyy-MM"
);
}
//查询当前时间往前推12个月的数据
String
startTime
=
BaseUtil
.
getMonthBytime
(-
12
,
time
)+
"-01"
;
String
endTime
=
BaseUtil
.
getMonthBytime
(-
1
,
time
)+
"-31"
;
//CSL,JSCOD,CSCOD,JSZL,CSZL,JSZD,CSTN,JSAD,CSAD
String
dataViewName2119
=
ReportViewUtil
.
buildView
(
view2119
,
"JSL,JSCOD,CSCOD,JSZL,CSZL,JSZD,CSTN,JSAD,CSAD"
,
departId
,
startTime
,
endTime
);
System
.
out
.
println
(
"dataViewName2119 ="
+
dataViewName2119
);
StringBuffer
sql
=
new
StringBuffer
(
"select date_format(
time, '%Y-%m') 'time' , round(sum(aaa.C
SL),2) 'jsl',round(sum( aaa.JSCOD -aaa.CSCOD ),2) 'cod', "
);
StringBuffer
sql
=
new
StringBuffer
(
"select date_format(
aaa.time, '%Y-%m') 'time' , round(sum(aaa.J
SL),2) 'jsl',round(sum( aaa.JSCOD -aaa.CSCOD ),2) 'cod', "
);
sql
.
append
(
" round(sum( aaa.JSZL -aaa.CSZL ),2) 'tp', round(sum( aaa.JSZD -aaa.CSTN ),2) 'tn',round(sum( aaa.JSAD -aaa.CSAD ),2) 'nh3n' from "
);
sql
.
append
(
" "
+
dataViewName2119
+
" aaa "
);
sql
.
append
(
" GROUP BY date_format(
time, '%Y-%m') order by
time "
);
sql
.
append
(
" GROUP BY date_format(
aaa.time, '%Y-%m') order by aaa.
time "
);
List
<
WaterQualityChartVO
>
waterQualityChartVOList
=
getJdbcTemplate
().
query
(
sql
.
toString
(),
new
BeanPropertyRowMapper
<
WaterQualityChartVO
>(
WaterQualityChartVO
.
class
));
return
waterQualityChartVOList
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论