Explorar el Código

能耗、环控

Newspaper hace 1 año
padre
commit
4b3327a148
Se han modificado 67 ficheros con 662 adiciones y 548 borrados
  1. 2 0
      snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/entity/vo/UserPhoneVo.java
  2. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/base/pigpen/param/BasePigpenAddParam.java
  3. 1 4
      snowy-web-app/src/main/java/vip/xiaonuo/modular/base/pigpen/service/impl/BasePigpenServiceImpl.java
  4. 2 6
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyDevice/controller/EnergyDeviceController.java
  5. 7 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyDevice/entity/EnergyDevice.java
  6. 2 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyDevice/service/EnergyDeviceService.java
  7. 6 7
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyDevice/service/impl/EnergyDeviceServiceImpl.java
  8. 2 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/controller/EnergyElectricityController.java
  9. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/entity/EnergyElectricity.java
  10. 4 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/entity/vo/EnergyElectricityListVo.java
  11. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/entity/vo/EnergyElectricityProportionVo.java
  12. 2 5
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/entity/vo/EnergyElectricityRateVo.java
  13. 6 4
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/mapper/EnergyElectricityMapper.java
  14. 19 4
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/mapper/mapping/EnergyElectricityMapper.xml
  15. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/service/EnergyElectricityService.java
  16. 21 25
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/service/impl/EnergyElectricityServiceImpl.java
  17. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyThreshold/param/EnergyThresholdSaveParam.java
  18. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyThreshold/param/EnergyThresholdSyncParam.java
  19. 2 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/controller/EnergyWaterController.java
  20. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/entity/EnergyWater.java
  21. 4 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/entity/vo/EnergyWaterListVo.java
  22. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/entity/vo/EnergyWaterProportionVo.java
  23. 2 5
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/entity/vo/EnergyWaterRateVo.java
  24. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/entity/vo/EnergyWaterTrendVo.java
  25. 7 4
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/mapper/EnergyWaterMapper.java
  26. 21 7
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/mapper/mapping/EnergyWaterMapper.xml
  27. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/param/EnergyWaterTopParm.java
  28. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/service/EnergyWaterService.java
  29. 22 26
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/service/impl/EnergyWaterServiceImpl.java
  30. 15 14
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/controller/EnergyThresholdController.java
  31. 3 27
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/entity/EnergyThreshold.java
  32. 19 25
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/param/EnergyThresholdPageParam.java
  33. 89 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/entity/vo/EnergyThresholdVo.java
  34. 0 78
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/param/EnergyThresholdAddParam.java
  35. 0 73
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/param/EnergyThresholdBatchParam.java
  36. 0 83
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/param/EnergyThresholdEditParam.java
  37. 5 5
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyThreshold/param/EnergyThresholdUnitIdParam.java
  38. 5 5
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/service/EnergyThresholdService.java
  39. 36 16
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/service/impl/EnergyThresholdServiceImpl.java
  40. 12 11
      snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envThreshold/controller/EnvThresholdController.java
  41. 1 2
      snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envThreshold/entity/EnvThreshold.java
  42. 20 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envThreshold/entity/vo/EnvThresholdListVo.java
  43. 122 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envThreshold/entity/vo/EnvThresholdVo.java
  44. 5 5
      snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envThreshold/service/EnvThresholdService.java
  45. 34 14
      snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envThreshold/service/impl/EnvThresholdServiceImpl.java
  46. 2 2
      snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envdata/entity/EnvData.java
  47. 4 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envdata/entity/vo/EnvDataListVo.java
  48. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envdata/entity/vo/EnvDataTrendVo.java
  49. 18 2
      snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envdata/service/impl/EnvDataServiceImpl.java
  50. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envdevice/service/impl/EnvDeviceServiceImpl.java
  51. 5 8
      snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningInfo/controller/WarningInfoController.java
  52. 2 2
      snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningInfo/entity/vo/WarningInfoListVo.java
  53. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningInfo/entity/vo/WarningInfoProportionVo.java
  54. 2 5
      snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningInfo/entity/vo/WarningInfoRateVo.java
  55. 2 2
      snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningInfo/mapper/mapping/WarningInfoMapper.xml
  56. 9 10
      snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/param/EnergyThresholdIdParam.java
  57. 4 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningInfo/param/WarningInfoPageParam.java
  58. 3 6
      snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningInfo/service/WarningInfoService.java
  59. 12 22
      snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningInfo/service/impl/WarningInfoServiceImpl.java
  60. 16 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningManager/controller/WarningManagerController.java
  61. 2 3
      snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningManager/entity/WarningManager.java
  62. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningManager/entity/vo/WarningManagerVo.java
  63. 35 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningManager/param/WarningManagerOrgIdParam.java
  64. 2 3
      snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningManager/param/WarningManagerSaveParam.java
  65. 1 1
      snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningManager/param/WarningManagerTypeParam.java
  66. 7 0
      snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningManager/service/WarningManagerService.java
  67. 23 4
      snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningManager/service/impl/WarningManagerServiceImpl.java

+ 2 - 0
snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/entity/vo/UserPhoneVo.java

@@ -4,6 +4,8 @@ import lombok.Data;
 
 @Data
 public class UserPhoneVo {
+    private String userId;
+
     private String name;
 
     private String phone;

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/pigpen/param/BasePigpenAddParam.java

@@ -45,7 +45,7 @@ public class BasePigpenAddParam {
 
     /** 阶段 */
     @ApiModelProperty(value = "阶段", position = 4)
-    private String remarks;
+    private String stage;
 
     /** 容量 */
     @ApiModelProperty(value = "容量", position = 6)

+ 1 - 4
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/pigpen/service/impl/BasePigpenServiceImpl.java

@@ -58,8 +58,6 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
     public Page<BasePigpen> page(BasePigpenPageParam basePigpenPageParam) {
         String orgId = basePigpenPageParam.getOrgId();
         QueryWrapper<BasePigpen> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().select(BasePigpen::getId, BasePigpen::getParentId, BasePigpen::getBuildName,
-                BasePigpen::getBuildName, BasePigpen::getSort);
         queryWrapper.lambda().eq(BasePigpen::getOrgId,orgId);
         if(ObjectUtil.isNotEmpty(basePigpenPageParam.getParentId())) {
             queryWrapper.lambda().eq(BasePigpen::getParentId, basePigpenPageParam.getParentId());
@@ -67,13 +65,12 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
         if(ObjectUtil.isNotEmpty(basePigpenPageParam.getSearchKey())) {
             queryWrapper.lambda().like(BasePigpen::getBuildName, basePigpenPageParam.getSearchKey());
         }
-
         if(ObjectUtil.isAllNotEmpty(basePigpenPageParam.getSortField(), basePigpenPageParam.getSortOrder())) {
             CommonSortOrderEnum.validate(basePigpenPageParam.getSortOrder());
             queryWrapper.orderBy(true, basePigpenPageParam.getSortOrder().equals(CommonSortOrderEnum.ASC.getValue()),
                     StrUtil.toUnderlineCase(basePigpenPageParam.getSortField()));
         } else {
-            queryWrapper.lambda().orderByAsc(BasePigpen::getId);
+            queryWrapper.lambda().orderByAsc(BasePigpen::getSort);
         }
         return this.page(CommonPageRequest.defaultPage(), queryWrapper);
     }

+ 2 - 6
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyDevice/controller/EnergyDeviceController.java

@@ -27,6 +27,7 @@ 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.base.baseConfig.entity.BaseConfig;
 import vip.xiaonuo.modular.base.pigpen.param.BasePigpenOrgIdParam;
 import vip.xiaonuo.modular.base.pigpen.service.BasePigpenService;
 import vip.xiaonuo.modular.energy.energyDevice.entity.EnergyDevice;
@@ -66,7 +67,6 @@ public class EnergyDeviceController {
      */
     @ApiOperationSupport(order = 1)
     @ApiOperation("获取能耗设备分页")
-    @SaCheckPermission("/energy/energyDevice/page")
     @GetMapping("/energy/energyDevice/page")
     public CommonResult<Page<EnergyDevice>> page(EnergyDevicePageParam energyDevicePageParam) {
         return CommonResult.data(energyDeviceService.page(energyDevicePageParam));
@@ -81,7 +81,6 @@ public class EnergyDeviceController {
     @ApiOperationSupport(order = 2)
     @ApiOperation("添加能耗设备")
     @CommonLog("添加能耗设备")
-    @SaCheckPermission("/energy/energyDevice/add")
     @PostMapping("/energy/energyDevice/add")
     public CommonResult<String> add(@RequestBody @Valid EnergyDeviceAddParam energyDeviceAddParam) {
         energyDeviceService.add(energyDeviceAddParam);
@@ -97,7 +96,6 @@ public class EnergyDeviceController {
     @ApiOperationSupport(order = 3)
     @ApiOperation("编辑能耗设备")
     @CommonLog("编辑能耗设备")
-    @SaCheckPermission("/energy/energyDevice/edit")
     @PostMapping("/energy/energyDevice/edit")
     public CommonResult<String> edit(@RequestBody @Valid EnergyDeviceEditParam energyDeviceEditParam) {
         energyDeviceService.edit(energyDeviceEditParam);
@@ -113,7 +111,6 @@ public class EnergyDeviceController {
     @ApiOperationSupport(order = 4)
     @ApiOperation("删除能耗设备")
     @CommonLog("删除能耗设备")
-    @SaCheckPermission("/energy/energyDevice/delete")
     @PostMapping("/energy/energyDevice/delete")
     public CommonResult<String> delete(@RequestBody @Valid @NotEmpty(message = "集合不能为空")
                                                    CommonValidList<EnergyDeviceIdParam> energyDeviceIdParamList) {
@@ -129,7 +126,6 @@ public class EnergyDeviceController {
      */
     @ApiOperationSupport(order = 5)
     @ApiOperation("获取能耗设备详情")
-    @SaCheckPermission("/energy/energyDevice/detail")
     @GetMapping("/energy/energyDevice/detail")
     public CommonResult<EnergyDevice> detail(@Valid EnergyDeviceIdParam energyDeviceIdParam) {
         return CommonResult.data(energyDeviceService.detail(energyDeviceIdParam));
@@ -172,7 +168,7 @@ public class EnergyDeviceController {
     @ApiOperationSupport(order = 8)
     @ApiOperation("获取设备类型选择器")
     @GetMapping("/energy/energyDevice/deviceTypeSelector")
-    public CommonResult<List<String>> deviceTypeSelector(EnergyDeviceOrgIdParam energyDeviceOrgIdParam) {
+    public CommonResult<List<BaseConfig>> deviceTypeSelector(EnergyDeviceOrgIdParam energyDeviceOrgIdParam) {
         return CommonResult.data(energyDeviceService.deviceTypeSelector(energyDeviceOrgIdParam));
     }
 

+ 7 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyDevice/entity/EnergyDevice.java

@@ -15,6 +15,7 @@ package vip.xiaonuo.modular.energy.energyDevice.entity;
 import com.baomidou.mybatisplus.annotation.*;
 import com.fhs.core.trans.anno.Trans;
 import com.fhs.core.trans.constant.TransType;
+import com.fhs.core.trans.vo.TransPojo;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
@@ -34,7 +35,7 @@ import java.util.Date;
 @Getter
 @Setter
 @TableName("energy_device")
-public class EnergyDevice extends CommonEntity {
+public class EnergyDevice extends CommonEntity implements TransPojo {
 
     /** id */
     @TableId
@@ -71,4 +72,9 @@ public class EnergyDevice extends CommonEntity {
     @ApiModelProperty(value = "设备类型", position = 8)
     @TableField(exist = false)
     private String deviceType;
+
+    /** 安装位置 */
+    @ApiModelProperty(value = "安装位置", position = 9)
+    @TableField(exist = false)
+    private String buildName;
 }

+ 2 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyDevice/service/EnergyDeviceService.java

@@ -15,6 +15,7 @@ package vip.xiaonuo.modular.energy.energyDevice.service;
 import cn.hutool.core.lang.tree.Tree;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
+import vip.xiaonuo.modular.base.baseConfig.entity.BaseConfig;
 import vip.xiaonuo.modular.energy.energyDevice.entity.EnergyDevice;
 import vip.xiaonuo.modular.energy.energyDevice.entity.vo.EnergyDeviceCountVo;
 import vip.xiaonuo.modular.energy.energyDevice.param.*;
@@ -80,5 +81,5 @@ public interface EnergyDeviceService extends IService<EnergyDevice> {
 
     EnergyDeviceCountVo deviceCount(EnergyDeviceOrgIdParam energyDeviceOrgIdParam);
 
-    List<String> deviceTypeSelector(EnergyDeviceOrgIdParam energyDeviceOrgIdParam);
+    List<BaseConfig> deviceTypeSelector(EnergyDeviceOrgIdParam energyDeviceOrgIdParam);
 }

+ 6 - 7
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyDevice/service/impl/EnergyDeviceServiceImpl.java

@@ -189,21 +189,20 @@ public class EnergyDeviceServiceImpl extends ServiceImpl<EnergyDeviceMapper, Ene
             NumberFormat numberFormat = NumberFormat.getInstance();
             //设置精确到小数点后两位
             numberFormat.setMaximumFractionDigits(2);
+            System.out.println("onDeviceNum"+onDeviceNum);
+            System.out.println("deviceNum"+deviceNum);
             String onlineRate = numberFormat.format((float)onDeviceNum / (float) deviceNum* 100) + "%";
+            System.out.println("onlineRate"+onlineRate);
             energyDeviceCountVo.setOnlineRate(onlineRate);
         }
         return energyDeviceCountVo;
     }
 
     @Override
-    public List<String> deviceTypeSelector(EnergyDeviceOrgIdParam energyDeviceOrgIdParam) {
+    public List<BaseConfig> deviceTypeSelector(EnergyDeviceOrgIdParam energyDeviceOrgIdParam) {
         String orgId = energyDeviceOrgIdParam.getOrgId();
-        List<String> list = new ArrayList<>();
-        String parentId = baseConfigMapper.selectOne(new QueryWrapper<BaseConfig>().lambda().eq(BaseConfig::getParentId, 0).eq(BaseConfig::getConfigName, "设备类型")).getId();
+        String parentId = baseConfigMapper.selectOne(new QueryWrapper<BaseConfig>().lambda().eq(BaseConfig::getParentId, 0).eq(BaseConfig::getConfigName, "能耗设备类型")).getId();
         List<BaseConfig> baseConfigs = baseConfigMapper.selectList(new QueryWrapper<BaseConfig>().lambda().eq(BaseConfig::getParentId, parentId).eq(BaseConfig::getOrgId, orgId));
-        if (ObjectUtil.isNotEmpty(baseConfigs)){
-            list = baseConfigs.stream().map(baseConfig -> baseConfig.getConfigName()).collect(Collectors.toList());
-        }
-        return list;
+        return baseConfigs;
     }
 }

+ 2 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/controller/EnergyElectricityController.java

@@ -31,6 +31,7 @@ import vip.xiaonuo.modular.energy.energyElectricity.service.EnergyElectricitySer
 
 import javax.annotation.Resource;
 import javax.validation.constraints.NotBlank;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -86,7 +87,7 @@ public class EnergyElectricityController {
     @ApiOperationSupport(order = 3)
     @ApiOperation("获取用电量排名")
     @GetMapping("/energy/energyElectricity/listTop")
-    public CommonResult<EnergyElectricityTopVo> listTop(EnergyElectricityTopParm energyElectricityTopParm) {
+    public CommonResult<List<EnergyElectricityTopVo>> listTop(EnergyElectricityTopParm energyElectricityTopParm) {
         String orgId = energyElectricityTopParm.getOrgId();
         return CommonResult.data(energyElectricityService.listTop(energyElectricityTopParm,orgId));
     }

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/entity/EnergyElectricity.java

@@ -33,7 +33,7 @@ public class EnergyElectricity {
     /** id */
     @TableId
     @ApiModelProperty(value = "id", position = 1)
-    private String id;
+    private int id;
 
     /** 用电量 */
     @ApiModelProperty(value = "用电量", position = 2)

+ 4 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/entity/vo/EnergyElectricityListVo.java

@@ -1,10 +1,12 @@
 package vip.xiaonuo.modular.energy.energyElectricity.entity.vo;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.math.BigDecimal;
 import java.sql.Date;
+import java.time.LocalDateTime;
 
 @Data
 public class EnergyElectricityListVo {
@@ -12,6 +14,7 @@ public class EnergyElectricityListVo {
     private BigDecimal electricityValue;
 
     @ApiModelProperty(value = "创建时间", position = 2)
-    private Date createTime;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
+    private LocalDateTime createTime;
 
 }

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/entity/vo/EnergyElectricityProportionVo.java

@@ -16,5 +16,5 @@ public class EnergyElectricityProportionVo {
     private BigDecimal qoq;
 
     @ApiModelProperty(value = "比例列表", position = 3)
-    private List<EnergyElectricityRateVo> rateList;
+    private List<EnergyElectricityRateVo> list;
 }

+ 2 - 5
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/entity/vo/EnergyElectricityRateVo.java

@@ -8,11 +8,8 @@ import java.math.BigDecimal;
 @Data
 public class EnergyElectricityRateVo {
     @ApiModelProperty(value = "栋舍名", position = 1)
-    private String buildName;
+    private String name;
 
     @ApiModelProperty(value = "消耗数量", position = 2)
-    private BigDecimal consumptionQuantity;
-
-    @ApiModelProperty(value = "占比", position = 3)
-    private BigDecimal proportion;
+    private BigDecimal value;
 }

+ 6 - 4
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/mapper/EnergyElectricityMapper.java

@@ -47,11 +47,13 @@ public interface EnergyElectricityMapper extends BaseMapper<EnergyElectricity> {
 
     List<EnergyElectricityListVo> listCustom(String pigpenId, String startDate, String endDate);
 
-    EnergyElectricityTopVo listTodayTop(String orgId);
+    List<EnergyElectricityTopVo> listTodayTop(String orgId);
 
-    EnergyElectricityTopVo listWeekTop(String orgId);
+    List<EnergyElectricityTopVo> listWeekTop(String orgId);
 
-    EnergyElectricityTopVo listMonthTop(String orgId);
+    List<EnergyElectricityTopVo> listMonthTop(String orgId);
 
-    EnergyElectricityTopVo listCustomTop(String orgId, String startDate, String endDate);
+    List<EnergyElectricityTopVo> listCustomTop(String orgId, String startDate, String endDate);
+
+    List<EnergyElectricityListVo> listSevenDay(String pigpenId);
 }

+ 19 - 4
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/mapper/mapping/EnergyElectricityMapper.xml

@@ -57,7 +57,7 @@
             e.unit_id = p.id
         WHERE
             e.org_id = #{orgId}
-            p.stage = #{stage}
+            AND p.stage = #{stage}
             AND YEARWEEK(e.create_date, 1) = YEARWEEK(CURDATE(), 1)
     </select>
     <select id="getMonthTotalByType" resultType="java.math.BigDecimal">
@@ -71,7 +71,7 @@
             e.unit_id = p.id
         WHERE
             e.org_id = #{orgId}
-            p.stage = #{stage}
+            AND p.stage = #{stage}
             AND MONTH(e.create_date) = MONTH(CURDATE())
             AND YEAR(e.create_date) = YEAR(CURDATE())
     </select>
@@ -197,7 +197,7 @@
     <select id="listCustomTop" resultType="vip.xiaonuo.modular.energy.energyElectricity.entity.vo.EnergyElectricityTopVo">
         SELECT
             p.full_name as 'location',
-            ROUND(SUM(electricity_value), 2) as 'energyElectricityValue''
+            ROUND(SUM(electricity_value), 2) as 'energyElectricityValue'
         FROM
             `energy_electricity` e
         LEFT JOIN
@@ -206,11 +206,26 @@
             e.unit_id = p.id
         WHERE
             e.org_id = #{orgId}
-            AND e.create_date BETWEEN #{startDate} AND #{endDate}
+            AND e.create_date BETWEEN '${startDate}' AND '${endDate}'
         GROUP BY
             e.unit_id
         ORDER BY
             energyElectricityValue DESC
         LIMIT 6
     </select>
+    <select id="listSevenDay"
+            resultType="vip.xiaonuo.modular.energy.energyElectricity.entity.vo.EnergyElectricityListVo">
+        SELECT
+            ROUND(AVG(electricity_value), 2) AS 'electricityValue',
+            DATE(create_date) AS 'createTime'
+        FROM
+            `energy_electricity`
+        WHERE
+            unit_id = #{pigpenId}
+            AND create_date BETWEEN CURDATE() - INTERVAL 6 DAY AND CURDATE();
+        GROUP BY
+            DATE(create_date)
+        ORDER BY
+            DATE(create_date) ASC;
+    </select>
 </mapper>

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/service/EnergyElectricityService.java

@@ -36,5 +36,5 @@ public interface EnergyElectricityService extends IService<EnergyElectricity> {
 
     EnergyElectricityTrendVo listTrend(EnergyElectricityListParm energyElectricityListParm);
 
-    EnergyElectricityTopVo listTop(EnergyElectricityTopParm energyElectricityTopParm, String orgId);
+    List<EnergyElectricityTopVo> listTop(EnergyElectricityTopParm energyElectricityTopParm, String orgId);
 }

+ 21 - 25
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/service/impl/EnergyElectricityServiceImpl.java

@@ -27,6 +27,7 @@ import vip.xiaonuo.modular.energy.energyElectricity.param.EnergyElectricityTopPa
 import vip.xiaonuo.modular.energy.energyElectricity.service.EnergyElectricityService;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -56,20 +57,15 @@ public class EnergyElectricityServiceImpl extends ServiceImpl<EnergyElectricityM
         String parentId = baseConfigMapper.selectOne(new QueryWrapper<BaseConfig>().eq("config_name", "栋舍阶段").eq("parent_id", 0)).getId();
         List<BaseConfig> buildStage = baseConfigMapper.selectList(new QueryWrapper<BaseConfig>().eq("parent_id", parentId).orderByAsc("sort_code"));
         List<String> stages = buildStage.stream().map(config -> config.getConfigName()).collect(Collectors.toList());
-        List<EnergyElectricityRateVo> rateList = null;
+        List<EnergyElectricityRateVo> rateList = new ArrayList<>();
         if (type.equals("0")){
             thisTotal = energyElectricityMapper.getWeekTotal(orgId);
             lastTotal = energyElectricityMapper.getLastWeekTotal(orgId);
             for (String stage : stages) {
                 EnergyElectricityRateVo rate = new EnergyElectricityRateVo();
-                BigDecimal proportion = BigDecimal.ZERO;
                 BigDecimal weekTotal = energyElectricityMapper.getWeekTotalByType(stage, orgId);
-                rate.setBuildName(stage+"舍");
-                rate.setConsumptionQuantity(weekTotal);
-                if (!thisTotal.equals(BigDecimal.ZERO)){
-                    proportion = weekTotal.divide(thisTotal).multiply(BigDecimal.valueOf(100));
-                }
-                rate.setProportion(proportion);
+                rate.setName(stage+"舍");
+                rate.setValue(weekTotal);
                 rateList.add(rate);
             }
         }else {
@@ -77,23 +73,21 @@ public class EnergyElectricityServiceImpl extends ServiceImpl<EnergyElectricityM
             lastTotal = energyElectricityMapper.getLastMonthTotal(orgId);
             for (String stage : stages) {
                 EnergyElectricityRateVo rate = new EnergyElectricityRateVo();
-                BigDecimal proportion = BigDecimal.ZERO;
                 BigDecimal weekTotal = energyElectricityMapper.getMonthTotalByType(stage, orgId);
-                rate.setBuildName(stage+"舍");
-                rate.setConsumptionQuantity(weekTotal);
-                if (!thisTotal.equals(BigDecimal.ZERO)){
-                    proportion = weekTotal.divide(thisTotal).multiply(BigDecimal.valueOf(100));
-                }
-                rate.setProportion(proportion);
+                rate.setName(stage+"舍");
+                rate.setValue(weekTotal);
                 rateList.add(rate);
             }
         }
-        if (!lastTotal.equals(BigDecimal.ZERO)){
+        if (lastTotal.compareTo(BigDecimal.ZERO) != 0){
             qoq = thisTotal.subtract(lastTotal).divide(lastTotal).multiply(BigDecimal.valueOf(100));
+            if (thisTotal.compareTo(BigDecimal.ZERO) == 0){
+                qoq = BigDecimal.valueOf(0);
+            }
         }
         electricityProportion.setTotal(thisTotal);
         electricityProportion.setQoq(qoq);
-        electricityProportion.setRateList(rateList);
+        electricityProportion.setList(rateList);
         return electricityProportion;
     }
 
@@ -110,10 +104,12 @@ public class EnergyElectricityServiceImpl extends ServiceImpl<EnergyElectricityM
             energyElectricityList = energyElectricityMapper.listWeek(pigpenId);
         }else if (type.equals("2")){
             energyElectricityList = energyElectricityMapper.listMonth(pigpenId);
-        }else {
+        }else if (type.equals("3")){
             String startDate = energyElectricityListParm.getStartDate() + " 00:00:00";
             String endDate = energyElectricityListParm.getEndDate() + " 23:59:59";
             energyElectricityList = energyElectricityMapper.listCustom(pigpenId,startDate,endDate);
+        }else {
+            energyElectricityList = energyElectricityMapper.listSevenDay(pigpenId);
         }
         electricityTrend.setLocation(location);
         electricityTrend.setEnergyElectricityList(energyElectricityList);
@@ -121,20 +117,20 @@ public class EnergyElectricityServiceImpl extends ServiceImpl<EnergyElectricityM
     }
 
     @Override
-    public EnergyElectricityTopVo listTop(EnergyElectricityTopParm energyElectricityTopParm, String orgId) {
+    public List<EnergyElectricityTopVo> listTop(EnergyElectricityTopParm energyElectricityTopParm, String orgId) {
         String type = energyElectricityTopParm.getType();
-        EnergyElectricityTopVo electricityTop;
+        List<EnergyElectricityTopVo> resultList = new ArrayList<>();
         if (type.equals("0")){
-            electricityTop = energyElectricityMapper.listTodayTop(orgId);
+            resultList = energyElectricityMapper.listTodayTop(orgId);
         }else if (type.equals("1")){
-            electricityTop = energyElectricityMapper.listWeekTop(orgId);
+            resultList = energyElectricityMapper.listWeekTop(orgId);
         }else if (type.equals("2")){
-            electricityTop = energyElectricityMapper.listMonthTop(orgId);
+            resultList = energyElectricityMapper.listMonthTop(orgId);
         }else {
             String startDate = energyElectricityTopParm.getStartDate() + " 00:00:00";
             String endDate = energyElectricityTopParm.getEndDate() + " 23:59:59";
-            electricityTop = energyElectricityMapper.listCustomTop(orgId,startDate,endDate);
+            resultList = energyElectricityMapper.listCustomTop(orgId,startDate,endDate);
         }
-        return electricityTop;
+        return resultList;
     }
 }

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyThreshold/param/EnergyThresholdSaveParam.java

@@ -29,7 +29,7 @@ import java.util.Date;
  **/
 @Getter
 @Setter
-public class EnergyThresholdSaveParam {
+public class EnergyThresholdSaveParam extends  EnergyThresholdOrgIdParam{
 
     /** 单元父id */
     @ApiModelProperty(value = "单元父id", required = true, position = 2)

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyThreshold/param/EnergyThresholdSyncParam.java

@@ -28,7 +28,7 @@ import java.math.BigDecimal;
  **/
 @Getter
 @Setter
-public class EnergyThresholdSyncParam {
+public class EnergyThresholdSyncParam extends EnergyThresholdOrgIdParam{
 
     /** 单元父id */
     @ApiModelProperty(value = "单元父id", required = true, position = 2)

+ 2 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/controller/EnergyWaterController.java

@@ -38,6 +38,7 @@ import vip.xiaonuo.modular.energy.energyWater.service.EnergyWaterService;
 
 
 import javax.annotation.Resource;
+import java.util.List;
 
 /**
  * 能耗水表控制器
@@ -91,7 +92,7 @@ public class EnergyWaterController {
     @ApiOperationSupport(order = 3)
     @ApiOperation("获取用水量排名")
     @GetMapping("/energy/energyWater/listTop")
-    public CommonResult<EnergyWaterTopVo> listTop(EnergyWaterTopParm energyWaterTopParm) {
+    public CommonResult<List<EnergyWaterTopVo>> listTop(EnergyWaterTopParm energyWaterTopParm) {
         String orgId = energyWaterTopParm.getOrgId();
         return CommonResult.data(energyWaterService.listTop(energyWaterTopParm,orgId));
     }

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/entity/EnergyWater.java

@@ -49,7 +49,7 @@ public class EnergyWater {
 
     /** 单元id */
     @ApiModelProperty(value = "单元id", position = 5)
-    private Integer unitId;
+    private String unitId;
 
     /** 组织id */
     @ApiModelProperty(value = "组织id", position = 6)

+ 4 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/entity/vo/EnergyWaterListVo.java

@@ -1,10 +1,12 @@
 package vip.xiaonuo.modular.energy.energyWater.entity.vo;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.math.BigDecimal;
 import java.sql.Date;
+import java.time.LocalDateTime;
 
 @Data
 public class EnergyWaterListVo {
@@ -12,6 +14,7 @@ public class EnergyWaterListVo {
     private BigDecimal waterValue;
 
     @ApiModelProperty(value = "创建时间", position = 2)
-    private Date createTime;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
+    private LocalDateTime createTime;
 
 }

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/entity/vo/EnergyWaterProportionVo.java

@@ -16,5 +16,5 @@ public class EnergyWaterProportionVo {
     private BigDecimal qoq;
 
     @ApiModelProperty(value = "比例列表", position = 3)
-    private List<EnergyWaterRateVo> rateList;
+    private List<EnergyWaterRateVo> list;
 }

+ 2 - 5
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/entity/vo/EnergyWaterRateVo.java

@@ -8,11 +8,8 @@ import java.math.BigDecimal;
 @Data
 public class EnergyWaterRateVo {
     @ApiModelProperty(value = "栋舍名", position = 1)
-    private String buildName;
+    private String name;
 
     @ApiModelProperty(value = "消耗数量", position = 2)
-    private BigDecimal consumptionQuantity;
-
-    @ApiModelProperty(value = "占比", position = 3)
-    private BigDecimal proportion;
+    private BigDecimal value;
 }

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/entity/vo/EnergyWaterTrendVo.java

@@ -12,6 +12,6 @@ public class EnergyWaterTrendVo {
     private String location;
 
     @ApiModelProperty(value = "数据", position = 2)
-    private List<EnergyWaterListVo> energyWaterList;
+    private List<EnergyWaterListVo> list;
 
 }

+ 7 - 4
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/mapper/EnergyWaterMapper.java

@@ -14,6 +14,7 @@ package vip.xiaonuo.modular.energy.energyWater.mapper;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 import vip.xiaonuo.modular.energy.energyWater.entity.EnergyWater;
 import vip.xiaonuo.modular.energy.energyWater.entity.vo.EnergyWaterListVo;
 import vip.xiaonuo.modular.energy.energyWater.entity.vo.EnergyWaterTopVo;
@@ -48,11 +49,13 @@ public interface EnergyWaterMapper extends BaseMapper<EnergyWater> {
 
     List<EnergyWaterListVo> listCustom(String pigpenId, String startDate, String endDate);
 
-    EnergyWaterTopVo listTodayTop(String orgId);
+    List<EnergyWaterTopVo> listTodayTop(String orgId);
 
-    EnergyWaterTopVo listWeekTop(String orgId);
+    List<EnergyWaterTopVo> listWeekTop(String orgId);
 
-    EnergyWaterTopVo listMonthTop(String orgId);
+    List<EnergyWaterTopVo> listMonthTop(String orgId);
 
-    EnergyWaterTopVo listCustomTop(String orgId, String startDate, String endDate);
+    List<EnergyWaterTopVo> listCustomTop(String orgId, String startDate, String endDate);
+
+    List<EnergyWaterListVo> listSevenDay(String pigpenId);
 }

+ 21 - 7
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/mapper/mapping/EnergyWaterMapper.xml

@@ -34,8 +34,8 @@
             w.unit_id = p.id
         WHERE
             w.org_id = #{orgId}
-            p.stage = #{stage}
-            AND YEARWEEK(e.create_date, 1) = YEARWEEK(CURDATE(), 1)
+            AND p.stage = #{stage}
+            AND YEARWEEK(w.create_date, 1) = YEARWEEK(CURDATE(), 1)
     </select>
 
     <select id="getMonthTotal" resultType="java.math.BigDecimal" parameterType="java.lang.String">
@@ -71,9 +71,9 @@
             w.unit_id = p.id
         WHERE
             w.org_id = #{orgId}
-            p.stage = #{stage}
-            AND MONTH(e.create_date) = MONTH(CURDATE())
-            AND YEAR(e.create_date) = YEAR(CURDATE())
+            AND p.stage = #{stage}
+            AND MONTH(w.create_date) = MONTH(CURDATE())
+            AND YEAR(w.create_date) = YEAR(CURDATE())
     </select>
     <select id="listToday" resultType="vip.xiaonuo.modular.energy.energyWater.entity.vo.EnergyWaterListVo" parameterType="java.lang.String">
         SELECT
@@ -195,7 +195,7 @@
     <select id="listCustomTop" resultType="vip.xiaonuo.modular.energy.energyWater.entity.vo.EnergyWaterTopVo">
         SELECT
             p.full_name as 'location',
-            ROUND(SUM(w.water_value), 2) as 'energyWaterValue''
+            ROUND(SUM(w.water_value), 2) as 'energyWaterValue'
         FROM
             `energy_water` w
         LEFT JOIN
@@ -204,11 +204,25 @@
             w.unit_id = p.id
         WHERE
             w.org_id = #{orgId}
-            AND w.create_date BETWEEN #{startDate} AND #{endDate}
+            AND w.create_date BETWEEN '${startDate}' AND '${endDate}'
         GROUP BY
             w.unit_id
         ORDER BY
             energyWaterValue DESC
         LIMIT 6
     </select>
+    <select id="listSevenDay" resultType="vip.xiaonuo.modular.energy.energyWater.entity.vo.EnergyWaterListVo">
+        SELECT
+            ROUND(AVG(water_value), 2) AS 'waterValue',
+            DATE(create_date) AS 'createTime'
+        FROM
+            `energy_water`
+        WHERE
+            unit_id = #{pigpenId}
+            AND create_date BETWEEN CURDATE() - INTERVAL 6 DAY AND CURDATE();
+        GROUP BY
+            DATE(create_date)
+        ORDER BY
+            DATE(create_date) ASC;
+    </select>
 </mapper>

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/param/EnergyWaterTopParm.java

@@ -16,7 +16,7 @@ public class EnergyWaterTopParm extends EnergyWaterOrgIdParam{
 
     /** 开始时间 */
     @ApiModelProperty(value = "开始时间", position = 2)
-        private String startDate;
+    private String startDate;
 
     /** 结束时间 */
     @ApiModelProperty(value = "结束时间", position = 3)

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/service/EnergyWaterService.java

@@ -36,5 +36,5 @@ public interface EnergyWaterService extends IService<EnergyWater> {
 
     EnergyWaterTrendVo listTrend(EnergyWaterListParm energyWaterListParm);
 
-    EnergyWaterTopVo listTop(EnergyWaterTopParm energyWaterTopParm, String orgId);
+    List<EnergyWaterTopVo> listTop(EnergyWaterTopParm energyWaterTopParm, String orgId);
 }

+ 22 - 26
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/service/impl/EnergyWaterServiceImpl.java

@@ -29,6 +29,7 @@ import vip.xiaonuo.modular.energy.energyWater.param.EnergyWaterTopParm;
 import vip.xiaonuo.modular.energy.energyWater.service.EnergyWaterService;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -58,20 +59,15 @@ public class EnergyWaterServiceImpl extends ServiceImpl<EnergyWaterMapper, Energ
         String parentId = baseConfigMapper.selectOne(new QueryWrapper<BaseConfig>().eq("config_name", "栋舍阶段").eq("parent_id", 0)).getId();
         List<BaseConfig> buildStage = baseConfigMapper.selectList(new QueryWrapper<BaseConfig>().eq("parent_id", parentId).orderByAsc("sort_code"));
         List<String> stages = buildStage.stream().map(config -> config.getConfigName()).collect(Collectors.toList());
-        List<EnergyWaterRateVo> rateList = null;
+        List<EnergyWaterRateVo> rateList = new ArrayList<>();
         if (type.equals("0")){
             thisTotal = energyWaterMapper.getWeekTotal(orgId);
             lastTotal = energyWaterMapper.getLastWeekTotal(orgId);
             for (String stage : stages) {
                 EnergyWaterRateVo rate = new EnergyWaterRateVo();
-                BigDecimal proportion = BigDecimal.ZERO;
                 BigDecimal weekTotal = energyWaterMapper.getWeekTotalByType(stage, orgId);
-                rate.setBuildName(stage+"舍");
-                rate.setConsumptionQuantity(weekTotal);
-                if (!thisTotal.equals(BigDecimal.ZERO)){
-                    proportion = weekTotal.divide(thisTotal).multiply(BigDecimal.valueOf(100));
-                }
-                rate.setProportion(proportion);
+                rate.setName(stage+"舍");
+                rate.setValue(weekTotal);
                 rateList.add(rate);
             }
         }else {
@@ -79,23 +75,21 @@ public class EnergyWaterServiceImpl extends ServiceImpl<EnergyWaterMapper, Energ
             lastTotal = energyWaterMapper.getLastMonthTotal(orgId);
             for (String stage : stages) {
                 EnergyWaterRateVo rate = new EnergyWaterRateVo();
-                BigDecimal proportion = BigDecimal.ZERO;
                 BigDecimal weekTotal = energyWaterMapper.getMonthTotalByType(stage, orgId);
-                rate.setBuildName(stage+"舍");
-                rate.setConsumptionQuantity(weekTotal);
-                if (!thisTotal.equals(BigDecimal.ZERO)){
-                    proportion = weekTotal.divide(thisTotal).multiply(BigDecimal.valueOf(100));
-                }
-                rate.setProportion(proportion);
+                rate.setName(stage+"舍");
+                rate.setValue(weekTotal);
                 rateList.add(rate);
             }
         }
-        if (!lastTotal.equals(BigDecimal.ZERO)){
+        if (lastTotal.compareTo(BigDecimal.ZERO) != 0){
             qoq = thisTotal.subtract(lastTotal).divide(lastTotal).multiply(BigDecimal.valueOf(100));
+            if (thisTotal.compareTo(BigDecimal.ZERO) == 0){
+                qoq = BigDecimal.valueOf(0);
+            }
         }
         energyWaterProportion.setTotal(thisTotal);
         energyWaterProportion.setQoq(qoq);
-        energyWaterProportion.setRateList(rateList);
+        energyWaterProportion.setList(rateList);
         return energyWaterProportion;
     }
 
@@ -112,31 +106,33 @@ public class EnergyWaterServiceImpl extends ServiceImpl<EnergyWaterMapper, Energ
             energyWaterList = energyWaterMapper.listWeek(pigpenId);
         }else if (type.equals("2")){
             energyWaterList = energyWaterMapper.listMonth(pigpenId);
-        }else {
+        }else if (type.equals("3")){
             String startDate = energyWaterListParm.getStartDate() + " 00:00:00";
             String endDate = energyWaterListParm.getEndDate() + " 23:59:59";
             energyWaterList = energyWaterMapper.listCustom(pigpenId,startDate,endDate);
+        }else {
+            energyWaterList = energyWaterMapper.listSevenDay(pigpenId);
         }
         waterTrend.setLocation(location);
-        waterTrend.setEnergyWaterList(energyWaterList);
+        waterTrend.setList(energyWaterList);
         return waterTrend;
     }
 
     @Override
-    public EnergyWaterTopVo listTop(EnergyWaterTopParm energyWaterTopParm, String orgId) {
+    public List<EnergyWaterTopVo> listTop(EnergyWaterTopParm energyWaterTopParm, String orgId) {
         String type = energyWaterTopParm.getType();
-        EnergyWaterTopVo waterTop;
+        List<EnergyWaterTopVo> resultList;
         if (type.equals("0")){
-            waterTop = energyWaterMapper.listTodayTop(orgId);
+            resultList = energyWaterMapper.listTodayTop(orgId);
         }else if (type.equals("1")){
-            waterTop = energyWaterMapper.listWeekTop(orgId);
+            resultList = energyWaterMapper.listWeekTop(orgId);
         }else if (type.equals("2")){
-            waterTop = energyWaterMapper.listMonthTop(orgId);
+            resultList = energyWaterMapper.listMonthTop(orgId);
         }else {
             String startDate = energyWaterTopParm.getStartDate() + " 00:00:00";
             String endDate = energyWaterTopParm.getEndDate() + " 23:59:59";
-            waterTop = energyWaterMapper.listCustomTop(orgId,startDate,endDate);
+            resultList = energyWaterMapper.listCustomTop(orgId,startDate,endDate);
         }
-        return waterTop;
+        return resultList;
     }
 }

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

@@ -18,13 +18,13 @@ 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.pojo.CommonResult;
 import vip.xiaonuo.modular.energy.energythreshold.entity.EnergyThreshold;
-import vip.xiaonuo.modular.energy.energythreshold.param.EnergyThresholdModifyParam;
-import vip.xiaonuo.modular.energy.energythreshold.param.EnergyThresholdSaveParam;
-import vip.xiaonuo.modular.energy.energythreshold.param.EnergyThresholdSyncParam;
-import vip.xiaonuo.modular.energy.energythreshold.param.EnergyThresholdUnitIdParam;
+import vip.xiaonuo.modular.energy.energythreshold.entity.vo.EnergyThresholdListVo;
+import vip.xiaonuo.modular.energy.energythreshold.param.*;
 import vip.xiaonuo.modular.energy.energythreshold.service.EnergyThresholdService;
 import vip.xiaonuo.modular.env.envThreshold.entity.EnvThreshold;
 import vip.xiaonuo.modular.env.envThreshold.param.EnvThresholdModifyParam;
@@ -33,6 +33,7 @@ import vip.xiaonuo.modular.env.envThreshold.param.EnvThresholdSyncParam;
 import vip.xiaonuo.modular.env.envThreshold.param.EnvThresholdUnitIdParam;
 
 import javax.annotation.Resource;
+import java.util.List;
 
 /**
  * 能耗阈值控制器
@@ -56,10 +57,10 @@ public class EnergyThresholdController {
      * @date  2023/12/26 10:20
      */
     @ApiOperationSupport(order = 1)
-    @ApiOperation("根据单元ID获取能耗阈值")
-    @GetMapping("/energy/energyThreshold/getThresholdByUnitId")
-    public CommonResult<EnergyThreshold> getThresholdByUnitId(EnergyThresholdUnitIdParam energyThresholdUnitIdParam) {
-        return CommonResult.data(energyThresholdService.getThresholdByUnitId(energyThresholdUnitIdParam));
+    @ApiOperation("获取能耗阈值")
+    @GetMapping("/energy/energyThreshold/getThreshold")
+    public CommonResult<List<EnergyThresholdListVo>> getThreshold(EnergyThresholdOrgIdParam energyThresholdOrgIdParam) {
+        return CommonResult.data(energyThresholdService.getThreshold(energyThresholdOrgIdParam));
     }
 
     /**
@@ -70,8 +71,8 @@ public class EnergyThresholdController {
      */
     @ApiOperationSupport(order = 1)
     @ApiOperation("编辑能耗阈值")
-    @GetMapping("/energy/energyThreshold/saveThreshold")
-    public CommonResult<String> saveThreshold(EnergyThresholdSaveParam energyThresholdSaveParam) {
+    @PostMapping("/energy/energyThreshold/saveThreshold")
+    public CommonResult<String> saveThreshold(@RequestBody EnergyThresholdSaveParam energyThresholdSaveParam) {
         energyThresholdService.saveThreshold(energyThresholdSaveParam);
         return CommonResult.ok();
     }
@@ -85,8 +86,8 @@ public class EnergyThresholdController {
      */
     @ApiOperationSupport(order = 2)
     @ApiOperation("修改能耗阈值状态")
-    @GetMapping("/energy/energyThreshold/modifyThresholdStatus")
-    public CommonResult<String> modifyThresholdStatus(EnergyThresholdModifyParam energyThresholdModifyParam) {
+    @PostMapping("/energy/energyThreshold/modifyThresholdStatus")
+    public CommonResult<String> modifyThresholdStatus(@RequestBody EnergyThresholdModifyParam energyThresholdModifyParam) {
         energyThresholdService.modifyThresholdStatus(energyThresholdModifyParam);
         return CommonResult.ok();
     }
@@ -99,8 +100,8 @@ public class EnergyThresholdController {
      */
     @ApiOperationSupport(order = 2)
     @ApiOperation("同步能耗阈值")
-    @GetMapping("/energy/energyThreshold/syncThreshold")
-    public CommonResult<String> syncThreshold(EnergyThresholdSyncParam energyThresholdSyncParam) {
+    @PostMapping("/energy/energyThreshold/syncThreshold")
+    public CommonResult<String> syncThreshold(@RequestBody EnergyThresholdSyncParam energyThresholdSyncParam) {
         energyThresholdService.syncThreshold(energyThresholdSyncParam);
         return CommonResult.ok();
     }

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

@@ -16,6 +16,8 @@ import com.baomidou.mybatisplus.annotation.*;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
+import vip.xiaonuo.common.pojo.CommonEntity;
+
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -28,7 +30,7 @@ import java.util.Date;
 @Getter
 @Setter
 @TableName("energy_threshold")
-public class EnergyThreshold {
+public class EnergyThreshold extends CommonEntity {
 
     /** id */
     @TableId
@@ -78,30 +80,4 @@ public class EnergyThreshold {
     /** 组织id */
     @ApiModelProperty(value = "组织id", position = 12)
     private String orgId;
-
-    /** 删除标志 */
-    @ApiModelProperty(value = "删除标志", position = 13)
-    @TableLogic
-    @TableField(fill = FieldFill.INSERT)
-    private String deleteFlag;
-
-    /** 创建时间 */
-    @ApiModelProperty(value = "创建时间", position = 14)
-    @TableField(fill = FieldFill.INSERT)
-    private Date createTime;
-
-    /** 创建用户 */
-    @ApiModelProperty(value = "创建用户", position = 15)
-    @TableField(fill = FieldFill.INSERT)
-    private String createUser;
-
-    /** 修改时间 */
-    @ApiModelProperty(value = "修改时间", position = 16)
-    @TableField(fill = FieldFill.UPDATE)
-    private Date updateTime;
-
-    /** 修改用户 */
-    @ApiModelProperty(value = "修改用户", position = 17)
-    @TableField(fill = FieldFill.UPDATE)
-    private String updateUser;
 }

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

@@ -10,42 +10,36 @@
  * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
  * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
  */
-package vip.xiaonuo.modular.energy.energythreshold.param;
+package vip.xiaonuo.modular.energy.energythreshold.entity.vo;
 
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fhs.core.trans.anno.Trans;
+import com.fhs.core.trans.constant.TransType;
+import com.fhs.core.trans.vo.TransPojo;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
+import vip.xiaonuo.modular.base.pigpen.entity.BasePigpen;
+import vip.xiaonuo.modular.env.envThreshold.entity.vo.EnvThresholdVo;
+
 import java.math.BigDecimal;
-import java.util.Date;
+import java.util.List;
 
 /**
- * 阈值设置查询参数
+ * 能耗阈值实体
  *
- * @author wang
- * @date  2023/12/25 09:43
+ * @author newspaper
+ * @date  2023/12/26 09:32
  **/
 @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;
+public class EnergyThresholdListVo{
+    @ApiModelProperty(value = "栋舍id", position = 1)
+    private String buildingId;
 
-    /** 关键词 */
-    @ApiModelProperty(value = "关键词")
-    private String searchKey;
+    @ApiModelProperty(value = "栋舍名称", position = 2)
+    private String buildingName;
 
+    @ApiModelProperty(value = "单元阈值数组", position = 3)
+    private List<EnergyThresholdVo> list;
 }

+ 89 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energythreshold/entity/vo/EnergyThresholdVo.java

@@ -0,0 +1,89 @@
+/*
+ * 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.vo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fhs.core.trans.anno.Trans;
+import com.fhs.core.trans.constant.TransType;
+import com.fhs.core.trans.vo.TransPojo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import vip.xiaonuo.modular.base.pigpen.entity.BasePigpen;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 能耗阈值实体
+ *
+ * @author newspaper
+ * @date  2023/12/26 09:32
+ **/
+@Getter
+@Setter
+public class EnergyThresholdVo implements TransPojo {
+
+    /** id */
+    @ApiModelProperty(value = "id", position = 1)
+    private String id;
+
+    /** 阈值对象 */
+    @ApiModelProperty(value = "单元id", position = 2)
+    @Trans(type = TransType.SIMPLE, target = BasePigpen.class,fields = "fullName", alias = "unit", ref = "unitName")
+    private String unitId;
+
+    /** 0为不启用 1为启用 */
+    @ApiModelProperty(value = "0为不启用 1为启用", position = 3)
+    private Integer isEnable;
+
+    /** 用水下限 */
+    @ApiModelProperty(value = "用水下限", position = 4)
+    private BigDecimal waterLower;
+
+    /** 用水上限 */
+    @ApiModelProperty(value = "用水上限", position = 5)
+    private BigDecimal waterUpper;
+
+    /** 用电下限 */
+    @ApiModelProperty(value = "用电下限", position = 6)
+    private BigDecimal electricityLower;
+
+    /** 用电上限 */
+    @ApiModelProperty(value = "用电上限", position = 7)
+    private BigDecimal electricityUpper;
+
+    /** 七日用水下限 */
+    @ApiModelProperty(value = "七日用水下限", position = 8)
+    private BigDecimal sevenDayWaterLower;
+
+    /** 七日用水上限 */
+    @ApiModelProperty(value = "七日用水上限", position = 9)
+    private BigDecimal sevenDayWaterUpper;
+
+    /** 七日用电上限 */
+    @ApiModelProperty(value = "七日用电上限", position = 10)
+    private BigDecimal sevenDayElectricityLower;
+
+    /** 七日用电下限 */
+    @ApiModelProperty(value = "七日用电下限", position = 11)
+    private BigDecimal sevenDayElectricityUpper;
+
+    /** 组织id */
+    @ApiModelProperty(value = "组织id", position = 12)
+    private String orgId;
+
+    /** 单元ID */
+    @ApiModelProperty(value = "单元名称", position = 23)
+    private String unitName;
+}

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

@@ -1,78 +0,0 @@
-/*
- * 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;
-
-}

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

@@ -1,73 +0,0 @@
-/*
- * 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;
-
-}

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

@@ -1,83 +0,0 @@
-/*
- * 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;
-
-}

+ 5 - 5
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyThreshold/param/EnergyThresholdUnitIdParam.java

@@ -26,10 +26,10 @@ import javax.validation.constraints.NotBlank;
  **/
 @Getter
 @Setter
-public class EnergyThresholdUnitIdParam {
+public class EnergyThresholdOrgIdParam {
 
-    /** 单元父id */
-    @ApiModelProperty(value = "单元父id", required = true)
-    @NotBlank(message = "unitId不能为空")
-    private String unitId;
+    /** 组织id */
+    @ApiModelProperty(value = "组织id", required = true,position = 99)
+    @NotBlank(message = "orgId不能为空")
+    private String orgId;
 }

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

@@ -14,10 +14,10 @@ package vip.xiaonuo.modular.energy.energythreshold.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import vip.xiaonuo.modular.energy.energythreshold.entity.EnergyThreshold;
-import vip.xiaonuo.modular.energy.energythreshold.param.EnergyThresholdModifyParam;
-import vip.xiaonuo.modular.energy.energythreshold.param.EnergyThresholdSaveParam;
-import vip.xiaonuo.modular.energy.energythreshold.param.EnergyThresholdSyncParam;
-import vip.xiaonuo.modular.energy.energythreshold.param.EnergyThresholdUnitIdParam;
+import vip.xiaonuo.modular.energy.energythreshold.entity.vo.EnergyThresholdListVo;
+import vip.xiaonuo.modular.energy.energythreshold.param.*;
+
+import java.util.List;
 
 /**
  * 能耗阈值Service接口
@@ -33,7 +33,7 @@ public interface EnergyThresholdService extends IService<EnergyThreshold> {
      * @author newspaper
      * @date  2023/12/26 10:20
      */
-    EnergyThreshold getThresholdByUnitId(EnergyThresholdUnitIdParam energyThresholdUnitIdParam);
+    List<EnergyThresholdListVo> getThreshold(EnergyThresholdOrgIdParam energyThresholdOrgIdParam);
 
     /**
      * 编辑能耗阈值

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

@@ -23,13 +23,13 @@ import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
 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.entity.vo.EnergyThresholdListVo;
+import vip.xiaonuo.modular.energy.energythreshold.entity.vo.EnergyThresholdVo;
 import vip.xiaonuo.modular.energy.energythreshold.mapper.EnergyThresholdMapper;
-import vip.xiaonuo.modular.energy.energythreshold.param.EnergyThresholdModifyParam;
-import vip.xiaonuo.modular.energy.energythreshold.param.EnergyThresholdSaveParam;
-import vip.xiaonuo.modular.energy.energythreshold.param.EnergyThresholdSyncParam;
-import vip.xiaonuo.modular.energy.energythreshold.param.EnergyThresholdUnitIdParam;
+import vip.xiaonuo.modular.energy.energythreshold.param.*;
 import vip.xiaonuo.modular.energy.energythreshold.service.EnergyThresholdService;
 import vip.xiaonuo.modular.env.envThreshold.entity.EnvThreshold;
+import vip.xiaonuo.modular.env.envThreshold.entity.vo.EnvThresholdVo;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -48,22 +48,42 @@ public class EnergyThresholdServiceImpl extends ServiceImpl<EnergyThresholdMappe
     private BasePigpenMapper basePigpenMapper;
 
     @Override
-    public EnergyThreshold getThresholdByUnitId(EnergyThresholdUnitIdParam energyThresholdUnitIdParam) {
-        String orgId = StpLoginUserUtil.getLoginUser().getOrgId();
-        String unitId = energyThresholdUnitIdParam.getUnitId();
-        EnergyThreshold energyThreshold = this.getOne(new QueryWrapper<EnergyThreshold>().lambda().eq(EnergyThreshold::getOrgId, orgId).eq(EnergyThreshold::getUnitId, unitId));
-        if (ObjectUtil.isEmpty(energyThreshold)){
-            energyThreshold = new EnergyThreshold();
-            energyThreshold.setOrgId(orgId);
-            energyThreshold.setUnitId(unitId);
-            this.save(energyThreshold);
+    public List<EnergyThresholdListVo> getThreshold(EnergyThresholdOrgIdParam energyThresholdOrgIdParam) {
+        String orgId = energyThresholdOrgIdParam.getOrgId();
+        List<EnergyThresholdListVo> resultList = new ArrayList<>();
+        List<BasePigpen> basePigpens = basePigpenMapper.selectList(new QueryWrapper<BasePigpen>().lambda().eq(BasePigpen::getOrgId, orgId).eq(BasePigpen::getType,0));
+        for (BasePigpen basePigpen : basePigpens) {
+            EnergyThresholdListVo energyThresholdListVo = new EnergyThresholdListVo();
+            energyThresholdListVo.setBuildingId(basePigpen.getId());
+            energyThresholdListVo.setBuildingName(basePigpen.getBuildName());
+            List<EnergyThresholdVo> energyThresholdVos = new ArrayList<>();
+            List<BasePigpen> floorBasePigpens = basePigpenMapper.selectList(new QueryWrapper<BasePigpen>().lambda().eq(BasePigpen::getParentId, basePigpen.getId()));
+            if (ObjectUtil.isNotEmpty(floorBasePigpens)){
+                List<String> floorIds = floorBasePigpens.stream().map(basePigpen1 -> basePigpen1.getId()).collect(Collectors.toList());
+                List<BasePigpen> basePigpens1 = basePigpenMapper.selectList(new QueryWrapper<BasePigpen>().lambda().in(BasePigpen::getParentId, floorIds));
+                for (BasePigpen pigpen : basePigpens1) {
+                    String unitId = pigpen.getId();
+                    EnergyThresholdVo energyThresholdVo = new EnergyThresholdVo();
+                    EnergyThreshold energyThreshold = this.getOne(new QueryWrapper<EnergyThreshold>().lambda().eq(EnergyThreshold::getOrgId, orgId).eq(EnergyThreshold::getUnitId, unitId));
+                    if (ObjectUtil.isEmpty(energyThreshold)){
+                        energyThreshold = new EnergyThreshold();
+                        energyThreshold.setOrgId(orgId);
+                        energyThreshold.setUnitId(unitId);
+                        this.save(energyThreshold);
+                    }
+                    BeanUtil.copyProperties(energyThreshold,energyThresholdVo);
+                    energyThresholdVos.add(energyThresholdVo);
+                }
+            }
+            energyThresholdListVo.setList(energyThresholdVos);
+            resultList.add(energyThresholdListVo);
         }
-        return energyThreshold;
+        return resultList;
     }
 
     @Override
     public void saveThreshold(EnergyThresholdSaveParam energyThresholdSaveParam) {
-        String orgId = StpLoginUserUtil.getLoginUser().getOrgId();
+        String orgId = energyThresholdSaveParam.getOrgId();
         EnergyThreshold energyThreshold = this.getOne(new QueryWrapper<EnergyThreshold>().lambda().eq(EnergyThreshold::getOrgId, orgId).eq(EnergyThreshold::getUnitId, energyThresholdSaveParam.getUnitId()));
         BeanUtil.copyProperties(energyThresholdSaveParam,energyThreshold);
         this.updateById(energyThreshold);
@@ -79,7 +99,7 @@ public class EnergyThresholdServiceImpl extends ServiceImpl<EnergyThresholdMappe
 
     @Override
     public void syncThreshold(EnergyThresholdSyncParam energyThresholdSyncParam) {
-        String orgId = StpLoginUserUtil.getLoginUser().getOrgId();
+        String orgId = energyThresholdSyncParam.getOrgId();
         List<BasePigpen> basePigpens = basePigpenMapper.selectList(new QueryWrapper<BasePigpen>().lambda()
                 .like(BasePigpen::getPids, energyThresholdSyncParam.getUnitId())
                 .eq(BasePigpen::getOrgId, orgId)

+ 12 - 11
snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envThreshold/controller/EnvThresholdController.java

@@ -21,19 +21,20 @@ 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.pojo.CommonResult;
 import vip.xiaonuo.modular.env.envThreshold.entity.EnvThreshold;
-import vip.xiaonuo.modular.env.envThreshold.param.EnvThresholdModifyParam;
-import vip.xiaonuo.modular.env.envThreshold.param.EnvThresholdSaveParam;
-import vip.xiaonuo.modular.env.envThreshold.param.EnvThresholdSyncParam;
-import vip.xiaonuo.modular.env.envThreshold.param.EnvThresholdUnitIdParam;
+import vip.xiaonuo.modular.env.envThreshold.entity.vo.EnvThresholdListVo;
+import vip.xiaonuo.modular.env.envThreshold.param.*;
 import vip.xiaonuo.modular.env.envThreshold.service.EnvThresholdService;
 import vip.xiaonuo.modular.warning.warningManager.entity.vo.WarningManagerVo;
 import vip.xiaonuo.modular.warning.warningManager.param.WarningManagerTypeParam;
 
 import javax.annotation.Resource;
+import javax.validation.Valid;
+import java.util.List;
 
 /**
  * 环控阈值控制器
@@ -57,10 +58,10 @@ public class EnvThresholdController {
      * @date  2023/12/25 15:45
      */
     @ApiOperationSupport(order = 1)
-    @ApiOperation("根据单元ID获取环控阈值")
-    @GetMapping("/env/envThreshold/getThresholdByUnitId")
-    public CommonResult<EnvThreshold> getThresholdByUnitId(EnvThresholdUnitIdParam envThresholdUnitIdParam) {
-        return CommonResult.data(envThresholdService.getThresholdByUnitId(envThresholdUnitIdParam));
+    @ApiOperation("获取环控阈值")
+    @GetMapping("/env/envThreshold/getThreshold")
+    public CommonResult<List<EnvThresholdListVo>> getThreshold(EnvThresholdOrgIdParam envThresholdOrgIdParam) {
+        return CommonResult.data(envThresholdService.getThreshold(envThresholdOrgIdParam));
     }
 
     /**
@@ -72,7 +73,7 @@ public class EnvThresholdController {
     @ApiOperationSupport(order = 2)
     @ApiOperation("编辑环控阈值")
     @PostMapping("/env/envThreshold/saveThreshold")
-    public CommonResult<String> saveThreshold(EnvThresholdSaveParam envThresholdSaveParam) {
+    public CommonResult<String> saveThreshold(@RequestBody @Valid EnvThresholdSaveParam envThresholdSaveParam) {
         envThresholdService.saveThreshold(envThresholdSaveParam);
         return CommonResult.ok();
     }
@@ -87,7 +88,7 @@ public class EnvThresholdController {
     @ApiOperationSupport(order = 3)
     @ApiOperation("修改环控阈值状态")
     @PostMapping("/env/envThreshold/modifyThresholdStatus")
-    public CommonResult<String> modifyThresholdStatus(EnvThresholdModifyParam envThresholdModifyParam) {
+    public CommonResult<String> modifyThresholdStatus(@RequestBody @Valid EnvThresholdModifyParam envThresholdModifyParam) {
         envThresholdService.modifyThresholdStatus(envThresholdModifyParam);
         return CommonResult.ok();
     }
@@ -101,7 +102,7 @@ public class EnvThresholdController {
     @ApiOperationSupport(order = 4)
     @ApiOperation("同步环控阈值")
     @PostMapping("/env/envThreshold/syncThreshold")
-    public CommonResult<String> syncThreshold(EnvThresholdSyncParam envThresholdSyncParam) {
+    public CommonResult<String> syncThreshold(@RequestBody @Valid EnvThresholdSyncParam envThresholdSyncParam) {
         envThresholdService.syncThreshold(envThresholdSyncParam);
         return CommonResult.ok();
     }

+ 1 - 2
snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envThreshold/entity/EnvThreshold.java

@@ -111,6 +111,5 @@ public class EnvThreshold extends CommonEntity {
 
     /** 组织ID */
     @ApiModelProperty(value = "组织ID", position = 20)
-
-private String orgId;
+    private String orgId;
 }

+ 20 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envThreshold/entity/vo/EnvThresholdListVo.java

@@ -0,0 +1,20 @@
+package vip.xiaonuo.modular.env.envThreshold.entity.vo;
+
+import com.fhs.core.trans.anno.Trans;
+import com.fhs.core.trans.constant.TransType;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import vip.xiaonuo.modular.base.pigpen.entity.BasePigpen;
+
+import java.util.List;
+
+@Data
+public class EnvThresholdListVo {
+    @ApiModelProperty(value = "栋舍id", position = 1)
+    private String buildingId;
+
+    @ApiModelProperty(value = "栋舍名称", position = 2)
+    private String buildingName;
+
+    private List<EnvThresholdVo> list;
+}

+ 122 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envThreshold/entity/vo/EnvThresholdVo.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.env.envThreshold.entity.vo;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fhs.core.trans.anno.Trans;
+import com.fhs.core.trans.constant.TransType;
+import com.fhs.core.trans.vo.TransPojo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import vip.xiaonuo.common.pojo.CommonEntity;
+import vip.xiaonuo.modular.base.pigpen.entity.BasePigpen;
+
+import java.math.BigDecimal;
+
+/**
+ * 环控阈值实体
+ *
+ * @author newspaper
+ * @date  2023/12/25 15:38
+ **/
+@Getter
+@Setter
+public class EnvThresholdVo extends CommonEntity implements TransPojo {
+
+    /** id */
+    @ApiModelProperty(value = "id", position = 1)
+    private String id;
+
+    /** 春季温度上限 */
+    @ApiModelProperty(value = "春季温度上限", position = 2)
+    private BigDecimal springTemUpper;
+
+    /** 春季温度下限 */
+    @ApiModelProperty(value = "春季温度下限", position = 3)
+    private BigDecimal springTemLower;
+
+    /** 春季湿度上限 */
+    @ApiModelProperty(value = "春季湿度上限", position = 4)
+    private BigDecimal springHumiUpper;
+
+    /** 春季湿度下限 */
+    @ApiModelProperty(value = "春季湿度下限", position = 5)
+    private BigDecimal springHumiLower;
+
+    /** 夏季温度上限 */
+    @ApiModelProperty(value = "夏季温度上限", position = 6)
+    private BigDecimal summerTemUpper;
+
+    /** 夏季温度下限 */
+    @ApiModelProperty(value = "夏季温度下限", position = 7)
+    private BigDecimal summerTemLower;
+
+    /** 夏季湿度上限 */
+    @ApiModelProperty(value = "夏季湿度上限", position = 8)
+    private BigDecimal summerHumiUpper;
+
+    /** 夏季湿度下限 */
+    @ApiModelProperty(value = "夏季湿度下限", position = 9)
+    private BigDecimal summerHumiLower;
+
+    /** 秋季温度上限 */
+    @ApiModelProperty(value = "秋季温度上限", position = 10)
+    private BigDecimal autumnTemUpper;
+
+    /** 秋季温度下限 */
+    @ApiModelProperty(value = "秋季温度下限", position = 11)
+    private BigDecimal autumnTemLower;
+
+    /** 秋季湿度上限 */
+    @ApiModelProperty(value = "秋季湿度上限", position = 12)
+    private BigDecimal autumnHumiUpper;
+
+    /** 冬季湿度下限 */
+    @ApiModelProperty(value = "冬季湿度下限", position = 13)
+    private BigDecimal autumnHumiLower;
+
+    /** 冬季温度上限 */
+    @ApiModelProperty(value = "冬季温度上限", position = 14)
+    private BigDecimal winterTemUpper;
+
+    /** 冬季温度下限 */
+    @ApiModelProperty(value = "冬季温度下限", position = 15)
+    private BigDecimal winterTemLower;
+
+    /** 冬季湿度上限 */
+    @ApiModelProperty(value = "冬季湿度上限", position = 16)
+    private BigDecimal winterHumiUpper;
+
+    /** 冬季湿度下限 */
+    @ApiModelProperty(value = "冬季湿度下限", position = 17)
+    private BigDecimal winterHumiLower;
+
+    /** 状态 */
+    @ApiModelProperty(value = "状态", position = 18)
+    private Integer isEnable;
+
+    /** 单元ID */
+    @ApiModelProperty(value = "单元ID", position = 19)
+    @Trans(type = TransType.SIMPLE, target = BasePigpen.class,fields = "fullName", alias = "unit", ref = "unitName")
+    private String unitId;
+
+    /** 单元ID */
+    @ApiModelProperty(value = "单元名称", position = 20)
+    private String unitName;
+
+    /** 组织ID */
+    @ApiModelProperty(value = "组织ID", position = 21)
+    private String orgId;
+}

+ 5 - 5
snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envThreshold/service/EnvThresholdService.java

@@ -14,10 +14,10 @@ package vip.xiaonuo.modular.env.envThreshold.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import vip.xiaonuo.modular.env.envThreshold.entity.EnvThreshold;
-import vip.xiaonuo.modular.env.envThreshold.param.EnvThresholdModifyParam;
-import vip.xiaonuo.modular.env.envThreshold.param.EnvThresholdSaveParam;
-import vip.xiaonuo.modular.env.envThreshold.param.EnvThresholdSyncParam;
-import vip.xiaonuo.modular.env.envThreshold.param.EnvThresholdUnitIdParam;
+import vip.xiaonuo.modular.env.envThreshold.entity.vo.EnvThresholdListVo;
+import vip.xiaonuo.modular.env.envThreshold.param.*;
+
+import java.util.List;
 
 /**
  * 环控阈值Service接口
@@ -33,7 +33,7 @@ public interface EnvThresholdService extends IService<EnvThreshold> {
      * @author newspaper
      * @date  2023/12/25 15:45
      */
-    EnvThreshold getThresholdByUnitId(EnvThresholdUnitIdParam envThresholdUnitIdParam);
+    List<EnvThresholdListVo> getThreshold(EnvThresholdOrgIdParam envThresholdOrgIdParam);
 
     /**
      * 编辑环控阈值

+ 34 - 14
snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envThreshold/service/impl/EnvThresholdServiceImpl.java

@@ -24,11 +24,10 @@ import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
 import vip.xiaonuo.modular.base.pigpen.entity.BasePigpen;
 import vip.xiaonuo.modular.base.pigpen.mapper.BasePigpenMapper;
 import vip.xiaonuo.modular.env.envThreshold.entity.EnvThreshold;
+import vip.xiaonuo.modular.env.envThreshold.entity.vo.EnvThresholdListVo;
+import vip.xiaonuo.modular.env.envThreshold.entity.vo.EnvThresholdVo;
 import vip.xiaonuo.modular.env.envThreshold.mapper.EnvThresholdMapper;
-import vip.xiaonuo.modular.env.envThreshold.param.EnvThresholdModifyParam;
-import vip.xiaonuo.modular.env.envThreshold.param.EnvThresholdSaveParam;
-import vip.xiaonuo.modular.env.envThreshold.param.EnvThresholdSyncParam;
-import vip.xiaonuo.modular.env.envThreshold.param.EnvThresholdUnitIdParam;
+import vip.xiaonuo.modular.env.envThreshold.param.*;
 import vip.xiaonuo.modular.env.envThreshold.service.EnvThresholdService;
 
 import javax.validation.constraints.NotBlank;
@@ -49,21 +48,42 @@ public class EnvThresholdServiceImpl extends ServiceImpl<EnvThresholdMapper, Env
     private BasePigpenMapper basePigpenMapper;
 
     @Override
-    public EnvThreshold getThresholdByUnitId(EnvThresholdUnitIdParam envThresholdUnitIdParam) {
-        String orgId = envThresholdUnitIdParam.getOrgId();
-        String unitId = envThresholdUnitIdParam.getUnitId();
-        EnvThreshold envThreshold = this.getOne(new QueryWrapper<EnvThreshold>().lambda().eq(EnvThreshold::getOrgId, orgId).eq(EnvThreshold::getUnitId, unitId));
-        if (ObjectUtil.isEmpty(envThreshold)){
-            envThreshold = new EnvThreshold();
-            envThreshold.setOrgId(orgId);
-            envThreshold.setUnitId(unitId);
-            this.save(envThreshold);
+    public List<EnvThresholdListVo> getThreshold(EnvThresholdOrgIdParam envThresholdOrgIdParam) {
+        String orgId = envThresholdOrgIdParam.getOrgId();
+        List<EnvThresholdListVo> resultList = new ArrayList<>();
+        List<BasePigpen> basePigpens = basePigpenMapper.selectList(new QueryWrapper<BasePigpen>().lambda().eq(BasePigpen::getOrgId, orgId).eq(BasePigpen::getType,0));
+        for (BasePigpen basePigpen : basePigpens) {
+            EnvThresholdListVo envThresholdListVo = new EnvThresholdListVo();
+            envThresholdListVo.setBuildingId(basePigpen.getId());
+            envThresholdListVo.setBuildingName(basePigpen.getBuildName());
+            List<EnvThresholdVo> envThresholdVos = new ArrayList<>();
+            List<BasePigpen> floorBasePigpens = basePigpenMapper.selectList(new QueryWrapper<BasePigpen>().lambda().eq(BasePigpen::getParentId, basePigpen.getId()));
+            if (ObjectUtil.isNotEmpty(floorBasePigpens)){
+                List<String> floorIds = floorBasePigpens.stream().map(basePigpen1 -> basePigpen1.getId()).collect(Collectors.toList());
+                List<BasePigpen> basePigpens1 = basePigpenMapper.selectList(new QueryWrapper<BasePigpen>().lambda().in(BasePigpen::getParentId, floorIds));
+                for (BasePigpen pigpen : basePigpens1) {
+                    String unitId = pigpen.getId();
+                    EnvThresholdVo envThresholdVo = new EnvThresholdVo();
+                    EnvThreshold envThreshold = this.getOne(new QueryWrapper<EnvThreshold>().lambda().eq(EnvThreshold::getOrgId, orgId).eq(EnvThreshold::getUnitId, unitId));
+                    if (ObjectUtil.isEmpty(envThreshold)){
+                        envThreshold = new EnvThreshold();
+                        envThreshold.setOrgId(orgId);
+                        envThreshold.setUnitId(unitId);
+                        this.save(envThreshold);
+                    }
+                    BeanUtil.copyProperties(envThreshold,envThresholdVo);
+                    envThresholdVos.add(envThresholdVo);
+                }
+            }
+            envThresholdListVo.setList(envThresholdVos);
+            resultList.add(envThresholdListVo);
         }
-        return envThreshold;
+        return resultList;
     }
 
     @Override
     public void saveThreshold(EnvThresholdSaveParam envThresholdSaveParam) {
+        System.out.println("OrgId"+envThresholdSaveParam.getOrgId());
         String orgId = envThresholdSaveParam.getOrgId();
         EnvThreshold envThreshold = this.getOne(new QueryWrapper<EnvThreshold>().lambda().eq(EnvThreshold::getOrgId, orgId).eq(EnvThreshold::getUnitId, envThresholdSaveParam.getUnitId()));
         BeanUtil.copyProperties(envThresholdSaveParam,envThreshold);

+ 2 - 2
snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envdata/entity/EnvData.java

@@ -38,7 +38,7 @@ public class EnvData implements TransPojo {
     /** ID */
     @TableId
     @ApiModelProperty(value = "ID", position = 1)
-    private Integer id;
+    private String id;
 
     /** 芯片ID */
     @ApiModelProperty(value = "芯片ID", position = 2)
@@ -80,7 +80,7 @@ public class EnvData implements TransPojo {
 
     /** 组织ID */
     @ApiModelProperty(value = "组织ID", position = 11)
-    private Integer orgId;
+    private String orgId;
 
     /** 0显示,1不显示 */
     @ApiModelProperty(value = "0显示,1不显示", position = 12)

+ 4 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envdata/entity/vo/EnvDataListVo.java

@@ -1,10 +1,12 @@
 package vip.xiaonuo.modular.env.envdata.entity.vo;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.math.BigDecimal;
 import java.sql.Date;
+import java.time.LocalDateTime;
 
 @Data
 public class EnvDataListVo {
@@ -15,6 +17,7 @@ public class EnvDataListVo {
     private BigDecimal hum;
 
     @ApiModelProperty(value = "创建时间", position = 3)
-    private Date createTime;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
+    private LocalDateTime createTime;
 
 }

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envdata/entity/vo/EnvDataTrendVo.java

@@ -11,6 +11,6 @@ public class EnvDataTrendVo {
     private String location;
 
     @ApiModelProperty(value = "数据", position = 2)
-    private List<EnvDataListVo> envDataList;
+    private List<EnvDataListVo> list;
 
 }

+ 18 - 2
snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envdata/service/impl/EnvDataServiceImpl.java

@@ -34,6 +34,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 环控数据Service接口实现类
@@ -53,8 +54,23 @@ public class EnvDataServiceImpl extends ServiceImpl<EnvDataMapper, EnvData> impl
     @Override
     public List<EnvDataRecentVo> getLastDataByPigpenId(EnvDataPigpenIdParm envDataPigpenIdParm) {
         String pigpenId = envDataPigpenIdParm.getPigpenId();
+        BasePigpen basePigpen1 = basePigpenMapper.selectById(pigpenId);
         List<EnvDataRecentVo> resultList = new ArrayList();
-        List<BasePigpen> basePigpens = basePigpenMapper.selectList(new QueryWrapper<BasePigpen>().eq("parent_id", pigpenId));
+        List<BasePigpen> basePigpens = new ArrayList<>();
+        if (basePigpen1.getType() == 0){
+            List<BasePigpen> pigpens = basePigpenMapper.selectList(new QueryWrapper<BasePigpen>().eq("parent_id", pigpenId));
+            List<String> idList = pigpens.stream().map(basePigpen -> basePigpen.getId()).collect(Collectors.toList());
+            if (ObjectUtil.isNotEmpty(idList)){
+                basePigpens = basePigpenMapper.selectList(new QueryWrapper<BasePigpen>().in("parent_id", idList).orderByAsc("id"));
+            }else {
+                return resultList;
+            }
+
+        }else if (basePigpen1.getType() == 1){
+            basePigpens = basePigpenMapper.selectList(new QueryWrapper<BasePigpen>().eq("parent_id", pigpenId));
+        }else {
+            basePigpens = basePigpenMapper.selectList(new QueryWrapper<BasePigpen>().eq("id", pigpenId));
+        }
         for (BasePigpen basePigpen : basePigpens) {
             EnvData envData = this.getOne(new QueryWrapper<EnvData>().lambda()
                     .eq(EnvData::getPigpenId, basePigpen.getId())
@@ -97,7 +113,7 @@ public class EnvDataServiceImpl extends ServiceImpl<EnvDataMapper, EnvData> impl
             envDataList = envDataMapper.listCustom(pigpenId,startDate,endDate);
         }
         envDataTrend.setLocation(location);
-        envDataTrend.setEnvDataList(envDataList);
+        envDataTrend.setList(envDataList);
         return envDataTrend;
     }
 

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envdevice/service/impl/EnvDeviceServiceImpl.java

@@ -223,7 +223,7 @@ public class EnvDeviceServiceImpl extends ServiceImpl<EnvDeviceMapper, EnvDevice
     @Override
     public List<BaseConfig> deviceTypeSelector(EnvDeviceOrgIdParam envDeviceOrgIdParam) {
         String orgId = envDeviceOrgIdParam.getOrgId();
-        String parentId = baseConfigMapper.selectOne(new QueryWrapper<BaseConfig>().lambda().eq(BaseConfig::getParentId, 0).eq(BaseConfig::getConfigName, "设备类型")).getId();
+        String parentId = baseConfigMapper.selectOne(new QueryWrapper<BaseConfig>().lambda().eq(BaseConfig::getParentId, 0).eq(BaseConfig::getConfigName, "环控设备类型")).getId();
         List<BaseConfig> baseConfigs = baseConfigMapper.selectList(new QueryWrapper<BaseConfig>().lambda().eq(BaseConfig::getParentId, parentId).eq(BaseConfig::getOrgId, orgId));
         return baseConfigs;
     }

+ 5 - 8
snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningInfo/controller/WarningInfoController.java

@@ -29,10 +29,7 @@ import vip.xiaonuo.common.pojo.CommonValidList;
 import vip.xiaonuo.modular.warning.warningInfo.entity.WarningInfo;
 import vip.xiaonuo.modular.warning.warningInfo.entity.vo.WarningInfoListVo;
 import vip.xiaonuo.modular.warning.warningInfo.entity.vo.WarningInfoProportionVo;
-import vip.xiaonuo.modular.warning.warningInfo.param.WarningInfoAddParam;
-import vip.xiaonuo.modular.warning.warningInfo.param.WarningInfoEditParam;
-import vip.xiaonuo.modular.warning.warningInfo.param.WarningInfoIdParam;
-import vip.xiaonuo.modular.warning.warningInfo.param.WarningInfoPageParam;
+import vip.xiaonuo.modular.warning.warningInfo.param.*;
 import vip.xiaonuo.modular.warning.warningInfo.service.WarningInfoService;
 
 import javax.annotation.Resource;
@@ -77,8 +74,8 @@ public class WarningInfoController {
     @ApiOperationSupport(order = 2)
     @ApiOperation("获取预警占比")
     @GetMapping("/warning/warningInfo/getProportion")
-    public CommonResult<WarningInfoProportionVo> getProportion() {
-        return CommonResult.data(warningInfoService.getProportion());
+    public CommonResult<WarningInfoProportionVo> getProportion(WarningInfoOrgIdParam warningInfoOrgIdParam) {
+        return CommonResult.data(warningInfoService.getProportion(warningInfoOrgIdParam));
     }
 
     /**
@@ -90,8 +87,8 @@ public class WarningInfoController {
     @ApiOperationSupport(order = 3)
     @ApiOperation("获取近七天预警")
     @GetMapping("/warning/warningInfo/listSevenDayWarning")
-    public CommonResult<List<WarningInfoListVo>> listSevenDayWarning() {
-        return CommonResult.data(warningInfoService.listSevenDayWarning());
+    public CommonResult<List<WarningInfoListVo>> listSevenDayWarning(WarningInfoOrgIdParam warningInfoOrgIdParam) {
+        return CommonResult.data(warningInfoService.listSevenDayWarning(warningInfoOrgIdParam));
     }
 
 

+ 2 - 2
snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningInfo/entity/vo/WarningInfoListVo.java

@@ -10,10 +10,10 @@ import java.util.Date;
 public class WarningInfoListVo {
     @ApiModelProperty(value = "预警日期", position = 1)
     @JsonFormat(pattern = "yyyy-MM-dd" ,timezone = "GMT+8")
-    private Date warningTime;
+    private Date time;
 
     @ApiModelProperty(value = "预警数量", position = 2)
-    private Long warningQuantity;
+    private Long value;
 
 
 }

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningInfo/entity/vo/WarningInfoProportionVo.java

@@ -11,6 +11,6 @@ public class WarningInfoProportionVo {
     private Long total;
 
     @ApiModelProperty(value = "比例列表", position = 2)
-    private List<WarningInfoRateVo> rateList;
+    private List<WarningInfoRateVo> list;
 
 }

+ 2 - 5
snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningInfo/entity/vo/WarningInfoRateVo.java

@@ -8,11 +8,8 @@ import java.math.BigDecimal;
 @Data
 public class WarningInfoRateVo {
     @ApiModelProperty(value = "预警类型", position = 1)
-    private String typeName;
+    private String name;
 
     @ApiModelProperty(value = "预警数量", position = 2)
-    private Long warningQuantity;
-
-    @ApiModelProperty(value = "占比", position = 3)
-    private BigDecimal proportion;
+    private Long value;
 }

+ 2 - 2
snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningInfo/mapper/mapping/WarningInfoMapper.xml

@@ -5,8 +5,8 @@
     <select id="listSevenDayWarning" resultType="vip.xiaonuo.modular.warning.warningInfo.entity.vo.WarningInfoListVo"
             parameterType="java.lang.String">
         SELECT
-            DATE(warning_time) AS warningTime,
-            COUNT(*) AS warningQuantity
+            DATE(warning_time) AS 'time',
+            COUNT(*) AS 'value''
         FROM
             `warning_info`
         WHERE

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

@@ -10,27 +10,26 @@
  * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
  * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
  */
-package vip.xiaonuo.modular.energy.energythreshold.param;
+package vip.xiaonuo.modular.warning.warningInfo.param;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
 
 /**
- * 阈值设置Id参数
+ * 预警Id参数
  *
- * @author wang
- * @date  2023/12/25 09:43
+ * @author newspaper
+ * @date  2023/12/26 13:40
  **/
 @Getter
 @Setter
-public class EnergyThresholdIdParam {
+public class WarningInfoOrgIdParam {
 
-    /** ID */
-    @ApiModelProperty(value = "ID", required = true)
-    @NotNull(message = "id不能为空")
-    private Integer id;
+    /** 组织id */
+    @ApiModelProperty(value = "组织id", required = true, position = 99)
+    @NotBlank(message = "orgId不能为空")
+    private String orgId;
 }

+ 4 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningInfo/param/WarningInfoPageParam.java

@@ -59,4 +59,8 @@ public class WarningInfoPageParam {
     @ApiModelProperty(value = "预警时间结束")
     private String endWarningTime;
 
+    /** 组织ID */
+    @ApiModelProperty(value = "组织ID", position = 99)
+    private String orgId;
+
 }

+ 3 - 6
snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningInfo/service/WarningInfoService.java

@@ -17,10 +17,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import vip.xiaonuo.modular.warning.warningInfo.entity.WarningInfo;
 import vip.xiaonuo.modular.warning.warningInfo.entity.vo.WarningInfoListVo;
 import vip.xiaonuo.modular.warning.warningInfo.entity.vo.WarningInfoProportionVo;
-import vip.xiaonuo.modular.warning.warningInfo.param.WarningInfoAddParam;
-import vip.xiaonuo.modular.warning.warningInfo.param.WarningInfoEditParam;
-import vip.xiaonuo.modular.warning.warningInfo.param.WarningInfoIdParam;
-import vip.xiaonuo.modular.warning.warningInfo.param.WarningInfoPageParam;
+import vip.xiaonuo.modular.warning.warningInfo.param.*;
 
 import java.util.List;
 
@@ -40,7 +37,7 @@ public interface WarningInfoService extends IService<WarningInfo> {
      */
     Page<WarningInfo> page(WarningInfoPageParam warningInfoPageParam);
 
-    WarningInfoProportionVo getProportion();
+    WarningInfoProportionVo getProportion(WarningInfoOrgIdParam warningInfoOrgIdParam);
 
-    List<WarningInfoListVo> listSevenDayWarning();
+    List<WarningInfoListVo> listSevenDayWarning(WarningInfoOrgIdParam warningInfoOrgIdParam);
 }

+ 12 - 22
snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningInfo/service/impl/WarningInfoServiceImpl.java

@@ -34,11 +34,9 @@ import vip.xiaonuo.modular.warning.warningInfo.entity.vo.WarningInfoListVo;
 import vip.xiaonuo.modular.warning.warningInfo.entity.vo.WarningInfoProportionVo;
 import vip.xiaonuo.modular.warning.warningInfo.entity.vo.WarningInfoRateVo;
 import vip.xiaonuo.modular.warning.warningInfo.mapper.WarningInfoMapper;
-import vip.xiaonuo.modular.warning.warningInfo.param.WarningInfoAddParam;
-import vip.xiaonuo.modular.warning.warningInfo.param.WarningInfoEditParam;
-import vip.xiaonuo.modular.warning.warningInfo.param.WarningInfoIdParam;
-import vip.xiaonuo.modular.warning.warningInfo.param.WarningInfoPageParam;
+import vip.xiaonuo.modular.warning.warningInfo.param.*;
 import vip.xiaonuo.modular.warning.warningInfo.service.WarningInfoService;
+import vip.xiaonuo.modular.warning.warningManager.param.WarningManagerOrgIdParam;
 import vip.xiaonuo.sys.modular.user.entity.SysUser;
 import vip.xiaonuo.sys.modular.user.mapper.SysUserMapper;
 
@@ -100,7 +98,7 @@ public class WarningInfoServiceImpl extends ServiceImpl<WarningInfoMapper, Warni
             default:
                 throw new CommonException("显示类型不存在!");
         }
-        queryWrapper.lambda().orderByDesc(WarningInfo::getWarningTime);
+        queryWrapper.lambda().eq(WarningInfo::getOrgId,warningInfoPageParam.getOrgId()).orderByDesc(WarningInfo::getWarningTime);
         Page<WarningInfo> warningInfoPage = this.page(CommonPageRequest.defaultPage(), queryWrapper);
         List<WarningInfo> warningInfoList = warningInfoPage.getRecords();
         for (WarningInfo warningInfo : warningInfoList) {
@@ -118,38 +116,30 @@ public class WarningInfoServiceImpl extends ServiceImpl<WarningInfoMapper, Warni
     }
 
     @Override
-    public WarningInfoProportionVo getProportion() {
-        String orgId = StpLoginUserUtil.getLoginUser().getOrgId();
+    public WarningInfoProportionVo getProportion(WarningInfoOrgIdParam warningInfoOrgIdParam) {
+        String orgId = warningInfoOrgIdParam.getOrgId();
         WarningInfoProportionVo warningInfoProportionVo = new WarningInfoProportionVo();
         long total = this.count(new QueryWrapper<WarningInfo>().lambda().eq(WarningInfo::getOrgId, orgId).ge(WarningInfo::getWarningTime, DateUtil.beginOfMonth(new Date())));
         warningInfoProportionVo.setTotal(total);
 
         String parentConfig = baseConfigMapper.selectOne(new QueryWrapper<BaseConfig>().lambda().eq(BaseConfig::getParentId, 0).eq(BaseConfig::getConfigName, "预警类型")).getId();
         List<BaseConfig> baseConfigs = baseConfigMapper.selectList(new QueryWrapper<BaseConfig>().lambda().eq(BaseConfig::getParentId, parentConfig).orderByAsc(BaseConfig::getSortCode));
-        List<String> types = baseConfigs.stream().map(baseConfig -> baseConfig.getConfigName()).collect(Collectors.toList());
         List<WarningInfoRateVo> warningInfoRateVoList = new ArrayList<>();
 
-        for (String type : types) {
+        for (BaseConfig baseConfig : baseConfigs) {
             WarningInfoRateVo warningInfoRateVo = new WarningInfoRateVo();
-            long count = this.count(new QueryWrapper<WarningInfo>().lambda().eq(WarningInfo::getOrgId, orgId).eq(WarningInfo::getWarningType, type).ge(WarningInfo::getWarningTime, DateUtil.beginOfMonth(new Date())));
-            warningInfoRateVo.setTypeName(type);
-            warningInfoRateVo.setWarningQuantity(count);
-
-            // 使用 BigDecimal 进行比例计算
-            BigDecimal countBigDecimal = BigDecimal.valueOf(count);
-            BigDecimal totalBigDecimal = BigDecimal.valueOf(total);
-            BigDecimal proportion = countBigDecimal.divide(totalBigDecimal, 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
-
-            warningInfoRateVo.setProportion(proportion);
+            long count = this.count(new QueryWrapper<WarningInfo>().lambda().eq(WarningInfo::getOrgId, orgId).eq(WarningInfo::getWarningType, baseConfig.getId()).ge(WarningInfo::getWarningTime, DateUtil.beginOfMonth(new Date())));
+            warningInfoRateVo.setName(baseConfig.getConfigName());
+            warningInfoRateVo.setValue(count);
             warningInfoRateVoList.add(warningInfoRateVo);
         }
-        warningInfoProportionVo.setRateList(warningInfoRateVoList);
+        warningInfoProportionVo.setList(warningInfoRateVoList);
         return warningInfoProportionVo;
     }
 
     @Override
-    public List<WarningInfoListVo> listSevenDayWarning() {
-        String orgId = StpLoginUserUtil.getLoginUser().getOrgId();
+    public List<WarningInfoListVo> listSevenDayWarning(WarningInfoOrgIdParam warningInfoOrgIdParam) {
+        String orgId = warningInfoOrgIdParam.getOrgId();
         List<WarningInfoListVo> warningInfoListVoList = warningInfoMapper.listSevenDayWarning(orgId);
         return warningInfoListVoList;
     }

+ 16 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningManager/controller/WarningManagerController.java

@@ -21,15 +21,19 @@ 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.biz.modular.user.entity.BizUser;
 import vip.xiaonuo.common.pojo.CommonResult;
 import vip.xiaonuo.modular.warning.warningManager.entity.vo.WarningManagerVo;
+import vip.xiaonuo.modular.warning.warningManager.param.WarningManagerOrgIdParam;
 import vip.xiaonuo.modular.warning.warningManager.param.WarningManagerSaveParam;
 import vip.xiaonuo.modular.warning.warningManager.param.WarningManagerTypeParam;
 import vip.xiaonuo.modular.warning.warningManager.service.WarningManagerService;
+import vip.xiaonuo.sys.modular.user.entity.SysUser;
 
 
 import javax.annotation.Resource;
 import javax.validation.Valid;
+import java.util.List;
 
 /**
  * 预警负责人控制器
@@ -73,5 +77,16 @@ public class WarningManagerController {
         return CommonResult.ok();
     }
 
-
+    /**
+     * 获取人员选择器
+     *
+     * @author newspaper
+     * @date  2023/12/25 09:36
+     */
+    @ApiOperationSupport(order = 3)
+    @ApiOperation("获取人员选择器")
+    @PostMapping("/warning/warningManager/userSelector")
+    public CommonResult<List<SysUser>> userSelector(@RequestBody @Valid WarningManagerOrgIdParam warningManagerOrgIdParam) {
+        return CommonResult.data(warningManagerService.userSelector(warningManagerOrgIdParam));
+    }
 }

+ 2 - 3
snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningManager/entity/WarningManager.java

@@ -51,10 +51,9 @@ public class WarningManager extends CommonEntity {
 
     /** 预警升级时间(分钟) */
     @ApiModelProperty(value = "预警升级时间(分钟)", position = 5)
-    private Integer wanringUpgradeTime;
+    private Integer warningUpgradeTime;
 
     /** 组织ID */
     @ApiModelProperty(value = "组织ID", position = 6)
-
-private String orgId;
+    private String orgId;
 }

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningManager/entity/vo/WarningManagerVo.java

@@ -15,5 +15,5 @@ public class WarningManagerVo {
     private List<UserPhoneVo> secondManager;
 
     @ApiModelProperty(value = "预警升级时间", position = 3)
-    private Integer wanringUpgradeTime;
+    private Integer warningUpgradeTime;
 }

+ 35 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningManager/param/WarningManagerOrgIdParam.java

@@ -0,0 +1,35 @@
+/*
+ * 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.warning.warningManager.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * 预警负责人Id参数
+ *
+ * @author newspaper
+ * @date  2023/12/25 09:36
+ **/
+@Getter
+@Setter
+public class WarningManagerOrgIdParam {
+
+    /** 组织id */
+    @ApiModelProperty(value = "组织id", required = true, position = 99)
+    @NotBlank(message = "orgId不能为空")
+    private String orgId;
+}

+ 2 - 3
snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningManager/param/WarningManagerSaveParam.java

@@ -7,7 +7,7 @@ import lombok.Data;
 import javax.validation.constraints.NotBlank;
 
 @Data
-public class WarningManagerSaveParam {
+public class WarningManagerSaveParam extends WarningManagerOrgIdParam{
     @ApiModelProperty(value = "一级负责人,以&comma;分割", position = 1)
     private String firstManagerId;
 
@@ -15,9 +15,8 @@ public class WarningManagerSaveParam {
     private String secondManagerId;
 
     @ApiModelProperty(value = "预警升级时间 ", position = 3)
-    private Integer wanringUpgradeTime;
+    private Integer warningUpgradeTime;
 
     @ApiModelProperty(value = "预警类型 0:环控 1:能耗 ", position = 4)
-    @NotBlank(message = "预警类型不能为空")
     private Integer type;
 }

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningManager/param/WarningManagerTypeParam.java

@@ -26,7 +26,7 @@ import javax.validation.constraints.NotBlank;
  **/
 @Getter
 @Setter
-public class WarningManagerTypeParam {
+public class WarningManagerTypeParam extends WarningManagerOrgIdParam{
 
     /** 预警类型 */
     @ApiModelProperty(value = "预警类型", required = true, example = "0:环控 1:能耗")

+ 7 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningManager/service/WarningManagerService.java

@@ -14,10 +14,15 @@ package vip.xiaonuo.modular.warning.warningManager.service;
 
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import vip.xiaonuo.biz.modular.user.entity.BizUser;
 import vip.xiaonuo.modular.warning.warningManager.entity.WarningManager;
 import vip.xiaonuo.modular.warning.warningManager.entity.vo.WarningManagerVo;
+import vip.xiaonuo.modular.warning.warningManager.param.WarningManagerOrgIdParam;
 import vip.xiaonuo.modular.warning.warningManager.param.WarningManagerSaveParam;
 import vip.xiaonuo.modular.warning.warningManager.param.WarningManagerTypeParam;
+import vip.xiaonuo.sys.modular.user.entity.SysUser;
+
+import java.util.List;
 
 /**
  * 预警负责人Service接口
@@ -30,4 +35,6 @@ public interface WarningManagerService extends IService<WarningManager> {
     WarningManagerVo getManagerByType(WarningManagerTypeParam warningManagerTypeParam);
 
     void saveManager(WarningManagerSaveParam warningManagerSaveParam);
+
+    List<SysUser> userSelector(WarningManagerOrgIdParam warningManagerOrgIdParam);
 }

+ 23 - 4
snowy-web-app/src/main/java/vip/xiaonuo/modular/warning/warningManager/service/impl/WarningManagerServiceImpl.java

@@ -19,9 +19,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
+import vip.xiaonuo.biz.modular.user.entity.BizUser;
 import vip.xiaonuo.modular.warning.warningManager.entity.WarningManager;
 import vip.xiaonuo.modular.warning.warningManager.entity.vo.WarningManagerVo;
 import vip.xiaonuo.modular.warning.warningManager.mapper.WarningManagerMapper;
+import vip.xiaonuo.modular.warning.warningManager.param.WarningManagerOrgIdParam;
 import vip.xiaonuo.modular.warning.warningManager.param.WarningManagerSaveParam;
 import vip.xiaonuo.modular.warning.warningManager.param.WarningManagerTypeParam;
 import vip.xiaonuo.modular.warning.warningManager.service.WarningManagerService;
@@ -49,7 +51,7 @@ public class WarningManagerServiceImpl extends ServiceImpl<WarningManagerMapper,
     @Override
     public WarningManagerVo getManagerByType(WarningManagerTypeParam warningManagerTypeParam) {
         Integer type = warningManagerTypeParam.getType();
-        String orgId = StpLoginUserUtil.getLoginUser().getOrgId();
+        String orgId = warningManagerTypeParam.getOrgId();
         WarningManager warningManager = this.getOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, type).eq(WarningManager::getOrgId, orgId));
         if (ObjectUtil.isEmpty(warningManager)){
             warningManager = new WarningManager();
@@ -67,12 +69,17 @@ public class WarningManagerServiceImpl extends ServiceImpl<WarningManagerMapper,
                 SysUser sysUser = sysUserService.queryEntity(firstManager);
                 UserPhoneVo userPhoneVo = new UserPhoneVo();
                 userPhoneVo.setName(sysUser.getName());
+                userPhoneVo.setUserId(sysUser.getId());
                 if (ObjectUtil.isNotEmpty(sysUser.getPhone())){
                     userPhoneVo.setPhone(sysUser.getPhone());
                 }
                 firstUserPhoneVoList.add(userPhoneVo);
             }
             warningManagerVo.setFirstManager(firstUserPhoneVoList);
+        }else {
+            UserPhoneVo userPhoneVo = new UserPhoneVo();
+            firstUserPhoneVoList.add(userPhoneVo);
+            warningManagerVo.setFirstManager(firstUserPhoneVoList);
         }
         String secondManager = warningManager.getSecondManagerId();
         if (ObjectUtil.isNotEmpty(secondManager)){
@@ -81,22 +88,27 @@ public class WarningManagerServiceImpl extends ServiceImpl<WarningManagerMapper,
                 SysUser sysUser = sysUserService.queryEntity(firstManager);
                 UserPhoneVo userPhoneVo = new UserPhoneVo();
                 userPhoneVo.setName(sysUser.getName());
+                userPhoneVo.setUserId(sysUser.getId());
                 if (ObjectUtil.isNotEmpty(sysUser.getPhone())){
                     userPhoneVo.setPhone(sysUser.getPhone());
                 }
                 secondUserPhoneVoList.add(userPhoneVo);
             }
             warningManagerVo.setSecondManager(secondUserPhoneVoList);
+        }else {
+            UserPhoneVo userPhoneVo = new UserPhoneVo();
+            secondUserPhoneVoList.add(userPhoneVo);
+            warningManagerVo.setSecondManager(secondUserPhoneVoList);
         }
-        if (ObjectUtil.isNotEmpty(warningManager.getWanringUpgradeTime())){
-            warningManagerVo.setWanringUpgradeTime(warningManager.getWanringUpgradeTime());
+        if (ObjectUtil.isNotEmpty(warningManager.getWarningUpgradeTime())){
+            warningManagerVo.setWarningUpgradeTime(warningManager.getWarningUpgradeTime());
         }
         return warningManagerVo;
     }
 
     @Override
     public void saveManager(WarningManagerSaveParam warningManagerSaveParam) {
-        String orgId = StpLoginUserUtil.getLoginUser().getOrgId();
+        String orgId = warningManagerSaveParam.getOrgId();
         WarningManager warningManager = this.getOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, warningManagerSaveParam.getType()));
         if (ObjectUtil.isEmpty(warningManager)){
             warningManager = new WarningManager();
@@ -105,4 +117,11 @@ public class WarningManagerServiceImpl extends ServiceImpl<WarningManagerMapper,
         this.saveOrUpdate(warningManager);
     }
 
+    @Override
+    public List<SysUser> userSelector(WarningManagerOrgIdParam warningManagerOrgIdParam) {
+        String orgId = warningManagerOrgIdParam.getOrgId();
+        List<SysUser> users = sysUserService.list(new QueryWrapper<SysUser>().eq("ORG_ID", orgId));
+        return users;
+    }
+
 }