Selaa lähdekoodia

短期调控记录列表查询

xusl 6 kuukautta sitten
vanhempi
commit
8df95ac290

+ 54 - 0
cpp-admin/src/main/java/com/cpp/web/controller/regulation/DqRegulationController.java

@@ -3,20 +3,26 @@ package com.cpp.web.controller.regulation;
 
 import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.cpp.common.core.domain.R;
+import com.cpp.common.core.domain.entity.SysUser;
 import com.cpp.common.core.domain.model.LoginUser;
 import com.cpp.common.utils.DateUtils;
 import com.cpp.common.utils.SecurityUtils;
 import com.cpp.system.service.ISysConfigService;
+import com.cpp.system.service.ISysUserService;
 import com.cpp.web.domain.accuracy.AccuracyPassRate;
 import com.cpp.web.domain.enums.DataSourcesEnum;
 import com.cpp.web.domain.enums.ForecastTypeEnum;
+import com.cpp.web.domain.enums.RegulationStatusEnum;
 import com.cpp.web.domain.regulation.TempShortRegulation;
 import com.cpp.web.domain.regulation.TempShortRegulationDetail;
 import com.cpp.web.domain.regulation.TempShortUsual;
 import com.cpp.web.domain.regulation.TempShortUsualDetail;
 import com.cpp.web.domain.station.ElectricField;
 import com.cpp.web.domain.station.ForecastPowerShortTermStation;
+import com.cpp.web.domain.station.InverterStatusData;
 import com.cpp.web.dto.TempShortRegulationDto;
 import com.cpp.web.service.accuracy.AccuracyPassRateService;
 import com.cpp.web.service.regulation.TempShortRegulationDetailService;
@@ -26,6 +32,7 @@ import com.cpp.web.service.regulation.TempShortUsualService;
 import com.cpp.web.service.station.ElectricFieldService;
 import com.cpp.web.service.station.ForecastPowerShortTermStationService;
 import com.cpp.web.utils.DateTimeUtil;
+import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -60,6 +67,8 @@ public class DqRegulationController {
     TempShortUsualDetailService tempShortUsualDetailService;
     @Autowired
     ISysConfigService configService;
+    @Autowired
+    ISysUserService iSysUserService;
 
 
 
@@ -224,6 +233,8 @@ public class DqRegulationController {
         tempShortRegulation.setForecastDate(tempShortRegulationDto.getForecastDate());
         tempShortRegulation.setTkDate(tempShortRegulationDto.getTkDate());
         tempShortRegulation.setCreateBy(loginUser.getUsername());
+        // 设置未下发
+        tempShortRegulation.setRegulationStatusEnum(RegulationStatusEnum.E2.name());
         tempShortRegulationService.save(tempShortRegulation);
 
         // 封装新的调控明细插入数据
@@ -315,4 +326,47 @@ public class DqRegulationController {
         calendar.set(Calendar.SECOND, 0);
         return R.ok(DateUtil.format(calendar.getTime(), "yyyy-MM-dd HH:mm:ss"));
     }
+
+    /**
+     * 短期调控记录列表分页
+     *
+     * @return
+     */
+    @ApiOperation(value = "分页查询", notes = "分页查询")
+    @GetMapping("/getDqRegulationRecordList")
+    public R getDqRegulationRecordList(String stationCode, Long startTime,Long endTime) {
+        QueryWrapper<TempShortRegulation> tempShortRegulationQueryWrapper = new QueryWrapper<>();
+        tempShortRegulationQueryWrapper.eq("station_code", stationCode);
+        tempShortRegulationQueryWrapper.between("tk_date", new Date(startTime), new Date(endTime));
+        tempShortRegulationQueryWrapper.orderByAsc("tk_date").orderByAsc("station_code").orderByAsc("forecast_date");
+        List<TempShortRegulation> tempShortRegulationList = tempShortRegulationService.list(tempShortRegulationQueryWrapper);
+        if (tempShortRegulationList.size()>0){
+            // 排序调控日期、调控场站、上报预测日期
+            tempShortRegulationList.sort(Comparator.comparing(TempShortRegulation::getTkDate).thenComparing(TempShortRegulation::getStationCode).thenComparing(TempShortRegulation::getForecastDate));
+        }
+        List<Map<String, Object>> tableList = new ArrayList();
+        List<SysUser> sysUserList = iSysUserService.findAll();
+        // 封装列表数据
+        for (TempShortRegulation tempShortRegulation : tempShortRegulationList) {
+            Map<String, Object> map = new HashMap<>();
+            map.put("tkDate", DateUtil.format(tempShortRegulation.getTkDate(), "yyyy-MM-dd"));
+            map.put("stationCode", tempShortRegulation.getStationCode());
+            map.put("forecastDate", DateUtil.format(tempShortRegulation.getForecastDate(), "yyyy-MM-dd"));
+            map.put("regulationStatusEnum", RegulationStatusEnum.valueOf(tempShortRegulation.getRegulationStatusEnum()).getMessage());
+            map.put("sbzt", "成功");
+            // 根据账号获取昵称
+            Optional<SysUser> sysUserOptional = sysUserList.stream().filter(sysUser -> sysUser.getUserName().equals(tempShortRegulation.getCreateBy())).findFirst();
+            if (sysUserOptional.isPresent()) {
+                map.put("createBy", sysUserOptional.get().getNickName());
+            }
+            else{
+                map.put("createBy", tempShortRegulation.getCreateBy());
+            }
+            tableList.add(map);
+        }
+
+
+
+        return R.ok(tableList);
+    }
 }

+ 20 - 0
cpp-admin/src/main/java/com/cpp/web/domain/enums/RegulationStatusEnum.java

@@ -0,0 +1,20 @@
+package com.cpp.web.domain.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 调控状态枚举
+ *
+ * @author jy
+ * @since 2024/10/21
+ */
+@Getter
+@AllArgsConstructor
+public enum RegulationStatusEnum {
+    E1(1, "已下发"),
+    E2(2, "未下发");
+
+    private Integer code;
+    private String message;
+}

+ 4 - 0
cpp-admin/src/main/java/com/cpp/web/domain/regulation/TempShortRegulation.java

@@ -42,4 +42,8 @@ public class TempShortRegulation extends BaseCppEntity {
     @TableField(value = "create_by" , fill = FieldFill.INSERT)
     private String createBy;
 
+    /**
+     * 调控下发状态 1:已下发,2:未下发
+     */
+    private String regulationStatusEnum;
 }

+ 4 - 0
cpp-system/src/main/java/com/cpp/system/mapper/SysUserMapper.java

@@ -124,4 +124,8 @@ public interface SysUserMapper
      * @return 结果
      */
     public SysUser checkEmailUnique(String email);
+
+
+    List<SysUser> findAll();
+
 }

+ 6 - 0
cpp-system/src/main/java/com/cpp/system/service/ISysUserService.java

@@ -203,4 +203,10 @@ public interface ISysUserService
      * @return 结果
      */
     public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
+    /**
+     * 查询单表用户所有数据
+     *
+     * @return 用户信息集合信息
+     */
+    public List<SysUser> findAll();
 }

+ 9 - 0
cpp-system/src/main/java/com/cpp/system/service/impl/SysUserServiceImpl.java

@@ -547,4 +547,13 @@ public class SysUserServiceImpl implements ISysUserService
         }
         return successMsg.toString();
     }
+
+    /**
+     * 查询单表用户所有数据
+     *
+     * @return 用户信息集合信息
+     */
+    public List<SysUser> findAll(){
+        return userMapper.findAll();
+    }
 }

+ 4 - 0
cpp-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -218,4 +218,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
  	</delete>
 
+
+	<select id="findAll" resultType="com.cpp.common.core.domain.entity.SysUser">
+		SELECT * FROM sys_user
+	</select>
 </mapper>

BIN
cpp-ui/src/assets/images/camera.png


+ 4 - 0
cpp-ui/src/views/largeScreen/index.vue

@@ -471,6 +471,9 @@ export default {
   },
   methods: {
     formatNumber(num) {
+      if (Number(num)==0){
+        return 0
+      }
       // 转换为字符串以便处理
       const numStr = num.toString();
       let nums = numStr.split(".")
@@ -497,6 +500,7 @@ export default {
         // 曲线图
         let curveMap = response.data.curveMap
         this.realList = curveMap.realList
+        this.ableList = curveMap.ableList
         this.theoryList = curveMap.theoryList
         this.cdqList = curveMap.cdqList
         this.dqList = curveMap.dqList

+ 23 - 35
cpp-ui/src/views/regulation/dqRegulationRecord/index.vue

@@ -41,28 +41,28 @@
         export-config
         highlight-current-row
         show-overflow
-        :data="tableData"
-        :radio-config="{trigger: 'row'}">
+        :data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)">
         <vxe-table-column field="tkDate" title="调控日期"></vxe-table-column>
         <vxe-table-column field="stationCode" title="调控场站" :formatter="stationCodeFormat"></vxe-table-column>
-        <vxe-table-column field="time" title="上报预测日期"></vxe-table-column>
-
-        <vxe-table-column field="activePower" title="上报状态"></vxe-table-column>
-        <vxe-table-column field="reactivePower" title="调控人"></vxe-table-column>
-        <vxe-table-column field="voltage" title="电压(V)"></vxe-table-column>
-        <vxe-table-column field="electricalCurrent" title="电流(A)"></vxe-table-column>
-        <vxe-table-column field="dayElectricQuantity" title="当日发电量(kW·h)"></vxe-table-column>
-        <vxe-table-column field="cumulativeGeneratedEnergy" title="累积发电量(MW·h)"></vxe-table-column>
-        <vxe-table-column field="dayGridConnectedHours" title="当日并网小时数"></vxe-table-column>
+        <vxe-table-column field="forecastDate" title="上报预测日期"></vxe-table-column>
+        <vxe-table-column field="regulationStatusEnum" title="调控下发状态"></vxe-table-column>
+        <vxe-table-column field="sbzt" title="上报状态"></vxe-table-column>
+        <vxe-table-column field="createBy" title="调控人"></vxe-table-column>
+        <vxe-table-column field="voltage" title="策略查看">
+          <template slot-scope="scope">
+            <img src="@/assets/images/camera.png" style="width: 25px;cursor:pointer;" @click="jumpCamera(scope.row)">
+          </template>
+        </vxe-table-column>
       </vxe-table>
       <vxe-pager
-        background
-        :loading="loading"
+        perfect
         :current-page.sync="currentPage"
         :page-size.sync="pageSize"
         :total="total"
+        :page-sizes=[10,50,100]
+        :layouts="['PrevJump', 'PrevPage','JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
         @page-change="handlePageChange"
-        :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']">
+      >
       </vxe-pager>
     </div>
   </div>
@@ -107,9 +107,10 @@ export default {
   },
   computed: {},
   methods: {
+    jumpCamera(row){
+      console.log(row)
+    },
     beforeQuery(){
-      this.currentPage = 1
-      this.pageSize = 10
       // 判断日期间隔最多不能超出30天
       let startTime = Math.round(this.dateTime[0])
       let endTime = Math.round(this.dateTime[1])
@@ -119,7 +120,7 @@ export default {
         return
       }
 
-      // this.dataQuery()
+      this.dataQuery()
     },
     nameFormat({cellValue, row, column}) {
       const item = this.nameList.find(item => item.value === cellValue)
@@ -129,42 +130,29 @@ export default {
       const item = this.stationList.find(item => item.value === cellValue)
       return item ? item.label : ''
     },
-    statusFormat({cellValue, row, column}) {
-      if (cellValue == 1) {
-        return '运行'
-      } else if (cellValue == 2) {
-        return '待机'
-      } else if (cellValue == 3) {
-        return '停用'
-      } else if (cellValue == 4) {
-        return '故障'
-      }
-    },
     handlePageChange({currentPage, pageSize}) {
       this.currentPage = currentPage
       this.pageSize = pageSize
-      this.dataQuery();
     },
     dataQuery() {
       let startTime = Math.round(this.dateTime[0])
       let endTime = Math.round(this.dateTime[1])
-      if (endTime <= startTime) {
+      if (startTime>endTime) {
         this.$message.error("开始时间不能大于结束时间")
         return
       }
 
       this.loading = true
       let queryParams = {
-        "currentPage": this.currentPage,
-        "pageSize": this.pageSize,
         "stationCode": this.stationCode,
         "startTime": startTime,
         "endTime": endTime,
       }
 
-      this.$axios.get('/inverterstatusdata/getByStationCodeAndEquipmentIdAndTimeBetween', {params: queryParams}).then(response => {
-        this.tableData = response.data.records
-        this.total = response.data.total
+      this.$axios.get('/dqRegulationController/getDqRegulationRecordList', {params: queryParams}).then(response => {
+        this.tableData = response.data
+        console.log(this.tableData)
+        this.total = response.data.length
         this.loading = false
       }).catch(() => {
         this.loading = false