Selaa lähdekoodia

解析记录查询页面

fanxiaoyu 6 kuukautta sitten
vanhempi
commit
8071803d40

+ 10 - 0
cpp-admin/src/main/java/com/cpp/web/controller/configManager/ParsingLogController.java

@@ -6,6 +6,7 @@ import com.cpp.web.service.datafactory.ParsingLogService;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -37,4 +38,13 @@ public class ParsingLogController {
         page.setMaxLimit((long) -1);
         return R.ok(parsingLogService.page(page, parsingLogService.getByStationCodeAndCreateTimeAndFileStatusAndFileType(stationCode, new Date(time), new Date(time + 60 * 60 * 24 * 1000 - 1000), fileStatus, fileType)));
     }
+
+
+    @ApiOperation(value = "根据场站编号分页查询", notes = "分页查询")
+    @GetMapping("/getByStationCodeAndCreateTimeAndFileType")
+    public R getByStationCodeAndCreateTimeAndFileType(Long currentPage, Long pageSize, String stationCode, Long startTime,Long endTime, String fileType) {
+        Page page = new Page(currentPage, pageSize);
+        page.setMaxLimit((long) -1);
+        return R.ok(parsingLogService.page(page, parsingLogService.getByStationCodeAndCreateTimeAndFileType(stationCode, new Date(startTime), new Date(endTime), fileType)));
+    }
 }

+ 1 - 2
cpp-admin/src/main/java/com/cpp/web/service/datafactory/impl/ParsingLogServiceImpl.java

@@ -56,8 +56,6 @@ public class ParsingLogServiceImpl extends ServiceImpl<ParsingLogMapper, Parsing
         if (null != fileType && !"".equals(fileType)){
             wrapper.eq("file_type", fileType);
         }
-        wrapper.eq("data_sources","E1");
-        wrapper.orderByDesc("file_name");
         return wrapper;
     }
 
@@ -73,6 +71,7 @@ public class ParsingLogServiceImpl extends ServiceImpl<ParsingLogMapper, Parsing
         if (null != fileType && !"".equals(fileType)){
             wrapper.eq("file_type",fileType);
         }
+        wrapper.eq("data_sources","E1");
         List<ParsingLog> parsingLogs = parsingLogMapper.selectList(wrapper);
         return parsingLogs;
     }

+ 267 - 0
cpp-ui/src/views/statistics/analyzeRecords/index.vue

@@ -0,0 +1,267 @@
+<template>
+  <div class="app-container">
+    <el-form :inline="true" size="small" class="dark-el-input dark-el-button">
+      <el-form-item label="时间">
+        <el-date-picker
+          :clearable="false"
+          v-model="dateTime"
+          type="datetimerange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          :default-time="['00:00:00', '23:59:59']"
+          popper-class="cpp-popper"
+        />
+      </el-form-item>
+      <el-form-item label="场站名称">
+        <el-select v-model="stationCode" placeholder="请选择" style="width: 255px" popper-class="cpp-popper">
+          <el-option
+            v-for="item in stationList"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value">
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="文件类型">
+        <el-select v-model="fileTypeName" placeholder="请选择" style="width: 255px" popper-class="cpp-popper" clearable>
+          <el-option
+            v-for="item in fileType"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value">
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" size="mini" style="margin-left: 5px" icon="el-icon-search"
+                   @click="queryByStationCode">查询
+        </el-button>
+      </el-form-item>
+    </el-form>
+    <div style="padding-top: 10px">
+      <vxe-table
+        ref="xTable"
+        align="center"
+        class="mytable-style"
+        auto-resize
+        border
+        resizable
+        export-config
+        highlight-current-row
+        show-overflow
+        max-height="700"
+        :data="tableData"
+        :row-style="rowStyle">
+        <vxe-table-column field="stationCode" title="场站名称" :formatter="codeChangeName"></vxe-table-column>
+        <vxe-table-column field="dataSources" title="数据源" :formatter="changeDataSource"></vxe-table-column>
+        <vxe-table-column field="fileType" title="文件类型" :formatter="changeFileName"></vxe-table-column>
+        <vxe-table-column field="fileName" title="文件名称"></vxe-table-column>
+        <vxe-table-column field="parsingTime" title="解析时间" :formatter="formatDateTime"></vxe-table-column>
+        <vxe-table-column field="parsingFileStatus" title="文件解析状态"></vxe-table-column>
+        <vxe-table-column field="parsingDescribe" title="文件解析状态描述"></vxe-table-column>
+      </vxe-table>
+      <vxe-pager
+        background
+        :loading="loading"
+        :current-page.sync="currentPage"
+        :page-size.sync="pageSize"
+        :total="total"
+        @page-change="handlePageChange"
+        :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']">
+      </vxe-pager>
+    </div>
+  </div>
+</template>
+
+
+<script>
+export default {
+  name: 'analyzeRecords',
+  data() {
+    return {
+      dateTime: [new Date(new Date().toLocaleDateString()).getTime(), new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1],
+      fileType: [],
+      fileTypeName: '',
+      title: "",
+      total: 0,
+      pageSize: 10,
+      currentPage: 1,
+      stationList: [],
+      stationCode: '',
+      stationName: undefined,
+      tableData: [],
+      loading: false,
+      electricFieldTypeEnum: '',
+    }
+  },
+  created() {
+    this.getStationCode()
+  },
+  mounted() {
+  },
+  computed: {},
+  methods: {
+    handlePageChange({currentPage, pageSize}) {
+      this.currentPage = currentPage
+      this.pageSize = pageSize
+      this.queryByStationCode();
+    },
+    //日期转换器
+    formatDateTime(cellValue) {
+      if (cellValue.cellValue == null) {
+        return ''
+      }
+      const date = new Date(cellValue.cellValue)
+      const Y = date.getFullYear() + '-'
+      const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
+      const D = date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()
+      const h = " " + (date.getHours() < 10 ? '0' : '') + date.getHours() + ':'
+      const m = (date.getMinutes() < 10 ? '0' : '') + date.getMinutes() + ':'
+      const s = (date.getSeconds() < 10 ? '0' : '') + date.getSeconds()
+      return Y + M + D + h + m + s
+    },
+    getStationCode() {
+      this.$axios({url: '/electricfield/all', method: 'get'}).then(response => {
+        this.stationList = response.data
+        if (this.stationList.length > 0) {
+          this.stationCode = this.stationList[0].value
+          this.getElectricFieldTypeEnum()
+        }
+      })
+    },
+    getElectricFieldTypeEnum() {
+      this.loading = true
+      const param = {
+        "stationCode": this.stationCode,
+      }
+      this.$axios.get('reportData/getElectricFieldTypeEnum', {params: param}).then(response => {
+        this.electricFieldTypeEnum = response.data
+        if (this.electricFieldTypeEnum === 'E1') {
+          this.fileType = [{
+            value: 'dq',
+            label: '短期'
+          }, {
+            value: 'rdq',
+            label: '调控后短期'
+          }, {
+            value: 'cdq',
+            label: '超短期'
+          }, {
+            value: 'rcdq',
+            label: '调控后超短期'
+          }, {
+            value: 'nwp',
+            label: 'Nwp'
+          }, {
+            value: 'qxz',
+            label: '气象站'
+          }, {
+            value: 'nbq',
+            label: '逆变器'
+          }, {
+            value: 'rp',
+            label: '实发功率'
+          }, {
+            value: 'status',
+            label: '运行信息'
+          }]
+        } else {
+          this.fileType = [{
+            value: 'dq',
+            label: '短期'
+          }, {
+            value: 'rdq',
+            label: '调控后短期'
+          }, {
+            value: 'cdq',
+            label: '超短期'
+          }, {
+            value: 'rcdq',
+            label: '调控后超短期'
+          }, {
+            value: 'nwp',
+            label: 'Nwp'
+          }, {
+            value: 'cft',
+            label: '测风塔'
+          }, {
+            value: 'fj',
+            label: '风机'
+          }, {
+            value: 'rp',
+            label: '实发功率'
+          }, {
+            value: 'status',
+            label: '运行信息'
+          }]
+        }
+        this.fileTypeName = this.fileType[0].value
+        this.queryByStationCode()
+      })
+    },
+    queryByStationCode() {
+      let startTime = Math.round(this.dateTime[0])
+      let endTime = Math.round(this.dateTime[1])
+      if (endTime <= startTime) {
+        this.$message.warning("开始时间不能大于结束时间")
+        return
+      }
+      const param = {
+        "stationCode": this.stationCode,
+        "fileType": this.fileTypeName,
+        "startTime": startTime,
+        "endTime": endTime,
+        "pageSize": this.pageSize,
+        "currentPage": this.currentPage
+      }
+      this.$axios.get('/parsingLog/getByStationCodeAndCreateTimeAndFileType', {params: param}).then(response => {
+        this.tableData = response.data.records
+        this.total = response.data.total
+        this.loading = false
+      })
+    },
+    codeChangeName(row) {
+      var codeList = this.stationList
+      for (let i = 0; i < codeList.length; i++) {
+        if (row.cellValue == codeList[i].value) {
+          return codeList[i].label
+        }
+      }
+    },
+    changeDataSource(row) {
+      if (row.cellValue === "E1") {
+        return "ftp(场站端)"
+      }
+      if (row.cellValue === "E2") {
+        return "云端(中心端)"
+      }
+      if (row.cellValue === "E3") {
+        return "集中预测(控制端)"
+      }
+      if (row.cellValue === "E4") {
+        return "ftp(场站端经集中调控)"
+      }
+    },
+    changeFileName(row) {
+      for (let i = 0; i < this.fileType.length; i++) {
+        if (row.cellValue === this.fileType[i].value) {
+          return this.fileType[i].label
+        }
+      }
+    },
+    // 根据文件样式改变行样式
+    rowStyle({row, rowIndex}) {
+      if (row.parsingFileStatus === '失败') {
+        return {
+          background: 'linear-gradient(to bottom, #fa908f,#f53f3d)',
+          color: '#ffffff'
+        }
+      }
+    },
+  }
+}
+</script>
+
+<style scoped>
+</style>