xusl 3 роки тому
батько
коміт
a2f210bfc3

+ 0 - 9
ipfcst-console/src/main/frontend/views/console/weatherStationInfo/index.vue

@@ -17,7 +17,6 @@
           <span style="float: left">{{ item.name }}</span>
           <span style="float: right; color: #8492a6;font-size: 13px">{{ item.stationCode }}</span>
         </el-option>
-
       </el-select>
       <el-button type="primary" icon="el-icon-search" size="small" @click="queryInfo">查询</el-button>
       <el-button type="primary" size="small" @click="insertEvent" style="round-clip: 10px"
@@ -206,7 +205,6 @@
     },
     created() {
       this.getStationList()
-      // this.getAll()
     },
     methods: {
       // 查询
@@ -221,13 +219,6 @@
           queryParam="ALL"
         }
         this.$axios.get('/weatherStationInfo/' + queryParam).then(response => {
-          if (response.data.content == "") {
-            this.showTable = false
-
-          } else {
-            this.showTable = true
-          }
-
           this.tableData = response.data
           this.loading = false
           this.btnLonding = false

+ 35 - 34
ipfcst-console/src/main/frontend/views/console/windTowerInfo/index.vue

@@ -7,6 +7,18 @@
                    @click="exportDataEvent">导出数据
         </el-button>
       </div>
+      <span style="font-weight: bold;font-size: 14px">场站名称:</span>
+      <el-select style="width:250px" clearable v-model="stationCode" size="small" >
+        <el-option
+          v-for="item in stationList"
+          :key="item.stationCode"
+          :label="item.name"
+          :value="item.stationCode">
+          <span style="float: left">{{ item.name }}</span>
+          <span style="float: right; color: #8492a6;font-size: 13px">{{ item.stationCode }}</span>
+        </el-option>
+      </el-select>
+      <el-button type="primary" icon="el-icon-search" size="small" @click="queryInfo">查询</el-button>
       <el-button type="primary" size="small" @click="insertEvent" style="round-clip: 10px"
                  :loading="btnLonding">新增</el-button>
       <div style="padding-top: 10px">
@@ -26,13 +38,15 @@
           :edit-config="{trigger: 'manual', mode: 'row',autoClear: false,icon:'none'}"
         >
           <vxe-table-column title="测风塔信息">
+            <vxe-table-column field="stationCode" title="场站编号" width="6%"
+                              :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
             <vxe-table-column field="name" title="名称"  width="13%"
                               :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
             <vxe-table-column field="manufacturer" title="生产商"  width="13%"
                               :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
             <vxe-table-column field="modelNumber" title="型号"  width="10%"
                               :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
-            <vxe-table-column min-width="50px"  width="14%" field="installationTime" title="安装时间"
+            <vxe-table-column min-width="50px"  width="10%" field="installationTime" title="安装时间"
                               :edit-render="{props: {type: 'default'}}">
               <template v-slot:edit="{ row }">
                 <el-date-picker
@@ -97,17 +111,6 @@
             </vxe-table-column>
           </vxe-table-column>
         </vxe-table>
-        <vxe-pager
-          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"
-          v-show="!btnLonding&&showTable"
-        >
-        </vxe-pager>
       </div>
 
     </el-card>
@@ -163,6 +166,8 @@
         }
       }
       return {
+        stationCode: '',
+        stationList: [],
         bindTunnels:[],
         id:'',
         equipmentTypeList:[],
@@ -208,24 +213,18 @@
       }
     },
     created() {
-      this.getAll()
+      this.getStationList()
     },
     methods: {
-      getAll() {
-        this.$axios.get('/TunnelInfo/findbyMaster').then(res => {
-          this.bindTunnels = res.data
-        })
+      // 查询
+      queryInfo() {
         this.loading = true
         this.saveLoding = false
-        this.$axios.get('/windTowerInfo/' + this.currentPage + '/' + this.pageSize,).then(response => {
-          if (response.data.content == "") {
-            this.showTable = false
-
-          } else {
-            this.showTable = true
-          }
-          // window.console.log(this.equipmentTypeList)
-          this.tableData = response.data.content
+        let queryParam = this.stationCode;
+        if (queryParam==''){
+          queryParam="ALL"
+        }
+        this.$axios.get('/windTowerInfo/' + queryParam).then(response => {
           for (let i = 0; i < this.tableData.length; i++) {
             //添加省调枚举标识转换
             for (let j = 0; j < this.equipmentTypeList.length; j++) {
@@ -234,11 +233,18 @@
               }
             }
           }
-          this.total = response.data.totalElements
+          this.tableData = response.data
           this.loading = false
           this.btnLonding = false
         })
       },
+      getStationList() {
+        this.$axios.get('/electricField/getElectricField').then((res) => {
+          this.stationList = res.data
+        }).catch((error) => {
+          this.$message.error('获取场站下拉框出错' + error)
+        })
+      },
       editRowEvent(row) {
         this.id = row.id
         this.btnLonding = true
@@ -250,14 +256,14 @@
           if (valid) {
             if (row.id == undefined) {
               this.$axios.post('windTowerInfo/',row).then(response => {
-                this.getAll()
+                this.queryInfo()
                 this.btnLonding = false
                 this.$XModal.message({status: 'warning', message: response.message})
               })
             } else {
               row.equipmentType = row.equipmentType.code
               this.$axios.put('windTowerInfo/',row).then(response => {
-                this.getAll()
+                this.queryInfo()
                 this.$XModal.message({status: 'warning', message: response.message})
                 this.saveLoding = false
               })
@@ -310,11 +316,6 @@
         this.$refs.xTable.insert({interval: 60})
           .then(({row}) => this.$refs.xTable.setActiveRow(row))
       },
-      handlePageChange({currentPage, pageSize}) {
-        this.currentPage = currentPage
-        this.pageSize = pageSize
-        this.getAll()
-      },
       exportDataEvent() {
         this.loading = true
         this.$axios.get('/windTowerInfo/').then(res => {

+ 103 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WindTowerInfoController.java

@@ -0,0 +1,103 @@
+package com.jiayue.ipfcst.console.controller;
+
+import com.jiayue.ipfcst.aop.SaveValidate;
+import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
+import com.jiayue.ipfcst.common.data.entity.WeatherStationInfo;
+import com.jiayue.ipfcst.common.data.entity.WindTowerInfo;
+import com.jiayue.ipfcst.console.service.WindTowerInfoService;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 测风塔restful接口
+ *
+ * @author tl
+ * @version 3.0
+ * @since 2020/6/7 11:29
+ */
+@RestController
+@RequestMapping("windTowerInfo")
+@Slf4j public class WindTowerInfoController {
+
+    private final WindTowerInfoService windTowerInfoService;
+
+    @Autowired public WindTowerInfoController(WindTowerInfoService windTowerInfoService) {
+        this.windTowerInfoService = windTowerInfoService;
+    }
+
+    /**
+     * 新增测风塔
+     *
+     * @param windTowerInfo 参数
+     * @return 执行结果
+     */
+    @SneakyThrows
+    @SaveValidate
+    @PostMapping() public ResponseVO add(@RequestBody WindTowerInfo windTowerInfo) {
+        try {
+            this.windTowerInfoService.add(windTowerInfo);
+            return ResponseVO.success(1);
+        } catch (Exception ex) {
+            log.error("系统错误" + ex);
+            return ResponseVO.error(ex);
+        }
+
+    }
+
+    /**
+     * 修改测风塔
+     *
+     * @param windTowerInfo 参数
+     * @return 执行结果
+     */
+    @SneakyThrows
+    @SaveValidate
+    @PutMapping() public ResponseVO update(@RequestBody WindTowerInfo windTowerInfo) {
+        this.windTowerInfoService.update(windTowerInfo);
+        return ResponseVO.success(1);
+    }
+
+    /**
+     * 删除测风塔
+     *
+     * @param id 参数
+     * @return 执行结果
+     */
+    @SneakyThrows
+    @SaveValidate
+    @DeleteMapping("/{id}") public ResponseVO delete(@PathVariable Integer id) {
+        this.windTowerInfoService.delete(id);
+        return ResponseVO.success(1);
+    }
+
+    /**
+     * 获取测风塔
+     *
+     * @param stationCode 参数
+     * @return 执行结果
+     */
+    @SneakyThrows
+    @GetMapping(value = "/{stationCode}")
+    public ResponseVO getAll(@PathVariable("stationCode") String stationCode) {
+      List<WindTowerInfo> windTowerPage = this.windTowerInfoService.get(stationCode);
+        return ResponseVO.success(windTowerPage);
+    }
+
+    /**
+     * 获取测风塔
+     *
+     * @return 执行结果
+     */
+    @SneakyThrows
+    @GetMapping(value = "")
+    public ResponseVO getAll() {
+
+      List<WindTowerInfo> list = this.windTowerInfoService.getAll();
+      return ResponseVO.success(list);
+    }
+}

+ 149 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/WindTowerInfoService.java

@@ -0,0 +1,149 @@
+package com.jiayue.ipfcst.console.service;
+
+import com.jiayue.ipfcst.common.core.exception.BusinessException;
+import com.jiayue.ipfcst.common.data.entity.WeatherStationInfo;
+import com.jiayue.ipfcst.common.data.entity.WindTowerInfo;
+import com.jiayue.ipfcst.common.data.repository.WindTowerInfoRepository;
+import com.jiayue.ipfcst.common.data.service.BaseService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.*;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+/**
+ * 测风塔业务层
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/7 10:58
+ */
+@Service
+@Slf4j
+public class WindTowerInfoService extends BaseService {
+  private final WindTowerInfoRepository windTowerInfoRepository;
+
+  @Autowired
+  public WindTowerInfoService(WindTowerInfoRepository windTowerInfoRepository) {
+    this.windTowerInfoRepository = windTowerInfoRepository;
+  }
+
+  /**
+   * 新增测风塔
+   *
+   * @param windTowerInfo 测风塔
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public void add(WindTowerInfo windTowerInfo) throws BusinessException {
+
+    try {
+      this.windTowerInfoRepository.save(windTowerInfo);
+    } catch (Exception e) {
+      log.error("系统错误" + e);
+    }
+
+  }
+
+  /**
+   * 修改测风塔
+   *
+   * @param windTowerInfo 测风塔
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public void update(WindTowerInfo windTowerInfo)
+    throws BusinessException {
+    if (StringUtils.isEmpty(windTowerInfo.getId())) {
+      throw new BusinessException("测风塔编号不能为空!");
+    } else {
+      this.windTowerInfoRepository.save(windTowerInfo);
+    }
+  }
+
+  /**
+   * 删除测风塔
+   *
+   * @param no 测风塔编号
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public void delete(final Integer no) throws BusinessException {
+    if (StringUtils.isEmpty(no)) {
+      throw new BusinessException("测风塔编号不能为空!");
+    } else {
+      this.windTowerInfoRepository.deleteById(no);
+    }
+  }
+
+  /**
+   * 查询测风塔
+   *
+   * @param stationCode 场站编号
+   * @return
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public List<WindTowerInfo> get(String stationCode) {
+    List<WindTowerInfo> resultList = new ArrayList<>();
+    resultList =  this.windTowerInfoRepository.findAll();
+    if (!"ALL".equals(stationCode)){
+      resultList = resultList.stream().filter(s->s.getStationCode().equals(stationCode)).collect(Collectors.toList());
+    }
+    return resultList.stream().sorted(Comparator.comparing(WindTowerInfo::getStationCode)).collect(Collectors.toList());
+  }
+
+
+  /**
+   * 获取到所有的测风塔   create by xiuwei
+   *
+   * @return List<WindTowerInfo>  测风塔列表
+   */
+  public List<WindTowerInfo> getAll() {
+    return windTowerInfoRepository.findAll();
+  }
+
+
+  /**
+   * 查询测风塔【分页查询】
+   *
+   * @param windTower 查询条件
+   * @param page      页码
+   * @param size      每页记录数
+   * @return 分页结果
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public Page<WindTowerInfo> get(
+    final WindTowerInfo windTower, final Integer page, final Integer size) {
+    ExampleMatcher matcher =
+      ExampleMatcher.matching().withMatcher("modelNumber", ExampleMatcher.GenericPropertyMatchers.contains());
+    Example<WindTowerInfo> example = Example.of(windTower, matcher);
+    Pageable pageable = PageRequest.of(page - 1, size);
+    return this.windTowerInfoRepository.findAll(example, pageable);
+  }
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+  public void saveCloud(WindTowerInfo bean) {
+//        WindTowerInfo windTowerInfo = windTowerInfoRepository.findByName(bean.getName());
+//        if (null != windTowerInfo) {
+//            bean.setId(windTowerInfo.getId());
+//        }
+    windTowerInfoRepository.save(bean);
+  }
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+  public void saveCloud(List<WindTowerInfo> beans) {
+    if(beans != null && beans.size() > 0){
+      windTowerInfoRepository.deleteAll();
+      windTowerInfoRepository.saveAll(beans);
+    }
+  }
+}