Bladeren bron

能耗阈值

wwh 1 jaar geleden
bovenliggende
commit
6f0fc5e696

+ 130 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/controller/EnergyThresholdController.java

@@ -0,0 +1,130 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.energy.energythreshold.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.github.xiaoymin.knife4j.annotations.ApiSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+import vip.xiaonuo.common.annotation.CommonLog;
+import vip.xiaonuo.common.pojo.CommonResult;
+import vip.xiaonuo.common.pojo.CommonValidList;
+import vip.xiaonuo.modular.energy.energythreshold.entity.EnergyThreshold;
+import vip.xiaonuo.modular.energy.energythreshold.param.*;
+import vip.xiaonuo.modular.energy.energythreshold.service.EnergyThresholdService;
+
+import javax.annotation.Resource;
+import javax.validation.Valid;
+import javax.validation.constraints.NotEmpty;
+
+/**
+ * 阈值设置控制器
+ *
+ * @author wang
+ * @date  2023/12/25 09:43
+ */
+@Api(tags = "阈值设置控制器")
+@ApiSupport(author = "SNOWY_TEAM", order = 1)
+@RestController
+@Validated
+public class EnergyThresholdController {
+
+    @Resource
+    private EnergyThresholdService energyThresholdService;
+
+    /**
+     * 获取阈值设置分页
+     *
+     * @author wang
+     * @date  2023/12/25 09:43
+     */
+    @ApiOperationSupport(order = 1)
+    @ApiOperation("获取阈值设置分页")
+    @GetMapping("/energ/energythreshold/page")
+    public CommonResult<Page<EnergyThreshold>> page(EnergyThresholdPageParam energyThresholdPageParam) {
+        return CommonResult.data(energyThresholdService.page(energyThresholdPageParam));
+    }
+
+    /**
+     * 添加阈值设置
+     *
+     * @author wang
+     * @date  2023/12/25 09:43
+     */
+    @ApiOperationSupport(order = 2)
+    @ApiOperation("添加阈值设置")
+    @CommonLog("添加阈值设置")
+    @PostMapping("/energ/energythreshold/add")
+    public CommonResult<String> add(@RequestBody @Valid EnergyThresholdAddParam energyThresholdAddParam) {
+        energyThresholdService.add(energyThresholdAddParam);
+        return CommonResult.ok();
+    }
+
+    /**
+     * 编辑阈值设置
+     *
+     * @author wang
+     * @date  2023/12/25 09:43
+     */
+    @ApiOperationSupport(order = 3)
+    @ApiOperation("编辑阈值设置")
+    @CommonLog("编辑阈值设置")
+    @PostMapping("/energ/energythreshold/edit")
+    public CommonResult<String> edit(@RequestBody @Valid EnergyThresholdEditParam energyThresholdEditParam) {
+        energyThresholdService.edit(energyThresholdEditParam);
+        return CommonResult.ok();
+    }
+
+    /**
+     * 删除阈值设置
+     *
+     * @author wang
+     * @date  2023/12/25 09:43
+     */
+    @ApiOperationSupport(order = 4)
+    @ApiOperation("删除阈值设置")
+    @CommonLog("删除阈值设置")
+    @PostMapping("/energ/energythreshold/delete")
+    public CommonResult<String> delete(@RequestBody @Valid @NotEmpty(message = "集合不能为空")
+                                                   CommonValidList<EnergyThresholdIdParam> energyThresholdIdParamList) {
+        energyThresholdService.delete(energyThresholdIdParamList);
+        return CommonResult.ok();
+    }
+
+    /**
+     * 获取阈值设置详情
+     *
+     * @author wang
+     * @date  2023/12/25 09:43
+     */
+    @ApiOperationSupport(order = 5)
+    @ApiOperation("获取阈值设置详情")
+    @GetMapping("/energ/energythreshold/detail")
+    public CommonResult<EnergyThreshold> detail(@Valid EnergyThresholdIdParam energyThresholdIdParam) {
+        return CommonResult.data(energyThresholdService.detail(energyThresholdIdParam));
+    }
+
+    @ApiOperationSupport(order = 5)
+    @ApiOperation("获取阈值设置详情")
+    @GetMapping("/energ/energythreshold/detail")
+    public CommonResult<String> batchThreshold(@Valid EnergyThresholdBatchParam energyThresholdIdParam) {
+        return (energyThresholdService.batchThreshold(energyThresholdIdParam));
+    }
+}

+ 81 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/entity/EnergyThreshold.java

@@ -0,0 +1,81 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.energy.energythreshold.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 阈值设置实体
+ *
+ * @author wang
+ * @date  2023/12/25 09:43
+ **/
+@Getter
+@Setter
+@TableName("energy_threshold")
+public class EnergyThreshold {
+
+    /** ID */
+    @TableId
+    @ApiModelProperty(value = "ID", position = 1)
+    private Integer id;
+
+    /** 阈值对象 */
+    @ApiModelProperty(value = "阈值对象", position = 2)
+    private String unitId;
+
+    /** 用水下值 */
+    @ApiModelProperty(value = "用水下值", position = 3)
+    private String waterDown;
+
+    /** 用水上值 */
+    @ApiModelProperty(value = "用水上值", position = 4)
+    private String waterUpper;
+
+    /** 用电下值 */
+    @ApiModelProperty(value = "用电下值", position = 5)
+    private String electricityDown;
+
+    /** 用电上值 */
+    @ApiModelProperty(value = "用电上值", position = 6)
+    private String electricityUpper;
+
+    /** 七日用水下值 */
+    @ApiModelProperty(value = "七日用水下值", position = 7)
+    private String waterWeekDown;
+
+    /** 七日用水上值 */
+    @ApiModelProperty(value = "七日用水上值", position = 8)
+    private String waterWeekUpper;
+
+    /** 七日用电上值 */
+    @ApiModelProperty(value = "七日用电上值", position = 9)
+    private String electricityWeekDown;
+
+    /** 七日用电下值 */
+    @ApiModelProperty(value = "七日用电下值", position = 10)
+    private String electricityWeekUpper;
+
+    /** 0为不启用 1为启用 */
+    @ApiModelProperty(value = "0为不启用 1为启用", position = 11)
+    private Integer isEnable;
+
+    /** 组织id */
+    @ApiModelProperty(value = "组织id", position = 12)
+    private String orgId;
+}

+ 34 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/enums/EnergyThresholdEnum.java

@@ -0,0 +1,34 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.energy.energythreshold.enums;
+
+import lombok.Getter;
+
+/**
+ * 阈值设置枚举
+ *
+ * @author wang
+ * @date  2023/12/25 09:43
+ **/
+@Getter
+public enum EnergyThresholdEnum {
+
+    /** 测试 */
+    TEST("TEST");
+
+    private final String value;
+
+    EnergyThresholdEnum(String value) {
+        this.value = value;
+    }
+}

+ 25 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/mapper/EnergyThresholdMapper.java

@@ -0,0 +1,25 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.energy.energythreshold.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import vip.xiaonuo.modular.energy.energythreshold.entity.EnergyThreshold;
+
+/**
+ * 阈值设置Mapper接口
+ *
+ * @author wang
+ * @date  2023/12/25 09:43
+ **/
+public interface EnergyThresholdMapper extends BaseMapper<EnergyThreshold> {
+}

+ 5 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/mapper/mapping/EnergyThresholdMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="vip.xiaonuo.modular.energy.energythreshold.mapper.EnergyThresholdMapper">
+
+</mapper>

+ 78 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/param/EnergyThresholdAddParam.java

@@ -0,0 +1,78 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.energy.energythreshold.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 阈值设置添加参数
+ *
+ * @author wang
+ * @date  2023/12/25 09:43
+ **/
+@Getter
+@Setter
+public class EnergyThresholdAddParam {
+
+    /** 阈值对象 */
+    @ApiModelProperty(value = "阈值对象", position = 2)
+    private String unitId;
+
+    /** 用水下值 */
+    @ApiModelProperty(value = "用水下值", position = 3)
+    private String waterDown;
+
+    /** 用水上值 */
+    @ApiModelProperty(value = "用水上值", position = 4)
+    private String waterUpper;
+
+    /** 用电下值 */
+    @ApiModelProperty(value = "用电下值", position = 5)
+    private String electricityDown;
+
+    /** 用电上值 */
+    @ApiModelProperty(value = "用电上值", position = 6)
+    private String electricityUpper;
+
+    /** 七日用水下值 */
+    @ApiModelProperty(value = "七日用水下值", position = 7)
+    private String waterWeekDown;
+
+    /** 七日用水上值 */
+    @ApiModelProperty(value = "七日用水上值", position = 8)
+    private String waterWeekUpper;
+
+    /** 七日用电上值 */
+    @ApiModelProperty(value = "七日用电上值", position = 9)
+    private String electricityWeekDown;
+
+    /** 七日用电下值 */
+    @ApiModelProperty(value = "七日用电下值", position = 10)
+    private String electricityWeekUpper;
+
+    /** 0为不启用 1为启用 */
+    @ApiModelProperty(value = "0为不启用 1为启用", position = 11)
+    private Integer isEnable;
+
+    /** 组织id */
+    @ApiModelProperty(value = "组织id", position = 12)
+    private String orgId;
+
+}

+ 73 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/param/EnergyThresholdBatchParam.java

@@ -0,0 +1,73 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.energy.energythreshold.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 阈值设置添加参数
+ *
+ * @author wang
+ * @date  2023/12/25 09:43
+ **/
+@Getter
+@Setter
+public class EnergyThresholdBatchParam {
+
+    /** 阈值对象 */
+    @ApiModelProperty(value = "阈值对象", position = 2)
+    private String unitId;
+
+    /** 用水下值 */
+    @ApiModelProperty(value = "用水下值", position = 3)
+    private String waterDown;
+
+    /** 用水上值 */
+    @ApiModelProperty(value = "用水上值", position = 4)
+    private String waterUpper;
+
+    /** 用电下值 */
+    @ApiModelProperty(value = "用电下值", position = 5)
+    private String electricityDown;
+
+    /** 用电上值 */
+    @ApiModelProperty(value = "用电上值", position = 6)
+    private String electricityUpper;
+
+    /** 七日用水下值 */
+    @ApiModelProperty(value = "七日用水下值", position = 7)
+    private String waterWeekDown;
+
+    /** 七日用水上值 */
+    @ApiModelProperty(value = "七日用水上值", position = 8)
+    private String waterWeekUpper;
+
+    /** 七日用电上值 */
+    @ApiModelProperty(value = "七日用电上值", position = 9)
+    private String electricityWeekDown;
+
+    /** 七日用电下值 */
+    @ApiModelProperty(value = "七日用电下值", position = 10)
+    private String electricityWeekUpper;
+
+    /** 0为不启用 1为启用 */
+    @ApiModelProperty(value = "0为不启用 1为启用", position = 11)
+    private Integer isEnable;
+
+    /** 组织id */
+    @ApiModelProperty(value = "组织id", position = 12)
+    private String orgId;
+
+}

+ 83 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/param/EnergyThresholdEditParam.java

@@ -0,0 +1,83 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.energy.energythreshold.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 阈值设置编辑参数
+ *
+ * @author wang
+ * @date  2023/12/25 09:43
+ **/
+@Getter
+@Setter
+public class EnergyThresholdEditParam {
+
+    /** ID */
+    @ApiModelProperty(value = "ID", required = true, position = 1)
+    @NotNull(message = "id不能为空")
+    private Integer id;
+//
+//    /** 阈值对象 */
+//    @ApiModelProperty(value = "阈值对象", position = 2)
+//    private String unitId;
+
+    /** 用水下值 */
+    @ApiModelProperty(value = "用水下值", position = 3)
+    private String waterDown;
+
+    /** 用水上值 */
+    @ApiModelProperty(value = "用水上值", position = 4)
+    private String waterUpper;
+
+    /** 用电下值 */
+    @ApiModelProperty(value = "用电下值", position = 5)
+    private String electricityDown;
+
+    /** 用电上值 */
+    @ApiModelProperty(value = "用电上值", position = 6)
+    private String electricityUpper;
+
+    /** 七日用水下值 */
+    @ApiModelProperty(value = "七日用水下值", position = 7)
+    private String waterWeekDown;
+
+    /** 七日用水上值 */
+    @ApiModelProperty(value = "七日用水上值", position = 8)
+    private String waterWeekUpper;
+
+    /** 七日用电上值 */
+    @ApiModelProperty(value = "七日用电上值", position = 9)
+    private String electricityWeekDown;
+
+    /** 七日用电下值 */
+    @ApiModelProperty(value = "七日用电下值", position = 10)
+    private String electricityWeekUpper;
+
+    /** 0为不启用 1为启用 */
+    @ApiModelProperty(value = "0为不启用 1为启用", position = 11)
+    private Integer isEnable;
+
+//    /** 组织id */
+//    @ApiModelProperty(value = "组织id", position = 12)
+//    private String orgId;
+
+}

+ 36 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/param/EnergyThresholdIdParam.java

@@ -0,0 +1,36 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.energy.energythreshold.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * 阈值设置Id参数
+ *
+ * @author wang
+ * @date  2023/12/25 09:43
+ **/
+@Getter
+@Setter
+public class EnergyThresholdIdParam {
+
+    /** ID */
+    @ApiModelProperty(value = "ID", required = true)
+    @NotNull(message = "id不能为空")
+    private Integer id;
+}

+ 51 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/param/EnergyThresholdPageParam.java

@@ -0,0 +1,51 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.energy.energythreshold.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 阈值设置查询参数
+ *
+ * @author wang
+ * @date  2023/12/25 09:43
+ **/
+@Getter
+@Setter
+public class EnergyThresholdPageParam {
+
+    /** 当前页 */
+    @ApiModelProperty(value = "当前页码")
+    private Integer current;
+
+    /** 每页条数 */
+    @ApiModelProperty(value = "每页条数")
+    private Integer size;
+
+    /** 排序字段 */
+    @ApiModelProperty(value = "排序字段,字段驼峰名称,如:userName")
+    private String sortField;
+
+    /** 排序方式 */
+    @ApiModelProperty(value = "排序方式,升序:ASCEND;降序:DESCEND")
+    private String sortOrder;
+
+    /** 关键词 */
+    @ApiModelProperty(value = "关键词")
+    private String searchKey;
+
+}

+ 85 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/service/EnergyThresholdService.java

@@ -0,0 +1,85 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.energy.energythreshold.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import vip.xiaonuo.common.pojo.CommonResult;
+import vip.xiaonuo.modular.energy.energythreshold.entity.EnergyThreshold;
+import vip.xiaonuo.modular.energy.energythreshold.param.*;
+
+import java.util.List;
+
+/**
+ * 阈值设置Service接口
+ *
+ * @author wang
+ * @date  2023/12/25 09:43
+ **/
+public interface EnergyThresholdService extends IService<EnergyThreshold> {
+
+    /**
+     * 获取阈值设置分页
+     *
+     * @author wang
+     * @date  2023/12/25 09:43
+     */
+    Page<EnergyThreshold> page(EnergyThresholdPageParam energyThresholdPageParam);
+
+    /**
+     * 添加阈值设置
+     *
+     * @author wang
+     * @date  2023/12/25 09:43
+     */
+    CommonResult add(EnergyThresholdAddParam energyThresholdAddParam);
+
+    /**
+     * 编辑阈值设置
+     *
+     * @author wang
+     * @date  2023/12/25 09:43
+     */
+    void edit(EnergyThresholdEditParam energyThresholdEditParam);
+
+    /**
+     * 删除阈值设置
+     *
+     * @author wang
+     * @date  2023/12/25 09:43
+     */
+    void delete(List<EnergyThresholdIdParam> energyThresholdIdParamList);
+
+    /**
+     * 获取阈值设置详情
+     *
+     * @author wang
+     * @date  2023/12/25 09:43
+     */
+    EnergyThreshold detail(EnergyThresholdIdParam energyThresholdIdParam);
+
+    /**
+     * 获取阈值设置详情
+     *
+     * @author wang
+     * @date  2023/12/25 09:43
+     **/
+    EnergyThreshold queryEntity(String id);
+
+
+    /**
+     * 同步阈值
+     */
+    CommonResult batchThreshold(EnergyThresholdBatchParam energyThresholdBatchParam);
+
+}

+ 122 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/service/impl/EnergyThresholdServiceImpl.java

@@ -0,0 +1,122 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.modular.energy.energythreshold.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollStreamUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.checkerframework.checker.units.qual.A;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import vip.xiaonuo.common.enums.CommonSortOrderEnum;
+import vip.xiaonuo.common.exception.CommonException;
+import vip.xiaonuo.common.page.CommonPageRequest;
+import vip.xiaonuo.common.pojo.CommonResult;
+import vip.xiaonuo.modular.base.pigpen.entity.BasePigpen;
+import vip.xiaonuo.modular.base.pigpen.mapper.BasePigpenMapper;
+import vip.xiaonuo.modular.energy.energythreshold.entity.EnergyThreshold;
+import vip.xiaonuo.modular.energy.energythreshold.mapper.EnergyThresholdMapper;
+import vip.xiaonuo.modular.energy.energythreshold.param.*;
+import vip.xiaonuo.modular.energy.energythreshold.service.EnergyThresholdService;
+
+import java.util.List;
+
+/**
+ * 阈值设置Service接口实现类
+ *
+ * @author wang
+ * @date  2023/12/25 09:43
+ **/
+@Service
+public class EnergyThresholdServiceImpl extends ServiceImpl<EnergyThresholdMapper, EnergyThreshold> implements EnergyThresholdService {
+
+    @Autowired
+    private EnergyThresholdMapper thresholdMapper;
+    @Autowired
+    private BasePigpenMapper basePigpenMapper;
+    @Override
+    public Page<EnergyThreshold> page(EnergyThresholdPageParam energyThresholdPageParam) {
+        QueryWrapper<EnergyThreshold> queryWrapper = new QueryWrapper<>();
+        if(ObjectUtil.isAllNotEmpty(energyThresholdPageParam.getSortField(), energyThresholdPageParam.getSortOrder())) {
+            CommonSortOrderEnum.validate(energyThresholdPageParam.getSortOrder());
+            queryWrapper.orderBy(true, energyThresholdPageParam.getSortOrder().equals(CommonSortOrderEnum.ASC.getValue()),
+                    StrUtil.toUnderlineCase(energyThresholdPageParam.getSortField()));
+        } else {
+            queryWrapper.lambda().orderByAsc(EnergyThreshold::getId);
+        }
+        return this.page(CommonPageRequest.defaultPage(), queryWrapper);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public CommonResult add(EnergyThresholdAddParam energyThresholdAddParam) {
+        EnergyThreshold energyThreshold = BeanUtil.toBean(energyThresholdAddParam, EnergyThreshold.class);
+        QueryWrapper<EnergyThreshold> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("org_id", energyThreshold.getOrgId()).eq("unit_id", energyThreshold.getUnitId());
+        if (ObjectUtil.isEmpty(thresholdMapper.selectOne(queryWrapper))) {
+            this.save(energyThreshold);
+            return CommonResult.ok();
+        } else {
+            return new CommonResult(500, "阈值已存在,无需重复添加!", false);
+        }
+
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void edit(EnergyThresholdEditParam energyThresholdEditParam) {
+        EnergyThreshold energyThreshold = this.queryEntity(energyThresholdEditParam.getId().toString());
+        BeanUtil.copyProperties(energyThresholdEditParam, energyThreshold);
+        this.updateById(energyThreshold);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void delete(List<EnergyThresholdIdParam> energyThresholdIdParamList) {
+        // 执行删除
+        this.removeByIds(CollStreamUtil.toList(energyThresholdIdParamList, EnergyThresholdIdParam::getId));
+    }
+
+    @Override
+    public EnergyThreshold detail(EnergyThresholdIdParam energyThresholdIdParam) {
+        return this.queryEntity(energyThresholdIdParam.getId().toString());
+    }
+
+    @Override
+    public EnergyThreshold queryEntity(String id) {
+        EnergyThreshold energyThreshold = this.getById(id);
+        if(ObjectUtil.isEmpty(energyThreshold)) {
+            throw new CommonException("阈值设置不存在,id值为:{}", id);
+        }
+        return energyThreshold;
+    }
+
+    @Override
+    public CommonResult batchThreshold(EnergyThresholdBatchParam energyThresholdBatchParam) {
+        EnergyThreshold energyThreshold = BeanUtil.toBean(energyThresholdBatchParam, EnergyThreshold.class);
+        QueryWrapper<BasePigpen> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("org_id", energyThresholdBatchParam.getOrgId())
+                .like("pids", energyThresholdBatchParam.getUnitId());
+        List<BasePigpen> basePigpens = basePigpenMapper.selectList(queryWrapper);
+        for (BasePigpen basePigpen : basePigpens) {
+            energyThreshold.setUnitId(basePigpen.getId());
+            thresholdMapper.insert(energyThreshold);
+        }
+        return CommonResult.ok();
+    }
+}