Просмотр исходного кода

增加逆变器和光伏组件信息

xusl 3 лет назад
Родитель
Сommit
4d1d2beb81

+ 85 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/PvModuleModel.java

@@ -0,0 +1,85 @@
+package com.jiayue.ipfcst.common.data.entity;
+
+import com.jiayue.ipfcst.common.data.abst.AbstractBaseEntity;
+import com.jiayue.ipfcst.common.data.constant.enums.PvRotationModeEnum;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+import javax.validation.constraints.Digits;
+import java.math.BigDecimal;
+
+/**
+ * TODO
+ *
+ * @author yh
+ * @version 1.0
+ * @since 2019/12/11 12:54
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Entity
+public class PvModuleModel extends AbstractBaseEntity {
+    /**
+     * 光伏组件主键
+     * 自增
+     */
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO, generator = "myid")
+    @GenericGenerator(name = "myid", strategy = "com.jiayue.ipfcst.common.data.entity.id.CustomIDGenerator")
+    @Column
+    private Integer id;
+
+    /*型号*/
+    @Column
+    private String model;
+
+    /*单个装机容量*/
+    @Column
+    private String singleCap;
+
+    /*最大工作电压*/
+    @Column
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal maximumExcitationVoltage;
+
+    /*最大工作电流*/
+    @Column
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal maximumPowerCurrent;
+
+    /*开路电压*/
+    @Column
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal openCircuitVoltage;
+
+    /*短路电流*/
+    @Column
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal shortCircuitCurrent;
+
+    /*组件工作效率*/
+    @Column
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal efficiencyOfWork;
+
+    /*旋转方式*/
+    @Column
+    @Enumerated(EnumType.STRING)
+    private PvRotationModeEnum rotationMode;
+
+    /*安装倾斜度*/
+    @Column
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal gradient;
+
+    /*单个光伏组件面积*/
+    @Column
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal singleArea;
+
+    @Column
+    private String stationCode;
+
+}

+ 14 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/PvModuleModelRepository.java

@@ -0,0 +1,14 @@
+package com.jiayue.ipfcst.common.data.repository;
+
+import com.jiayue.ipfcst.common.data.entity.PvModuleModel;
+
+/**
+ * 场站信息仓储
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/5 9:15
+ */
+public interface PvModuleModelRepository extends BaseRepository<PvModuleModel, Integer> {
+    PvModuleModel findByModel(String model);
+}

+ 38 - 15
ipfcst-console/src/main/frontend/views/console/inverterInfo/index.vue

@@ -11,6 +11,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="getData">查询</el-button>
         <el-button type="primary" @click="insertEvent" size="small" style="round-clip: 10px" :loading="loadButton">添加</el-button>
         <el-button
           size="small"
@@ -44,6 +56,10 @@
             :edit-config="{trigger: 'manual', mode: 'row',autoClear:false,showStatus: true,icon:'none'}">
             <vxe-table-column title="逆变器信息" align="center">
               <vxe-table-column type="checkbox" width="3%"></vxe-table-column>
+              <vxe-table-column field="stationCode" title="场站编号" width="6%"
+                                :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
+              <vxe-table-column field="equipmentNo" width="10%" title="设备编号"
+                                :edit-render="{name:'$input',attrs:{type:'text'}}"></vxe-table-column>
               <vxe-table-column field="name" title="名称" width="8%" align="center"
                                 :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
               <vxe-table-column field="modelNumber" title="型号" width="8%" align="center"
@@ -184,6 +200,8 @@
         callback()
       }
       return {
+        stationCode: '',
+        stationList: [],
         id:'',
         currentPage: 1,
         pageSize: 10,
@@ -266,7 +284,8 @@
     },
 
     created() {
-      this.getData(this.currentPage, this.pageSize)
+      this.getStationList()
+      this.getData()
     },
     activated() {
       console.log("2激活activated钩子函数");
@@ -275,17 +294,21 @@
       console.log("2激活deactivated钩子函数");
     },
     methods: {
-      getData(currentPage, pageSize) {
+      getStationList() {
+        this.$axios.get('/electricField/getElectricField').then((res) => {
+          this.stationList = res.data
+        }).catch((error) => {
+          this.$message.error('获取场站下拉框出错' + error)
+        })
+      },
+      getData() {
         this.loading = true
-        let url = currentPage + '/' + pageSize
+        let queryParam = this.stationCode;
+        if (queryParam==''){
+          queryParam="ALL"
+        }
+        let url = this.currentPage + '/' + this.pageSize + '/' + queryParam
         this.$axios.get('/inverterInfo/' + url).then(res => {
-          if (res.data.content == "") {
-            this.showTable = false
-
-          } else {
-            this.showTable = true
-          }
-
           this.tableData = res.data.content
           this.total = res.data.totalElements
           this.loading = false
@@ -298,7 +321,7 @@
       handlePageChange({currentPage, pageSize}) {
         this.currentPage = currentPage
         this.pageSize = pageSize
-        this.getData(this.currentPage, this.pageSize)
+        this.getData()
       },
       getPvData() {
         this.$axios.get('/pvModuleModel/').then(res => {
@@ -432,7 +455,7 @@
                           type: 'success'
                         })
                         this.loadButton = false
-                        this.getData(this.currentPage, this.pageSize)
+                        this.getData()
                       }).catch((error) => {
                         this.$refs.xTable.setActiveRow(row)
                         this.$message.error('保存逆变器出错' + error)
@@ -456,7 +479,7 @@
                       type: 'success'
                     })
                     this.loadButton = false;
-                    this.getData(this.currentPage, this.pageSize)
+                    this.getData()
                   }).catch((error) => {
                     this.$refs.xTable.setActiveRow(row)
                     this.$message.error('修改逆变器出错' + error)
@@ -469,7 +492,7 @@
                       type: 'success'
                     })
                     this.loadButton = false;
-                    this.getData(this.currentPage, this.pageSize)
+                    this.getData()
                   }).catch((error) => {
                     this.$refs.xTable.setActiveRow(row)
                     this.$message.error('保存逆变器出错' + error)
@@ -511,7 +534,7 @@
             type: 'success'
           })
           this.delVisible = false
-          this.getData(this.currentPage, this.pageSize)
+          this.getData()
         }).catch((error) => {
           this.$message.error('删除逆变器信息出错' + error)
         })

+ 34 - 12
ipfcst-console/src/main/frontend/views/console/pvModuleModel/index.vue

@@ -15,10 +15,21 @@
                         <el-button :loading="loadButton"   type="text">导入数据</el-button>
                     </el-upload>-->
         </div>
-
-        <div class="filter-container">
+        <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="getData">查询</el-button>
+<!--        <div class="filter-container">-->
           <el-button type="primary" size="small" style="round-clip: 10px" @click="insertEvent" :loading="loadButton">添加</el-button>
-        </div>
+<!--        </div>-->
         <div style="padding-top: 10px">
           <vxe-table
             ref="xTable"
@@ -36,6 +47,8 @@
             :edit-config="{trigger: 'manual', mode: 'row',autoClear:false,showStatus: true,icon:'none'}"
           >
             <vxe-table-column title="光伏组件信息" align="center">
+              <vxe-table-column field="stationCode" title="场站编号" width="6%"
+                                :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
               <vxe-table-column
                 field="model"
                 title="组件型号"
@@ -215,6 +228,8 @@
         callback()
       }
       return {
+        stationCode: '',
+        stationList: [],
         id:'',
         total:0,
         pageSize: 10,
@@ -283,20 +298,27 @@
       }
     },
     created() {
-      this.getData(this.currentPage, this.pageSize)
+      this.getStationList()
+      this.getData()
     },
 
     methods: {
-      getData(currentPage, pageSize) {
+      getStationList() {
+        this.$axios.get('/electricField/getElectricField').then((res) => {
+          this.stationList = res.data
+        }).catch((error) => {
+          this.$message.error('获取场站下拉框出错' + error)
+        })
+      },
+      getData() {
         this.loading = true
-        this.$axios.get('/pvModuleModel/' + currentPage + '/' + pageSize,).then((res) => {
+        let queryParam = this.stationCode;
+        if (queryParam==''){
+          queryParam="ALL"
+        }
+        this.$axios.get('/pvModuleModel/' + this.currentPage + '/' + this.pageSize + '/' + queryParam).then((res) => {
           this.tableData = res.data.content
-          if(res.data.content==''){
-            this.showTable = false
-          }else{
-            this.showTable = true
-          }
-          this.total = res.data.count
+          this.total = res.data.totalElements
           // console.log('获取光伏组件信息成功')
           this.getPvRotationMode()
           this.loading = false

+ 146 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/InverterInfoController.java

@@ -0,0 +1,146 @@
+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.constant.enums.EquipmentTypeEnum;
+import com.jiayue.ipfcst.common.data.entity.InverterInfo;
+import com.jiayue.ipfcst.common.data.entity.WindTurbineInfo;
+import com.jiayue.ipfcst.console.service.InverterInfoService;
+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/28 10:12
+ */
+@RestController
+@Slf4j
+public class InverterInfoController {
+
+    private final InverterInfoService inverterInfoService;
+
+    @Autowired
+    public InverterInfoController(InverterInfoService inverterInfoService) {
+        this.inverterInfoService = inverterInfoService;
+    }
+
+    /**
+     * 获取逆变器(分页)
+     *
+     * @return 执行结果
+     */
+    @GetMapping(value = {"inverterInfo/{page}/{size}/{stationCode}"})
+    public ResponseVO getPageAll(@PathVariable("page") Integer page, @PathVariable("size") Integer size, @PathVariable("stationCode") String stationCode) {
+      InverterInfo inverterInfo = new InverterInfo();
+      if (!"ALL".equals(stationCode)) {
+        inverterInfo.setStationCode(stationCode);
+      }
+      Page<InverterInfo> inverterPage = this.inverterInfoService.get(inverterInfo, page, size);
+      return ResponseVO.success(inverterPage);
+    }
+
+    /**
+     * 获取逆变器
+     *
+     * @return 执行结果
+     */
+    @GetMapping(value = {"inverterInfo"})
+    public ResponseVO getAll() {
+      List<InverterInfo> list = this.inverterInfoService.getAll();
+      return ResponseVO.success(list);
+    }
+
+    /**
+     * 保存逆变器信息
+     *
+     * @param inverterInfo 参数
+     * @return 执行结果
+     */
+    @SaveValidate
+    @PostMapping(value = "inverterInfo/")
+    public ResponseVO saveInverter(@RequestBody InverterInfo inverterInfo) {
+        try {
+            inverterInfoService.save(inverterInfo);
+            return ResponseVO.success();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(" 保存逆变器信息异常");
+            return ResponseVO.fail();
+        }
+
+    }
+
+    /**
+     * 批量保存逆变器信息
+     *
+     * @param inverterInfo 参数
+     * @return 执行结果
+     */
+    @SaveValidate
+    @PostMapping(value = "inverterInfo/saveAll/{startValue}/{endValue}")
+    public ResponseVO allSaveInverter(@RequestBody InverterInfo inverterInfo,@PathVariable("startValue") Integer startValue,@PathVariable("endValue") Integer endValue) {
+        try {
+          inverterInfoService.addALL(inverterInfo,startValue,endValue);
+            return ResponseVO.success();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(" 保存逆变器信息异常");
+            return ResponseVO.fail();
+        }
+    }
+
+
+    /**
+     * 更新逆变器信息
+     *
+     * @param inverterInfo 参数
+     * @return 执行结果
+     */
+    @SaveValidate
+    @PutMapping(value = "inverterInfo/")
+    public ResponseVO updateInverter(@RequestBody InverterInfo inverterInfo) {
+        try {
+            inverterInfoService.save(inverterInfo);
+            return ResponseVO.success();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(" 更新逆变器信息异常");
+            return ResponseVO.fail();
+        }
+
+    }
+
+
+    /**
+     * 删除逆变器信息
+     *
+     * @param ids 删除id
+     * @return 执行结果
+     */
+    @SaveValidate
+    @DeleteMapping(value = "inverterInfo/{ids}")
+    public ResponseVO deleteInverter(@PathVariable("ids") String ids) {
+        try {
+            inverterInfoService.delete(ids);
+            return ResponseVO.success();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(" 删除逆变器异常");
+            return ResponseVO.fail();
+        }
+
+    }
+
+
+}
+
+
+
+

+ 165 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/PvModuleModelController.java

@@ -0,0 +1,165 @@
+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.constant.enums.PvRotationModeEnum;
+import com.jiayue.ipfcst.common.data.entity.InverterInfo;
+import com.jiayue.ipfcst.common.data.entity.PvModuleModel;
+import com.jiayue.ipfcst.console.service.PvModuleModelService;
+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.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 光伏组件信息restful接口
+ *
+ * @author tl
+ * @version 3.0
+ * @since 2020/6/28 10:12
+ */
+@RestController
+@Slf4j
+public class PvModuleModelController {
+
+    private final PvModuleModelService pvModuleModelService;
+
+    @Autowired public PvModuleModelController(PvModuleModelService pvModuleModelService) {
+        this.pvModuleModelService = pvModuleModelService;
+    }
+
+
+    /**
+     * 分页获取光伏组件信息
+     * @param size 条数
+     * @param page 页码
+     * @return 光伏组件信息
+     */
+
+    @GetMapping(value="pvModuleModel/{page}/{size}/{stationCode}")
+    public ResponseVO getPvModuleModel(@PathVariable("page")  Integer page,
+                                       @PathVariable("size")  Integer size, @PathVariable("stationCode") String stationCode) {
+      PvModuleModel pvModuleModel = new PvModuleModel();
+      if (!"ALL".equals(stationCode)) {
+        pvModuleModel.setStationCode(stationCode);
+      }
+
+      Page<PvModuleModel> pvModuleModelPage = this.pvModuleModelService.get(pvModuleModel, page, size);
+      return ResponseVO.success(pvModuleModelPage);
+    }
+
+
+    /**
+     * 获取光伏组件信息
+     *
+     * @return 光伏组件信息
+     */
+
+    @GetMapping(value="pvModuleModel/")
+    public ResponseVO getAll() {
+
+        try{
+            List<PvModuleModel> ps =  this.pvModuleModelService.getAll();
+
+            return ResponseVO.success(ps);
+        }catch (Exception e){
+            e.printStackTrace();
+            log.error(" 获取所有光伏组件异常");
+            return ResponseVO.success(null);
+        }
+
+    }
+
+    /**
+     * 保存光伏组件信息
+     *
+     * @param pvModuleModel 参数
+     * @return 执行结果
+     */
+    @SaveValidate
+    @PostMapping(value = "pvModuleModel/")
+    public ResponseVO savePvModuleModel(@RequestBody PvModuleModel pvModuleModel) {
+        try {
+            pvModuleModelService.save(pvModuleModel);
+            return ResponseVO.success();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(" 保存光伏组件信息异常");
+            return ResponseVO.fail();
+        }
+
+    }
+
+    /**
+     * 更新光伏组件信息
+     *
+     * @param pvModuleModel 参数
+     * @return 执行结果
+     */
+    @SaveValidate
+    @PutMapping(value = "pvModuleModel/")
+    public ResponseVO updatePvModuleModel(@RequestBody PvModuleModel pvModuleModel) {
+        try {
+            pvModuleModelService.save(pvModuleModel);
+            return ResponseVO.success();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(" 更新光伏组件信息异常");
+            return ResponseVO.fail();
+        }
+
+    }
+
+    /**
+     * 删除光伏组件信息
+     *
+     * @param ids 删除id
+     * @return 执行结果
+     */
+    @SaveValidate
+    @DeleteMapping(value="pvModuleModel/{ids}")
+    public ResponseVO deletePvModuleModel(@PathVariable("ids")String ids){
+        try{
+            pvModuleModelService.delete(ids);
+            return ResponseVO.success();
+        }catch(Exception e){
+            e.printStackTrace();
+            log.error(" 删除光伏组件信息异常");
+            return ResponseVO.fail();
+        }
+
+    }
+
+  /**
+   * 获取光伏组件旋转方式枚举
+   *
+   * @return 执行结果
+   */
+    @GetMapping(value = "getPvRotationMode/")
+    public ResponseVO getPvRotationMode() {
+        List<Map<String, Object>> provinceType = new ArrayList<>();
+        Map<String, Object> map;
+        try {
+            for (PvRotationModeEnum e : PvRotationModeEnum.values()) {
+                map = new HashMap<>();
+                map.put("label", e.getMessage());
+                map.put("key", e.name());
+                map.put("value", e.name());
+                provinceType.add(map);
+            }
+            return ResponseVO.success(provinceType);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(" 获取光伏组件旋转类型异常");
+            return ResponseVO.fail(provinceType);
+        }
+
+    }
+
+
+}

+ 266 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/InverterInfoService.java

@@ -0,0 +1,266 @@
+package com.jiayue.ipfcst.console.service;
+
+import com.jiayue.ipfcst.common.core.exception.BusinessException;
+import com.jiayue.ipfcst.common.data.entity.InverterInfo;
+import com.jiayue.ipfcst.common.data.entity.WindTurbineInfo;
+import com.jiayue.ipfcst.common.data.repository.InverterInfoRepository;
+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.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import javax.persistence.criteria.Predicate;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * 逆变器业务层
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/7 10:58
+ */
+@Service
+@Slf4j
+public class InverterInfoService extends BaseService {
+    private final InverterInfoRepository inverterInfoRepository;
+
+    @Autowired
+    public InverterInfoService(InverterInfoRepository inverterInfoRepository) {
+        this.inverterInfoRepository = inverterInfoRepository;
+    }
+
+
+    /**
+     * 新增逆变器
+     *
+     * @param inverterInfo 逆变器
+     * @throws BusinessException 业务异常
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public void add(InverterInfo inverterInfo) throws BusinessException {
+        this.inverterInfoRepository.save(inverterInfo);
+    }
+
+
+    /**
+     * 批量新增逆变器
+     *
+     * @param inverterInfo 逆变器
+     * @throws BusinessException 业务异常
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public void addALL(InverterInfo inverterInfo, Integer startValue, Integer endValue) throws BusinessException {
+        for (int i = startValue; i < startValue + endValue; i++) {
+            InverterInfo inverterInfo1 = new InverterInfo();
+            inverterInfo1.setManufacturer(inverterInfo.getManufacturer());
+            inverterInfo1.setReport(inverterInfo.getReport());
+            inverterInfo1.setInstallationTime(inverterInfo.getInstallationTime());
+            inverterInfo1.setName(inverterInfo.getName() + "-" + i);
+            inverterInfo1.setBatteryModel(inverterInfo.getBatteryModel());
+            inverterInfo1.setBatteryNumber(inverterInfo.getBatteryNumber());
+            inverterInfo1.setBox(inverterInfo.getBox());
+            inverterInfo1.setCapacity(inverterInfo.getCapacity());
+            inverterInfo1.setCollectorCircuit(inverterInfo.getCollectorCircuit());
+            inverterInfo1.setEfficiency(inverterInfo.getEfficiency());
+            inverterInfo1.setGroupSeries(inverterInfo.getGroupSeries());
+            inverterInfo1.setSample(inverterInfo.getSample());
+            inverterInfo1.setModelNumber(inverterInfo.getModelNumber());
+            inverterInfo1.setInterval(inverterInfo.getInterval());
+            this.inverterInfoRepository.save(inverterInfo1);
+        }
+
+
+//        boolean b = this.inverterRepository.existsById(inverter.getNo());
+//        if (b) {// 逆变器编号已存在
+//            throw new BusinessException("逆变器编号已存在!");
+//        } else {
+//
+//        }
+    }
+
+    /**
+     * 修改逆变器
+     *
+     * @param inverterInfo 逆变器
+     * @throws BusinessException 业务异常
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public void update(InverterInfo inverterInfo) throws BusinessException {
+        if (StringUtils.isEmpty(inverterInfo.getId())) {
+            throw new BusinessException("逆变器编号不能为空!");
+        } else {
+            this.inverterInfoRepository.save(inverterInfo);
+        }
+    }
+
+    /**
+     * 删除逆变器
+     *
+     * @param id 逆变器编号
+     * @throws BusinessException 业务异常
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public void delete(final Integer id) throws BusinessException {
+        if (StringUtils.isEmpty(id)) {
+            throw new BusinessException("逆变器编号不能为空!");
+        } else {
+            this.inverterInfoRepository.deleteById(id);
+        }
+    }
+
+    /**
+     * 查询逆变器
+     *
+     * @param id 逆变器编号
+     * @return 逆变器
+     * @throws BusinessException 业务异常
+     */
+    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+    public InverterInfo get(final Integer id) throws BusinessException {
+        Optional<InverterInfo> optional = this.inverterInfoRepository.findById(id);
+        if (optional.isPresent()) {
+            return optional.get();
+        } else {
+            throw new BusinessException("逆变器不存在!");
+        }
+    }
+
+    /*
+     *//**
+     * 查询逆变器【分页查询】
+     *
+     * @param inverter 查询条件
+     * @param page     页码
+     * @param size     每页记录数
+     * @return 分页结果
+     *//*
+    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+    public Page<Inverter> get(final Inverter inverter, final Integer page, final Integer size) {
+        ExampleMatcher matcher = ExampleMatcher.matching()
+                .withMatcher("modelNumber", ExampleMatcher.GenericPropertyMatchers.contains())
+                .withMatcher("box", ExampleMatcher.GenericPropertyMatchers.contains())
+                .withMatcher("collectorCircuit", ExampleMatcher.GenericPropertyMatchers.contains());
+        Example<Inverter> example = Example.of(inverter, matcher);
+        Pageable pageable = PageRequest.of(page - 1, size);
+        return this.inverterRepository.findAll(example, pageable);
+    }*/
+
+
+    /**
+     * 查询逆变器【分页查询】
+     *
+     * @param page 页码
+     * @param size 每页记录数
+     * @return 分页结果
+     */
+    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+    public Page<InverterInfo> get(final InverterInfo inverterInfo, final Integer page, final Integer size) {
+      ExampleMatcher matcher =
+        ExampleMatcher.matching().withMatcher("modelNumber", ExampleMatcher.GenericPropertyMatchers.contains());
+      Example<InverterInfo> example = Example.of(inverterInfo, matcher);
+      Pageable pageable = PageRequest.of(page - 1, size);
+      return this.inverterInfoRepository.findAll(example, pageable);
+    }
+
+    /**
+     * 查询逆变器【分页查询】
+     * @return 分页结果
+     */
+    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+    public List<InverterInfo> getAll() {
+        return inverterInfoRepository.findAll();
+    }
+
+
+    /**
+     * 查询所有样板机逆变器 create by xiuwei
+     *
+     * @return 逆变器信息
+     */
+    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+    public List<InverterInfo> getAllSample() {
+        InverterInfo inverterInfo = new InverterInfo();
+        inverterInfo.setSample(true);
+        return inverterInfoRepository.findAll(Example.of(inverterInfo));
+    }
+
+
+    /**
+     * 查询条件
+     *
+     * @param sample 是否样板机
+     * @return 查询条件
+     */
+    private Specification<InverterInfo> getDemoQuerySpecification(Boolean sample) {
+        return (Specification<InverterInfo>) (root, criteriaQuery, cb) -> {
+            List<Predicate> predicates = new ArrayList<>();
+            if (null != sample) {
+                predicates.add(cb.equal(root.get("sample").as(Boolean.class), sample));
+            }
+
+            return cb.and(predicates.toArray(new Predicate[predicates.size()]));
+        };
+    }
+
+
+    /**
+     * 保存光伏组件信息
+     *
+     * @param inverterInfo 光伏组件信息
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public void save(InverterInfo inverterInfo) {
+        this.inverterInfoRepository.save(inverterInfo);
+    }
+
+    /**
+     * 删除逆变器信息
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public boolean delete(String ids) {
+        boolean flag = false;
+        if (!StringUtils.isEmpty(ids)) {
+            String[] idArray = ids.split(",");
+            if (idArray != null && idArray.length > 0) {
+                for (String id : idArray) {
+                    this.inverterInfoRepository.deleteById(Integer.valueOf(id));
+                    log.info("删除逆变器ID为[" + id + "]成功!");
+
+                }
+                flag = true;
+            } else {
+                this.inverterInfoRepository.deleteById(Integer.valueOf(ids));
+                flag = true;
+                log.info("删除逆变器ID为[" + ids + "]成功!");
+            }
+        }
+
+        return flag;
+
+    }
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+    public void saveCloud(InverterInfo bean) {
+//        InverterInfo inverterInfo = inverterInfoRepository.findByName(bean.getName());
+//        if (null != inverterInfo) {
+//            bean.setId(inverterInfo.getId());
+//        }
+        inverterInfoRepository.save(bean);
+    }
+
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+    public void saveCloud(List<InverterInfo> beans) {
+        if(beans != null && beans.size() > 0){
+            inverterInfoRepository.deleteAll();
+            inverterInfoRepository.saveAll(beans);
+        }
+    }
+}

+ 131 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/PvModuleModelService.java

@@ -0,0 +1,131 @@
+package com.jiayue.ipfcst.console.service;
+
+import com.jiayue.ipfcst.common.data.entity.InverterInfo;
+import com.jiayue.ipfcst.common.data.entity.PvModuleModel;
+import com.jiayue.ipfcst.common.data.repository.PvModuleModelRepository;
+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 org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 场站信息业务层
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/7 9:53
+ */
+@Service
+@Slf4j
+public class PvModuleModelService extends BaseService {
+
+    private final PvModuleModelRepository pvModuleModelRepository;
+
+    @Autowired
+    public PvModuleModelService(PvModuleModelRepository pvModuleModelRepository) {
+        this.pvModuleModelRepository = pvModuleModelRepository;
+    }
+
+    /**
+     * 获取所有光伏组件信息
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public List<PvModuleModel> getAll() {
+        return this.pvModuleModelRepository.findAll();
+    }
+
+    /**
+     * 保存光伏组件信息
+     *
+     * @param pvModuleModel 光伏组件信息
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public void save(PvModuleModel pvModuleModel) {
+        this.pvModuleModelRepository.save(pvModuleModel);
+    }
+
+    /**
+     * 删除场站信息
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public boolean delete(String ids) {
+        boolean flag = false;
+        if (!StringUtils.isEmpty(ids)) {
+            String[] idArray = ids.split(",");
+            if (idArray != null && idArray.length > 0) {
+                for (String id : idArray) {
+                    this.pvModuleModelRepository.deleteById(Integer.valueOf(id));
+                    log.info("删除光伏组件ID为[" + id + "]成功!");
+
+                }
+                flag = true;
+            } else {
+                this.pvModuleModelRepository.deleteById(Integer.valueOf(ids));
+                flag = true;
+                log.info("删除光伏组件ID为[" + ids + "]成功!");
+            }
+        }
+
+        return flag;
+
+    }
+
+    /**
+     * 查询场站信息
+     *
+     * @return 场站信息
+     */
+    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+    public Map<String, Object> get(@RequestParam(defaultValue = "1") Integer page,
+                                   @RequestParam(defaultValue = "10") Integer size) {
+        Map<String, Object> map = new HashMap<>();
+        Sort sort = Sort.by(Sort.Direction.ASC, "id");
+        Pageable pageable = PageRequest.of(page - 1, size, sort); //页码:前端从1开始,jpa从0开始,做个转换
+        Page pagepvModuleModel = pvModuleModelRepository.findAll(pageable);
+        map.put("content", pagepvModuleModel.getContent());// 结果集
+        map.put("count", pagepvModuleModel.getTotalElements());// 总记录数
+        return map;
+    }
+
+  /**
+   * 查询逆变器【分页查询】
+   *
+   * @param page 页码
+   * @param size 每页记录数
+   * @return 分页结果
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public Page<PvModuleModel> get(final PvModuleModel pvModuleModel, final Integer page, final Integer size) {
+    ExampleMatcher matcher =
+      ExampleMatcher.matching().withMatcher("modelNumber", ExampleMatcher.GenericPropertyMatchers.contains());
+    Example<PvModuleModel> example = Example.of(pvModuleModel, matcher);
+    Pageable pageable = PageRequest.of(page - 1, size);
+    return this.pvModuleModelRepository.findAll(example, pageable);
+  }
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+    public void saveCloud(PvModuleModel bean) {
+//        PvModuleModel beanOld = pvModuleModelRepository.findByModel(bean.getModel());
+//        if (null != beanOld) {
+//            bean.setId(beanOld.getId());
+//        }
+        pvModuleModelRepository.save(bean);
+    }
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+    public void saveCloud(List<PvModuleModel> beans) {
+        if(beans != null && beans.size() > 0){
+            pvModuleModelRepository.deleteAll();
+            pvModuleModelRepository.saveAll(beans);
+        }
+    }
+}