Răsfoiți Sursa

拆分告警计划模板 分web端和wap端

hxd 1 lună în urmă
părinte
comite
e805465d9b

+ 2 - 3
portal-service-application/src/main/java/com/hfln/portal/application/controller/wap/AlarmController.java

@@ -6,7 +6,6 @@ import cn.hfln.framework.dto.ApiResult;
 import com.hfln.portal.common.dto.data.event.AlarmPlanDTO;
 import com.hfln.portal.common.dto.data.event.AlarmPlanTplDTO;
 import com.hfln.portal.common.request.event.*;
-import com.hfln.portal.common.vo.PageRecord;
 import com.hfln.portal.domain.gateway.AlarmGateway;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -32,8 +31,8 @@ public class AlarmController {
 
     @PostMapping("/plan/queryTpl")
     @Operation(summary = "告警计划模板查询")
-    public ApiResult<PageRecord<AlarmPlanTplDTO>> queryPlan(@Valid @RequestBody AlarmPlanTplQueryReq req) {
-        return ApiResult.success(alarmGateway.queryPlanTpl(req));
+    public ApiResult<List<AlarmPlanTplDTO>> wapQueryPlan(@Valid @RequestBody WapAlarmPlanTplQueryReq req) {
+        return ApiResult.success(alarmGateway.wapQueryPlanTpl(req));
     }
 
 

+ 2 - 2
portal-service-application/src/main/java/com/hfln/portal/application/controller/web/WebAlarmController.java

@@ -63,8 +63,8 @@ public class WebAlarmController {
 
     @PostMapping("/plan/queryTpl")
     @Operation(summary = "告警计划模板查询")
-    public ApiResult<PageRecord<AlarmPlanTplDTO>> queryPlan(@Valid @RequestBody AlarmPlanTplQueryReq req) {
-        return ApiResult.success(alarmGateway.queryPlanTpl(req));
+    public ApiResult<PageRecord<AlarmPlanTplDTO>> WebQueryPlan(@Valid @RequestBody WebAlarmPlanTplQueryReq req) {
+        return ApiResult.success(alarmGateway.webQueryPlanTpl(req));
     }
 
     @PostMapping("/plan/saveTpl")

+ 16 - 16
portal-service-common/src/main/java/com/hfln/portal/common/request/device/WebUpdateDeviceParams.java

@@ -15,11 +15,11 @@ import java.math.BigDecimal;
 public class WebUpdateDeviceParams extends BaseVO {
 
     @NotEmpty(message = "设备Id不能为空")
-    @Schema(description = "设备ID", required = true)
+    @Schema(description = "设备ID")
     private String clientId;
 
     @NotNull(message = "用户Id不能为空")
-    @Schema(description = "用户Id", required = true)
+    @Schema(description = "用户Id")
     private Long userId;
 
     @Schema(description = "租户ID")
@@ -30,8 +30,8 @@ public class WebUpdateDeviceParams extends BaseVO {
     private String devName;
 
     @Schema(description = "安装高度: 200 - 370 cm 之内")
-    @DecimalMax(value = "370", message = "height不能大于370")
-    @DecimalMin(value = "200", message = "height不能小于200")
+//    @DecimalMax(value = "370", message = "height不能大于370")
+//    @DecimalMin(value = "200", message = "height不能小于200")
     private BigDecimal height;
 
     @Schema(description = "WIFI名称")
@@ -50,36 +50,36 @@ public class WebUpdateDeviceParams extends BaseVO {
     private String installPosition;
 
     @Schema(description = "雷达监测范围x开始,范围:-200-200 cm之内")
-    @DecimalMin(value = "-200", message = "xxStart不能小于-200")
-    @DecimalMax(value = "200", message = "xxStart不能大于200")
+//    @DecimalMin(value = "-200", message = "xxStart不能小于-200")
+//    @DecimalMax(value = "200", message = "xxStart不能大于200")
     private BigDecimal xxStart;
 
     @Schema(description = "雷达监测范围x结束,范围:-200-200 cm之内,且xxEnd > xxStart")
-    @DecimalMin(value = "-200", message = "xxEnd不能小于-200")
-    @DecimalMax(value = "200", message = "xxEnd不能大于200")
+//    @DecimalMin(value = "-200", message = "xxEnd不能小于-200")
+//    @DecimalMax(value = "200", message = "xxEnd不能大于200")
     private BigDecimal xxEnd;
 
 
     @Schema(description = "雷达监测范围y开始,范围:-250-250 cm之内")
-    @DecimalMin(value = "-250", message = "yyStart不能小于-250")
-    @DecimalMax(value = "250", message = "yyStart不能大于250")
+//    @DecimalMin(value = "-250", message = "yyStart不能小于-250")
+//    @DecimalMax(value = "250", message = "yyStart不能大于250")
     private BigDecimal yyStart;
 
     @Schema(description = "雷达监测范围y结束,范围:-250-250 cm之内,且yyEnd > yyStart")
-    @DecimalMin(value = "-250", message = "yyEnd不能小于-250")
-    @DecimalMax(value = "250", message = "yyEnd不能大于250")
+//    @DecimalMin(value = "-250", message = "yyEnd不能小于-250")
+//    @DecimalMax(value = "250", message = "yyEnd不能大于250")
     private BigDecimal yyEnd;
 
 
     @Schema(description = "雷达监测范围z开始,范围:0-5 cm之内")
-    @DecimalMin(value = "0", message = "zzStart不能小于0")
-    @DecimalMax(value = "5", message = "zzStart不能大于5")
+//    @DecimalMin(value = "0", message = "zzStart不能小于0")
+//    @DecimalMax(value = "5", message = "zzStart不能大于5")
     private BigDecimal zzStart;
 
 
     @Schema(description = "雷达监测范围z结束,范围:200-300 cm之内")
-    @DecimalMin(value = "200", message = "zzEnd不能小于200")
-    @DecimalMax(value = "300", message = "zzEnd不能大于300")
+//    @DecimalMin(value = "200", message = "zzEnd不能小于200")
+//    @DecimalMax(value = "300", message = "zzEnd不能大于300")
     private BigDecimal zzEnd;
 
     @Schema(description = "设备跌倒确认时间,大于0")

+ 19 - 0
portal-service-common/src/main/java/com/hfln/portal/common/request/event/WapAlarmPlanTplQueryReq.java

@@ -0,0 +1,19 @@
+package com.hfln.portal.common.request.event;
+
+import com.hfln.portal.common.vo.BaseVO;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class WapAlarmPlanTplQueryReq extends BaseVO {
+
+
+    @Schema(description = "事件值类型")
+    private Integer eventVal;
+
+    @Schema(description = "告警计划模板名称")
+    private String name;
+}

+ 1 - 1
portal-service-common/src/main/java/com/hfln/portal/common/request/event/AlarmPlanTplQueryReq.java → portal-service-common/src/main/java/com/hfln/portal/common/request/event/WebAlarmPlanTplQueryReq.java

@@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode;
 
 @EqualsAndHashCode(callSuper = true)
 @Data
-public class AlarmPlanTplQueryReq extends PageVo {
+public class WebAlarmPlanTplQueryReq extends PageVo {
 
     @Schema(description = "是否启用 1:启用 0:禁用")
     private Integer enable;

+ 3 - 1
portal-service-domain/src/main/java/com/hfln/portal/domain/gateway/AlarmGateway.java

@@ -27,7 +27,9 @@ public interface AlarmGateway {
     /**
      *  告警模板计划相关
      */
-    PageRecord<AlarmPlanTplDTO> queryPlanTpl(AlarmPlanTplQueryReq req);
+    PageRecord<AlarmPlanTplDTO> webQueryPlanTpl(WebAlarmPlanTplQueryReq req);
+
+    List<AlarmPlanTplDTO> wapQueryPlanTpl(WapAlarmPlanTplQueryReq req);
 
     AlarmPlanTplDTO savePlanTpl(AlarmPlanTplSaveReq req);
 

+ 23 - 1
portal-service-infrastructure/src/main/java/com/hfln/portal/infrastructure/gateway/impl/AlarmGatewayImpl.java

@@ -156,7 +156,7 @@ public class AlarmGatewayImpl implements AlarmGateway {
     }
 
     @Override
-    public PageRecord<AlarmPlanTplDTO> queryPlanTpl(AlarmPlanTplQueryReq req) {
+    public PageRecord<AlarmPlanTplDTO> webQueryPlanTpl(WebAlarmPlanTplQueryReq req) {
 
 
         // 2.执行分页查询
@@ -184,6 +184,28 @@ public class AlarmGatewayImpl implements AlarmGateway {
     }
 
     @Override
+    public List<AlarmPlanTplDTO> wapQueryPlanTpl(WapAlarmPlanTplQueryReq req) {
+
+
+        List<AlarmPlanTpl> list = alarmPlanTplService.queryPlan(req);
+        if (CollectionUtils.isEmpty(list)) {
+            return Collections.emptyList();
+        }
+
+        List<AlarmPlanTplDTO> resList = new ArrayList<>();
+        for (AlarmPlanTpl alarmPlanTpl : list) {
+            AlarmPlanTplDTO copy = CopyUtils.copy(alarmPlanTpl, AlarmPlanTplDTO.class);
+            if (alarmPlanTpl.getAlarmTimePlanTplId() != null) {
+                AlarmTimePlanTpl byId = alarmTimePlanTplService.getById(copy.getAlarmTimePlanTplId());
+                copy.setAlarmTimePlanTpl(CopyUtils.copy(byId, AlarmTimePlanTplDTO.class));
+                resList.add(copy);
+            }
+        }
+        return resList;
+    }
+
+
+    @Override
     @Transactional
     public AlarmPlanTplDTO savePlanTpl(AlarmPlanTplSaveReq req) {
 

+ 7 - 2
portal-service-infrastructure/src/main/java/com/hfln/portal/infrastructure/service/AlarmPlanTplService.java

@@ -2,12 +2,17 @@ package com.hfln.portal.infrastructure.service;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.hfln.portal.common.request.event.AlarmPlanTplQueryReq;
+import com.hfln.portal.common.request.event.WapAlarmPlanTplQueryReq;
+import com.hfln.portal.common.request.event.WebAlarmPlanTplQueryReq;
 import com.hfln.portal.infrastructure.po.AlarmPlanTpl;
 
+import java.util.List;
+
 public interface AlarmPlanTplService extends IService<AlarmPlanTpl> {
 
-    Page <AlarmPlanTpl> queryPlan(AlarmPlanTplQueryReq req);
+    Page <AlarmPlanTpl> queryPlan(WebAlarmPlanTplQueryReq req);
+
+    List<AlarmPlanTpl> queryPlan(WapAlarmPlanTplQueryReq req);
 
     void delById(Integer alarmPlanId);
 }

+ 18 - 2
portal-service-infrastructure/src/main/java/com/hfln/portal/infrastructure/service/impl/AlarmPlanTplServiceImpl.java

@@ -3,17 +3,20 @@ package com.hfln.portal.infrastructure.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.hfln.portal.common.request.event.AlarmPlanTplQueryReq;
+import com.hfln.portal.common.request.event.WapAlarmPlanTplQueryReq;
+import com.hfln.portal.common.request.event.WebAlarmPlanTplQueryReq;
 import com.hfln.portal.infrastructure.mapper.AlarmPlanTplMapper;
 import com.hfln.portal.infrastructure.po.AlarmPlanTpl;
 import com.hfln.portal.infrastructure.service.AlarmPlanTplService;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
 public class AlarmPlanTplServiceImpl extends ServiceImpl<AlarmPlanTplMapper, AlarmPlanTpl> implements AlarmPlanTplService {
 
     @Override
-    public Page<AlarmPlanTpl> queryPlan(AlarmPlanTplQueryReq req) {
+    public Page<AlarmPlanTpl> queryPlan(WebAlarmPlanTplQueryReq req) {
         LambdaQueryWrapper<AlarmPlanTpl> wrapper = new LambdaQueryWrapper<>();
         if (req.getEnable() != null) {
             wrapper.eq(AlarmPlanTpl::getEnable, req.getEnable());
@@ -33,6 +36,19 @@ public class AlarmPlanTplServiceImpl extends ServiceImpl<AlarmPlanTplMapper, Ala
     }
 
     @Override
+    public List<AlarmPlanTpl> queryPlan(WapAlarmPlanTplQueryReq req) {
+        LambdaQueryWrapper<AlarmPlanTpl> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(AlarmPlanTpl::getEnable, 1);
+        if (req.getEventVal() != null) {
+            wrapper.eq(AlarmPlanTpl::getEventVal, req.getEventVal());
+        }
+        if (req.getName() != null){
+            wrapper.like(AlarmPlanTpl::getName, req.getName());
+        }
+        return this.baseMapper.selectList(wrapper);
+    }
+
+    @Override
     public void delById(Integer id) {
         this.baseMapper.delById(id);
     }