大屏改造第一阶段
This commit is contained in:
parent
19037f6dc4
commit
4d3c6a51de
@ -43,7 +43,7 @@ public class EnergyDataStatisticsController extends BaseController
|
||||
public AjaxResult energyConsumptionSummationDay() {
|
||||
try {
|
||||
String timeType = "DAY";
|
||||
String modelCode = "COMPREHENSIVE_CODE";
|
||||
String modelCode = "YSCJMX";
|
||||
return AjaxResult.success(homepageService.energyConsumptionSummation(timeType,modelCode));
|
||||
} catch (Exception ex) {
|
||||
logger.error("获取出错!", ex);
|
||||
@ -59,7 +59,7 @@ public class EnergyDataStatisticsController extends BaseController
|
||||
@GetMapping("/energyConsumptionSummation")
|
||||
public AjaxResult energyConsumptionSummation(String timeType) {
|
||||
try {
|
||||
String modelCode = "COMPREHENSIVE_CODE";
|
||||
String modelCode = "YSCJMX";
|
||||
return AjaxResult.success(statisticService.energyConsumptionSummation(timeType,modelCode));
|
||||
} catch (Exception ex) {
|
||||
logger.error("获取出错!", ex);
|
||||
|
||||
@ -36,7 +36,7 @@ public class HomePageController extends BaseController {
|
||||
@GetMapping("/energyConsumptionSummation")
|
||||
public AjaxResult energyConsumptionSummation(String timeType) {
|
||||
try {
|
||||
String modelcode = "COMPREHENSIVE_CODE";
|
||||
String modelcode = "YSCJMX";
|
||||
return AjaxResult.success(homepageService.energyConsumptionSummation(timeType, modelcode));
|
||||
} catch (Exception ex) {
|
||||
logger.error("获取出错!", ex);
|
||||
|
||||
@ -131,6 +131,7 @@ public class HomePageServiceImpl implements IHomePageService {
|
||||
if (ObjectUtils.isEmpty(modelNode)) {
|
||||
return voList;
|
||||
}
|
||||
// 查询 node 节点的所有 point 点位
|
||||
List<ModelNodePointInfo> inforList = modelNodeService.getModelNodeIndexIdRelationInforByNodeId(modelNode.getNodeId());
|
||||
List<String> indexIds = inforList.stream().map(ModelNodePointInfo::getIndexId).collect(Collectors.toList());
|
||||
// 通过indexIds找energy_used数据
|
||||
|
||||
@ -24,6 +24,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 实时库初连接
|
||||
@ -151,7 +152,9 @@ public class InfluxDBRepository {
|
||||
fluxSql.append("|> filter(fn: (r) => r[\"_field\"] == \"value\")");
|
||||
if (!tagCodes.isEmpty()) {
|
||||
fluxSql.append("|> filter(fn: (r) => r[\"tag\"] =~ /");
|
||||
List<String> filter = new ArrayList<>(tagCodes);
|
||||
List<String> filter = tagCodes.stream()
|
||||
.map(code -> code.split("_")[0]) // 按下划线分割,取第0段
|
||||
.collect(Collectors.toList());
|
||||
fluxSql.append(String.join("|", filter));
|
||||
fluxSql.append("/)");
|
||||
}
|
||||
|
||||
@ -307,12 +307,25 @@
|
||||
|
||||
<select id="getModelNodeIndexIdRelationInforByNodeId"
|
||||
resultType="com.zhitan.model.domain.vo.ModelNodePointInfo">
|
||||
SELECT mn.node_id nodeId,
|
||||
mn."name" "name",
|
||||
ni.point_id indexId
|
||||
FROM "model_node" mn
|
||||
LEFT JOIN "node_point" ni ON mn.node_id = ni.node_id
|
||||
WHERE mn.node_id = #{nodeId}
|
||||
WITH RECURSIVE node_tree AS (
|
||||
-- 锚点成员:传入的根节点
|
||||
SELECT node_id, "name", parent_id
|
||||
FROM "model_node"
|
||||
WHERE node_id = #{nodeId}
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- 递归成员:查询所有子节点(无限层级)
|
||||
SELECT child.node_id, child."name", child.parent_id
|
||||
FROM "model_node" child
|
||||
INNER JOIN node_tree parent ON child.parent_id = parent.node_id)
|
||||
-- 关联点位表,查询每个节点的point_id
|
||||
SELECT nt.node_id AS nodeId,
|
||||
nt."name" AS "name",
|
||||
ni.point_id AS indexId
|
||||
FROM node_tree nt
|
||||
LEFT JOIN "node_point" ni ON nt.node_id = ni.node_id
|
||||
ORDER BY nt.node_id
|
||||
</select>
|
||||
|
||||
<select id="getModelNodeByModelCodeByIndexCode" resultType="com.zhitan.model.domain.ModelNode">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user