Browse Source

区域新增BUG修复

jichaobo 2 years ago
parent
commit
9f9ecfa187

+ 17 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/AlarmDetectorController.java

@@ -116,5 +116,22 @@ public class AlarmDetectorController {
         util.exportExcel(response, list, exportTitle, exportTitle);
     }
 
+//    @GetMapping("getData")
+//    public Object getData(){
+//        Request request = Request.Post("http://172.16.120.69:8086/query?db=USKTSDB&u=root&p=root");
+//        String body = "q=SELECT * FROM sp_d00000320040040&epoch=s";
+//        request.bodyString(body,ContentType.APPLICATION_FORM_URLENCODED);
+//        request.setHeader("User-Agent", "Apipost client Runtime/+https://www.apipost.cn/");
+//        request.setHeader("Content-Type", "application/x-www-form-urlencoded");
+//        HttpResponse httpResponse = request.execute().returnResponse();
+//        System.out.println(httpResponse.getStatusLine());
+//        if (httpResponse.getEntity() != null) {
+//            String html = EntityUtils.toString(httpResponse.getEntity());
+//            System.out.println(html);
+//        }
+//        return ApiResult.success();
+//    }
+
+
 }
 

+ 15 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionAreaServiceImpl.java

@@ -36,6 +36,13 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
     @Override
     @Transactional
     public void addPatrolInspectionArea(PatrolInspectionAreaVo patrolInspectionAreaVo) {
+        LambdaQueryWrapper<PatrolInspectionArea> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(PatrolInspectionArea::getEnable, 1)
+                .eq(PatrolInspectionArea::getAreaName, patrolInspectionAreaVo.getAreaName());
+        List<PatrolInspectionArea> list = this.list(queryWrapper);
+        if (list.size() > 0) {
+            throw new BusinessException("区域不可以重复");
+        }
         PatrolInspectionArea patrolInspectionArea = new PatrolInspectionArea();
         patrolInspectionArea.setAreaName(patrolInspectionAreaVo.getAreaName());
         patrolInspectionArea.setAreaFid(0);
@@ -68,6 +75,14 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
         if (list.size() <= 0) {
             throw new BusinessException("父级ID不存在");
         }
+        LambdaQueryWrapper<PatrolInspectionArea> queryWrapperOne = Wrappers.lambdaQuery();
+        queryWrapperOne.eq(PatrolInspectionArea::getEnable, 1)
+                .eq(PatrolInspectionArea::getAreaFid, patrolInspectionArea.getAreaFid())
+                .eq(PatrolInspectionArea::getAreaName, patrolInspectionArea.getAreaName());
+        List<PatrolInspectionArea> list2 = this.list(queryWrapperOne);
+        if (list2.size() > 0) {
+            throw new BusinessException("区域名称不可重复");
+        }
         patrolInspectionArea.setCompanyId(list.get(0).getCompanyId());
         patrolInspectionArea.setCreator(SecurityUtils.getUsername());
         patrolInspectionArea.setCreateTime(LocalDateTime.now());