Forráskód Böngészése

新增场站信息

xusl 2 éve
szülő
commit
7b1b861e7f

+ 116 - 0
backend/src/main/java/com/jiayue/ssi/controller/ElectricFieldController.java

@@ -0,0 +1,116 @@
+package com.jiayue.ssi.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.jiayue.ssi.annotation.OperateLog;
+import com.jiayue.ssi.backenum.AuditType;
+import com.jiayue.ssi.backenum.BusinessType;
+import com.jiayue.ssi.constant.CustomException;
+import com.jiayue.ssi.entity.ElectricField;
+import com.jiayue.ssi.service.ElectricFieldService;
+import com.jiayue.ssi.util.ResponseVO;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+* 场站接口
+*
+* @author xsl
+* @since 2023/03/13
+*/
+ @RestController
+@RequestMapping("/electricField")
+@Slf4j
+public class ElectricFieldController {
+
+    @Autowired
+    ElectricFieldService electricFieldService;
+
+    /**
+     * 获取场站信息
+     *
+     * @return 场站信息
+     */
+    @GetMapping(value = "/getAll")
+    @PreAuthorize("@ss.hasPermi('biz:electric:getAll')")
+    public ResponseVO getAll() throws CustomException {
+        try {
+            ElectricField electricField = electricFieldService.getOne(new QueryWrapper<>());
+            return ResponseVO.success(electricField);
+        } catch (Exception e) {
+            throw new CustomException("获取场站信息异常", e);
+        }
+    }
+
+    /**
+     * 保存场站
+     */
+    @PostMapping
+    @OperateLog(title = "场站信息", businessType = BusinessType.UPDATE, auditType = AuditType.BIZ)
+    @PreAuthorize("@ss.hasPermi('biz:electric:update')")
+    public ResponseVO update(@RequestBody ElectricField electricField) throws CustomException {
+        try {
+            if (StringUtils.isEmpty(electricField.getStationCode())) {
+                return ResponseVO.fail("场站编号不能为空!");
+            } else if (electricField.getStationCode().length() > 6) {
+                return ResponseVO.fail(electricField.getStationCode() + "场站编号长度不能超过6个字符!");
+            }
+
+            if (StringUtils.isEmpty(electricField.getName())) {
+                return ResponseVO.fail("场站名称不能为空!");
+            } else if (electricField.getName().length() > 50) {
+                return ResponseVO.fail(electricField.getName() + "场站名称长度不能超过50个字符!");
+            }
+
+            if (StringUtils.isEmpty(electricField.getSign())) {
+                return ResponseVO.fail("场站标识不能为空!");
+            } else if (electricField.getSign().length() > 10) {
+                return ResponseVO.fail(electricField.getSign() + "场站标识长度不能超过10个字符!");
+            }
+
+
+            String pattern = "^[0-9]{1,8}+\\.{0,1}[0-9]{0,2}$";
+            if (!electricField.getCapacity().toString().matches(pattern)){
+                return ResponseVO.fail("装机容量整数位不能超过8位,小数位不能超过2位!");
+            }
+
+            if (electricField.getGridce() == null) {
+                return ResponseVO.fail("并网设备数不能为空!");
+            } else if (!String.valueOf(electricField.getGridce()).matches("^([0-9][0-9]{0,1}|100)$")) {
+                return ResponseVO.fail("并网设备数请输入0-100整数");
+            }
+
+            if (StringUtils.isEmpty(electricField.getFieldType())) {
+                return ResponseVO.fail("场站类型不能为空!");
+            } else if (electricField.getFieldType().length() > 1) {
+                return ResponseVO.fail("场站类型长度不能超过1个字符!");
+            }
+
+            if (StringUtils.isEmpty(electricField.getCompany())) {
+                return ResponseVO.fail("所属公司不能为空!");
+            } else if (electricField.getCompany().length() > 100) {
+                return ResponseVO.fail("所属公司长度不能超过100个字符!");
+            }
+
+            if (StringUtils.isEmpty(electricField.getLocation())) {
+                return ResponseVO.fail("场站位置不能为空!");
+            } else if (electricField.getLocation().length() > 100) {
+                return ResponseVO.fail("场站位置长度不能超过100个字符!");
+            }
+
+            boolean bo = electricFieldService.saveOrUpdate(electricField);
+            if (bo) {
+                return ResponseVO.success("场站信息保存成功");
+            } else {
+                log.error("场站信息保存失败");
+                return ResponseVO.fail("场站信息保存失败");
+            }
+        } catch (Exception e) {
+            throw new CustomException("场站信息保存异常", e);
+        }
+    }
+
+}

+ 0 - 4
backend/src/main/java/com/jiayue/ssi/controller/SysUserController.java

@@ -165,10 +165,6 @@ public class SysUserController {
             // 加密邮箱
             user.setMailbox(AesUtils.encryptHex(user.getMailbox()).toUpperCase());
 
-            if (user.getExpDate()!=null) {
-                System.out.println(user.getExpDate());
-            }
-
 //        // 生成8位初始密码
 //        String randomPwd = RandomPwd.getRandomPwd(8);
 //        user.setPassword(SmUtil.sm3(randomPwd).toUpperCase());

+ 58 - 0
backend/src/main/java/com/jiayue/ssi/entity/ElectricField.java

@@ -0,0 +1,58 @@
+package com.jiayue.ssi.entity;
+
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import javax.validation.constraints.Digits;
+import java.math.BigDecimal;
+
+/**
+ * 场站表
+ *
+ * @author xsl
+ * @version 3.0
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName(value = "t_electric_field")
+public class ElectricField extends BaseEntity {
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+    /**
+     * 场站编码
+     */
+    private String stationCode;
+    /**
+     * 场站名称
+     */
+    private String name;
+    /**
+     * 场站标识
+     */
+    private String sign;
+    /**
+     * 场站装机容量(MW)
+     */
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal capacity;
+    /**
+     * 并网设备数
+     */
+    private Integer gridce;
+    /**
+     * 场站类型(0光伏 1风电)
+     */
+    private String fieldType;
+    /**
+     * 场站所属公司
+     */
+    private String company;
+    /**
+     * 场站位置
+     */
+    private String location;
+}

+ 17 - 0
backend/src/main/java/com/jiayue/ssi/mapper/ElectricFieldMapper.java

@@ -0,0 +1,17 @@
+package com.jiayue.ssi.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jiayue.ssi.entity.ElectricField;
+import com.jiayue.ssi.entity.SysAlarm;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ *  场站Mapper
+ *
+ * @author xsl
+ * @since 2023-03-10
+ */
+@Mapper
+public interface ElectricFieldMapper extends BaseMapper<ElectricField> {
+
+}

+ 14 - 0
backend/src/main/java/com/jiayue/ssi/service/ElectricFieldService.java

@@ -0,0 +1,14 @@
+package com.jiayue.ssi.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.jiayue.ssi.entity.ElectricField;
+
+
+/**
+* 场站接口
+* @author xsl
+* @date 2023/2/16
+*/
+public interface ElectricFieldService extends IService<ElectricField> {
+
+}

+ 17 - 0
backend/src/main/java/com/jiayue/ssi/service/impl/ElectricFieldServiceImpl.java

@@ -0,0 +1,17 @@
+package com.jiayue.ssi.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jiayue.ssi.entity.ElectricField;
+import com.jiayue.ssi.mapper.ElectricFieldMapper;
+import com.jiayue.ssi.service.ElectricFieldService;
+import org.springframework.stereotype.Service;
+
+/**
+* 场站服务类
+* @author xsl
+* @date 2023/2/16
+*/
+@Service
+public class ElectricFieldServiceImpl extends ServiceImpl<ElectricFieldMapper, ElectricField> implements ElectricFieldService {
+
+}

+ 231 - 0
ui/src/views/bizManager/electricField/index.vue

@@ -0,0 +1,231 @@
+<template>
+  <div class="app-container">
+
+    <el-card>
+      <div slot="header" class="clearfix">
+        <b><span>场站信息</span></b>
+      </div>
+      <div>
+        <el-card style="width: 80%;margin-left: 10%">
+          <div style="height: 30px" />
+          <el-form ref="form" v-loading="tableLoading" :model="form" :rules="rules">
+            <el-row style="gutter:30;text-align: left" class="row-bg el-row-two" justify="space-between">
+              <el-col :span="12">
+                <el-form-item label="场站编号:" prop="stationCode" label-width="180px">
+                  <el-input v-model="form.stationCode" placeholder="必填项" maxlength="6" />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="场站标识:" prop="sign" label-width="180px">
+                  <el-input v-model="form.sign" placeholder="必填项" maxlength="10" />
+                </el-form-item>
+              </el-col>
+            </el-row>
+            <el-row style="gutter:30" class="row-bg el-row-two" justify="space-between">
+              <el-col :span="12">
+                <el-form-item label="场站名称:" prop="name" label-width="180px">
+                  <el-input v-model="form.name" placeholder="必填项" maxlength="50" />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item
+                  label="装机容量(MW):"
+                  prop="capacity"
+                  label-width="180px"
+                  style="min-width: 110px"
+                >
+                  <el-input v-model="form.capacity" placeholder="必填项" maxlength="85" />
+                </el-form-item>
+              </el-col>
+            </el-row>
+
+            <el-row style="gutter:30" class="row-bg el-row-two" justify="space-between">
+              <el-col :span="12">
+                <el-form-item label="并网设备数:" prop="gridce" label-width="180px">
+                  <el-input v-model="form.gridce" placeholder="必填项" maxlength="10" />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="场站类型:" label-width="180px" prop="fieldType">
+                  <el-select
+                    v-model="form.fieldType"
+                    placeholder="请选择"
+                    filterable
+                    style="width: 100%"
+                  >
+                    <el-option
+                      v-for="item in this.electricTypeList"
+                      :key="item.value"
+                      :label="item.label"
+                      :value="item.value"
+                    />
+                  </el-select>
+                </el-form-item>
+              </el-col>
+            </el-row>
+            <el-row style="gutter:30" class="row-bg" justify="space-between">
+              <el-col :span="12">
+                <el-form-item label="场站位置:" prop="location" label-width="180px">
+                  <el-input v-model="form.location" placeholder="必填项" maxlength="100" />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="场站所属公司:" prop="company" label-width="180px">
+                  <el-input v-model="form.company" placeholder="必填项" maxlength="100" />
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+          <div style="text-align: center">
+            <span slot="footer" class="dialog-footer">
+              <el-button
+                v-loading="tableLoading"
+                type="primary"
+                style="width: 15%"
+                @click="saveElectricField('form')"
+              >保 存</el-button>
+            </span>
+          </div>
+          <div style="height: 30px" />
+        </el-card>
+        <div style="height: 20px" />
+      </div>
+    </el-card>
+  </div>
+</template>
+
+<script>
+
+import {debounce} from "lodash";
+
+export default {
+
+  data() {
+    return {
+      addVisible: false,
+      loading: true,
+      tableLoading: false,
+      tableData: {},
+      datas: {},
+      showCreateButton: false,
+      provinceTypeList: [],
+      electricTypeList: [
+        {value: '0', label: '光伏'},
+        {value: '1', label: '风电'}
+      ],
+      form: { stationStatusEnum: {
+        code: 'E1',
+        message: '未运维'
+      }},
+      electricFieldStatrsEnumList: [],
+      intervals: [{ key: 0, value: 0, label: '不入库' },{ key: 60, value: 60, label: '一分钟' }, { key: 900, value: 900, label: '十五分钟' }],
+      // 表单验证规则
+      rules: {
+        stationCode: [
+          { required: true, message: '请填写场站编号' }
+          // {message: '输入过长', max: 8}
+        ],
+        sign: [
+          { required: true, message: '请填写标识名称' }
+          // {message: '输入过长', max: 15}
+        ],
+        name: [
+          { required: true, message: '请填写场站名称' }
+          // {message: '输入过长', max: 50}
+        ],
+        capacity: [
+          { required: true, message: '请正确填写装机容量' },
+          { pattern: /^\d+(\.\d{0,2})?$/, message: '只能输入正数数字或带两位小数的数字' }
+          // {message: '输入过长', max: 10}
+        ],
+        gridce: [
+          { required: true, message: '请正确填写并网设备数' },
+          { pattern: /^[0-9]*[1-9][0-9]*$/, message: '只能输入正整数数字' }
+          // {message: '输入过长', max: 5}
+        ],
+        longitude: [
+          { required: true, message: '请正确填写场站经度' },
+          {pattern: /^\d+(\.\d{1,6})?$/, message: '只能输入正数数字或带小数点6位以内的数字'},
+          {pattern: /^-?((0|1?[0-8]?[0-9]?)(([.][0-9]{1,10})?)|180(([.][0]{1,10})?))$/, message: '请输入正确的经度'}
+          // {message: '输入过长', max: 10}
+        ],
+        latitude: [
+          { required: true, message: '请正确填写场站纬度' },
+          {pattern: /^\d+(\.\d{1,6})?$/, message: '只能输入正数数字或带小数点6位以内的数字'},
+          {pattern: /^-?((0|[1-8]?[0-9]?)(([.][0-9]{1,10})?)|90(([.][0]{1,10})?))$/, message: '请输入正确的纬度'}
+          // {message: '输入过长', max: 10}
+        ],
+        provinceEnum: [
+          { required: true, message: '请选择上报省调类型' }
+        ],
+        netSubstationName: [
+          { required: true, message: '请填写别名' }
+          // {message: '输入过长', max: 50}
+        ],
+        electricFieldTypeEnum: [
+          { required: true, message: '请填写场站类型' }
+        ],
+        interval: [
+          { required: true, message: '请填写入库时间' }],
+        altitude: [
+          { required: true, message: '请填写场站海拔' },
+          { pattern: /^\d+(\.\d{2})?$/, message: '只能输入正数数字或带两位小数的数字' }
+          // {message: '输入过长', max: 50}
+        ],
+        company: [
+          { required: true, message: '请填写场站所属公司' }
+          // {message: '输入过长', max: 50}
+        ],
+        location: [
+          { required: true, message: '请填写场站位置' }
+          // {message: '输入过长', max: 50}
+        ],
+        area: [
+          { required: true, message: '请填写场站面积' },
+          { pattern: /^\d+(\.\d{2})?$/, message: '只能输入正数数字或带两位小数的数字' }
+          // {message: '输入过长', max: 50}
+        ]
+      }
+    }
+  },
+  created() {
+    this.getData()
+  },
+  mounted() {
+  },
+  methods: {
+    getData() {
+      this.$axios.get('/electricField/getAll').then((res) => {
+        this.form = res.data
+        this.loading = false
+      }).catch((error) => {
+        this.loading = false;
+        // this.$message.error(error)
+      })
+    },
+    saveElectricField:debounce(function(formName){
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          this.tableLoading = true
+          this.$axios.post('/electricField/', this.form).then(res => {
+            if (res.code == 0) {
+              this.$message.success('场站信息保存成功')
+            }
+            if (res.code == 1) {
+              this.$message.error(res.data)
+            }
+            this.tableLoading = false
+          }).catch((error) => {
+            this.$message.error('场站信息保存出错' + error)
+            this.tableLoading = false
+          })
+        }
+      });
+    },1000)
+  }
+}
+</script>
+
+<style scoped>
+
+</style>