Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skboot-zhongye
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
ea10bd28
由
dengxuelong
编写于
2024-10-28 10:40:53 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
化验日报-在线值
1 个父辈
408a631f
全部展开
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
148 行增加
和
0 行删除
sk-module-datafill/src/main/java/com/skua/modules/report/controller/JmReportController.java
sk-module-datafill/src/main/java/com/skua/modules/report/mapper/ReportHeaderMapper.java
sk-module-datafill/src/main/java/com/skua/modules/report/mapper/xml/ReportHeaderMapper.xml
sk-module-datafill/src/main/java/com/skua/modules/util/ReportUtil.java
sk-module-system/src/main/java/com/skua/config/ShiroConfig.java
sk-module-datafill/src/main/java/com/skua/modules/report/controller/JmReportController.java
0 → 100644
查看文件 @
ea10bd2
package
com
.
skua
.
modules
.
report
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.skua.core.api.vo.Result
;
import
com.skua.modules.report.entity.ReportDisplay
;
import
com.skua.modules.report.entity.ReportHeader
;
import
com.skua.modules.report.mapper.FReportManageMapper
;
import
com.skua.modules.report.mapper.ReportHeaderMapper
;
import
com.skua.modules.report.service.IJmReportService
;
import
com.skua.modules.report.service.IReportDisplayService
;
import
com.skua.modules.report.vo.ReportShow
;
import
com.skua.modules.util.ReportUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
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
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Slf4j
@Api
(
tags
=
"积木 报表展示"
)
@RestController
@RequestMapping
(
"/report/jmReport"
)
public
class
JmReportController
{
@Autowired
ReportDisplayController
reportDisplayController
;
@Autowired
FReportManageMapper
reportManageMapper
;
@Autowired
IReportDisplayService
reportDisplayService
;
@Autowired
ReportHeaderMapper
reportHeaderMapper
;
@Autowired
IJmReportService
jmReportService
;
@ApiOperation
(
value
=
"化验日报-在线值"
,
notes
=
"积木报表"
)
@GetMapping
(
value
=
"/hyrbZxz"
)
public
Map
trCount
(
@RequestParam
(
name
=
"departId"
)
String
departId
,
@RequestParam
(
name
=
"date"
)
String
date
//yyyy-MM-dd
)
{
Map
returnData
=
new
HashMap
();
//查询【表头】 保持和[生产报表]一致
QueryWrapper
<
ReportDisplay
>
reportDisplayQueryWrapper
=
new
QueryWrapper
<>();
reportDisplayQueryWrapper
.
eq
(
"depart_id"
,
departId
);
reportDisplayQueryWrapper
.
eq
(
"report_name"
,
"生产报表"
);
ReportDisplay
reportDisplay
=
reportDisplayService
.
getOne
(
reportDisplayQueryWrapper
);
if
(
reportDisplay
==
null
)
{
return
returnData
;
}
List
<
Map
<
String
,
String
>>
reportHeaderList
=
reportHeaderMapper
.
hyrbZxz
(
reportDisplay
.
getId
());
Map
<
String
,
String
>
reportHeaderMap
=
reportHeaderList
.
stream
().
collect
(
Collectors
.
toMap
(
v
->
v
.
get
(
"tag"
),
o
->
o
.
get
(
"metricId"
)));
//查询【数据】
ReportShow
params
=
new
ReportShow
();
params
.
setId
(
reportDisplay
.
getId
());
params
.
setDepartId
(
departId
);
params
.
setStartDateTime
(
date
+
" 00:00:00"
);
params
.
setEndDateTime
(
date
+
" 23:59:59"
);
params
.
setReportType
(
"day"
);
Result
<
List
<
Map
<
String
,
Object
>>>
dataListResult
=
reportDisplayController
.
reprotShow
(
params
);
List
<
Map
<
String
,
Object
>>
dataList
=
CollectionUtils
.
isEmpty
(
dataListResult
.
getResult
())
?
new
LinkedList
<>()
:
dataListResult
.
getResult
();
//(正常情况下只有一条)
//查询【告警上限】
List
<
Map
<
String
,
String
>>
limitList
=
reportHeaderMapper
.
queryLimit
(
departId
);
Map
<
String
,
String
>
limitMap
=
limitList
.
stream
().
collect
(
Collectors
.
toMap
(
v
->
v
.
get
(
"tag"
),
o
->
o
.
get
(
"maxValue"
)));
List
<
String
>
tagList
=
Arrays
.
asList
(
"CSCOD"
,
"CSNH3N"
,
"CSPH"
,
"CSTN"
,
"CSTP"
,
"JSCOD"
,
"JSNH3N"
,
"JSPH"
,
"JSTN"
,
"JSTP"
,
"JSSS"
,
"CSSS"
);
//组装数据
for
(
Map
<
String
,
Object
>
dataMap
:
dataList
)
{
for
(
String
tag
:
tagList
)
{
String
metricId
=
reportHeaderMap
.
get
(
tag
);
//点位Id
dataMap
.
put
(
tag
,
dataMap
.
get
(
metricId
));
BigDecimal
minValue
=
tag
.
contains
(
"PH"
)
?
new
BigDecimal
(
"6"
)
:
BigDecimal
.
ZERO
;
//PH的阈值固定为6~9
BigDecimal
maxValue
=
tag
.
contains
(
"PH"
)
?
new
BigDecimal
(
"9"
)
:
ReportUtil
.
getBigDecimalValue
(
tag
,
limitMap
);
maxValue
=
maxValue
==
null
?
new
BigDecimal
(
"9999999"
)
:
maxValue
;
boolean
flag
=
false
;
BigDecimal
valueBigDecimal
=
ReportUtil
.
newBigDecimal
(
metricId
,
null
);
if
(
valueBigDecimal
!=
null
&&
(
valueBigDecimal
.
compareTo
(
minValue
)
<
0
||
valueBigDecimal
.
compareTo
(
maxValue
)
>
0
)){
flag
=
true
;
//超标!
}
dataMap
.
put
(
tag
+
"_是否超标"
,
flag
?
"yes"
:
"no"
);
//判断是否告警
}
}
returnData
.
put
(
"data"
,
dataList
);
return
returnData
;
}
}
sk-module-datafill/src/main/java/com/skua/modules/report/mapper/ReportHeaderMapper.java
查看文件 @
ea10bd2
package
com
.
skua
.
modules
.
report
.
mapper
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.ibatis.annotations.Param
;
import
com.skua.modules.report.entity.ReportHeader
;
...
...
@@ -15,4 +16,13 @@ public interface ReportHeaderMapper extends BaseMapper<ReportHeader> {
//查询报表信息
List
<
ReportHeader
>
headerAll
(
@Param
(
"reportId"
)
String
reportId
);
List
<
Map
<
String
,
String
>>
hyrbZxz
(
String
id
);
/**
* 查询告警上限值
* @param depart
* @return
*/
List
<
Map
<
String
,
String
>>
queryLimit
(
String
depart
);
}
...
...
sk-module-datafill/src/main/java/com/skua/modules/report/mapper/xml/ReportHeaderMapper.xml
查看文件 @
ea10bd2
...
...
@@ -30,4 +30,31 @@
report_id =#{reportId}
ORDER BY sort_num
</select>
<select
id=
"hyrbZxz"
resultType=
"java.util.Map"
>
select m.metric_uid_tag as 'tag', h.key_index as 'metricId', h.title
from report_header h
join sys_monitor_metric_info m on h.key_index = m.id
where
h.report_id = #{id}
and metric_uid_tag is not null
and metric_uid_tag != ''
</select>
<select
id=
"queryLimit"
resultType=
"java.util.Map"
>
SELECT
b.alarm_param_code AS tag,
b.alarm_param_upper_limit AS `maxValue`
FROM
sys_factory_info a
LEFT JOIN alarm_param_standard_config b ON a.out_level = b.alarm_level_standard_id
WHERE
depart_id = #{depart}
UNION ALL
SELECT
index_code,
upper
FROM
water_quality_in_level
WHERE
depart_id = #{depart}
</select>
</mapper>
...
...
sk-module-datafill/src/main/java/com/skua/modules/util/ReportUtil.java
0 → 100644
查看文件 @
ea10bd2
此文件的差异被折叠,
点击展开。
sk-module-system/src/main/java/com/skua/config/ShiroConfig.java
查看文件 @
ea10bd2
...
...
@@ -49,6 +49,7 @@ public class ShiroConfig {
filterChainDefinitionMap
.
put
(
"/sys/logout"
,
"anon"
);
//登出接口排除
filterChainDefinitionMap
.
put
(
"/sys/getEncryptedString"
,
"anon"
);
//获取加密串
filterChainDefinitionMap
.
put
(
"/sys/sms"
,
"anon"
);
//短信验证码
filterChainDefinitionMap
.
put
(
"/report/jmReport/*"
,
"anon"
);
//积木报表
filterChainDefinitionMap
.
put
(
"/sys/phoneLogin"
,
"anon"
);
//手机登录
filterChainDefinitionMap
.
put
(
"/sys/user/checkOnlyUser"
,
"anon"
);
//校验用户是否存在
filterChainDefinitionMap
.
put
(
"/sys/user/register"
,
"anon"
);
//用户注册
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论