baoshiwei
2025-06-19 0571c03740d9069cf761695d0dcadd4d6bc9af0d
refactor(model): 优化模型相关功能和查询

- 在 ModelInfoServiceImpl 中增加对 meterIds 的空判断,提高代码健壮性- 在 EnergyIndexMapper 中添加排序,优化查询结果顺序
- 修改 ModelNodeMapper 查询逻辑,增加对节点自身索引信息的获取- 更新前端页面操作人员显示字段
- 优化能源趋势分析和电能质量页面的表单提交逻辑
- 调整首页卡片列表项最大宽度
- 新增 Benchmark 类,用于标杆值管理
已添加1个文件
已修改7个文件
70 ■■■■■ 文件已修改
zhitan-system/src/main/java/com/zhitan/benchmarkmanage/domain/Benchmark.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-system/src/main/java/com/zhitan/model/service/impl/ModelInfoServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-system/src/main/resources/mapper/model/EnergyIndexMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-system/src/main/resources/mapper/model/ModelNodeMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-vue/src/views/airconditioner/log.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-vue/src/views/costAnalysis/energy-trend-analysis.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-vue/src/views/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-vue/src/views/powerquality/load/index.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-system/src/main/java/com/zhitan/benchmarkmanage/domain/Benchmark.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@
package com.zhitan.benchmarkmanage.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zhitan.common.annotation.Excel;
import com.zhitan.common.core.domain.BaseEntity;
import lombok.Data;
/**
 * æ ‡æ†å€¼ç®¡ç†å¯¹è±¡ benchmark
 *
 * @author ZhiTan
 */
@TableName("benchmark")
@Data
public class Benchmark extends BaseEntity {
    private static final long serialVersionUID = 1L;
    /** uuid主键 */
    private String id;
    /** æ ‡æ†ç¼–码 */
    @Excel(name = "标杆编码")
    private String code;
    /** æ ‡æ†ç±»åž‹ */
    @Excel(name = "标杆类型")
    private String type;
    /** æ ‡æ†ç­‰çº§ */
    @Excel(name = "标杆等级")
    private String grade;
    /** æ ‡æ†å€¼ */
    @Excel(name = "标杆值")
    private String value;
    /** å›½æ ‡ç¼–号 */
    @Excel(name = "国标编号")
    private String nationalNum;
}
zhitan-system/src/main/java/com/zhitan/model/service/impl/ModelInfoServiceImpl.java
@@ -137,6 +137,7 @@
    List<EnergyIndex> energyIndexList = energyIndexService.getEnergyIndexByIds(indexIds);
    // æ ¹æ®indexid查询对应计量器具信息
    List<String> meterIds = energyIndexList.stream().map(EnergyIndex::getMeterId).collect(Collectors.toList());
    if (CollectionUtils.isEmpty(meterIds)) return voList;
    Map<String, List<MeterImplement>> meterImplementMap = meterImplementService.listMeterImplementByIds(meterIds).stream()
            .filter(li -> StringUtils.isNotEmpty(li.getInstallactionLocation()))
            .collect(Collectors.groupingBy(MeterImplement::getId));
zhitan-system/src/main/resources/mapper/model/EnergyIndexMapper.xml
@@ -375,6 +375,7 @@
                </foreach>
            </if>
        </where>
        order by ei.code
    </select>
    <select id="getiEnergyIndexByCode" resultType="com.zhitan.model.domain.EnergyIndex">
        <include refid="selectEnergyIndexVo"/>
zhitan-system/src/main/resources/mapper/model/ModelNodeMapper.xml
@@ -309,7 +309,7 @@
               ni.index_id indexId
        FROM "model_node" mn
                 LEFT JOIN "node_index" ni ON mn.node_id = ni.node_id
        WHERE mn.parent_id = #{parentId}
        WHERE mn.parent_id = #{parentId} or ni.node_id = #{parentId}
    </select>
    <select id="getModelNodeIndexIdRelationInforByNodeId"
zhitan-vue/src/views/airconditioner/log.vue
@@ -65,7 +65,7 @@
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column label="操作人员" align="center" prop="operatorName" />
      <el-table-column label="操作人员" align="center" prop="createBy" />
    </el-table>
    
    <pagination
zhitan-vue/src/views/costAnalysis/energy-trend-analysis.vue
@@ -8,6 +8,7 @@
import { useRoute } from "vue-router"
const { period } = proxy.useDict("period")
import useSettingsStore from "@/store/modules/settings"
import message from "yarn/lib/cli.js";
const settingsStore = useSettingsStore()
watch(
  () => settingsStore.sideTheme,
@@ -43,7 +44,10 @@
        }
      })
      queryParams.value.meterId = res.data.length > 0 ? res.data[0].code : ""
      getList()
      if (res.data.length > 0) {
        getList()
      }
    }
  })
}
@@ -64,12 +68,17 @@
function getList() {
  return
  loading.value = true
  if (!queryParams.value.meterId) {
    message.error("请选择电表")
  }
  let params = {
    nodeId: queryParams.value.nodeId,
    timeType: queryParams.value.timeType,
    timeCode: queryParams.value.dataTime,
    meterId: queryParams.value.meterId,
  }
  console.log("params:::",params)
  if (queryParams.value.timeType == "DAY") {
    params.timeCode = proxy.dayjs(new Date(queryParams.value.dataTime)).format("YYYY-MM-DD")
  } else if (queryParams.value.timeType == "MONTH") {
zhitan-vue/src/views/index.vue
@@ -924,7 +924,7 @@
      .card-list-item {
        width: 0;
        flex: 1 1 320px;
        max-width: 320px;
        max-width: 520px;
        height: 135px;
        background: rgba(242, 246, 250, 0.1);
        box-sizing: border-box;
zhitan-vue/src/views/powerquality/load/index.vue
@@ -117,6 +117,7 @@
import { useRoute } from "vue-router"
const { period } = proxy.useDict("period")
import useSettingsStore from "@/store/modules/settings"
import {ElMessage} from "element-plus";
const settingsStore = useSettingsStore()
watch(
  () => settingsStore.sideTheme,
@@ -151,7 +152,9 @@
        }
      })
      queryParams.value.meterId = res.data.length > 0 ? res.data[0].code : ""
      getList()
      if (res.data.length > 0) {
        getList()
      }
    }
  })
}
@@ -178,7 +181,12 @@
const LineChartRef = ref()
function getList() {
  if (!queryParams.value.meterId) {
    ElMessage.error("请选择电表")
    return
  }
  loading.value = true
  let params = {
    nodeId: queryParams.value.nodeId,
    timeType: queryParams.value.timeType,