Bladeren bron

统计值

suntianwu 3 jaren geleden
bovenliggende
commit
013f65f028

+ 32 - 3
src/main/java/com/iden/bms/controller/CameraController.java

@@ -39,6 +39,35 @@ public class CameraController {
     @Autowired
     private CameraService cameraService;
 
+    @GetMapping("/countCamera")
+    @ApiOperation(value = "当前摄像头个数查询")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(paramType = "query", name = "type", value = "摄像头类型,1摄像机,2抓拍设备"),
+            @ApiImplicitParam(paramType = "query", name = "district", value = "所属区域"),
+            @ApiImplicitParam(paramType = "query", name = "subdistrict", value = "所属街道"),
+            @ApiImplicitParam(paramType = "query", name = "cameraId", value = "摄像头ID"),
+            @ApiImplicitParam(paramType = "query", name = "name", value = "摄像头名称")
+
+    })
+    public Result<Integer> countCamera(HttpServletRequest request, @RequestHeader(value = "token") String token,
+                                          @RequestParam(value = "type", required = true) String type,
+                                          @RequestParam(value = "district", required = false) String district,
+                                          @RequestParam(value = "subdistrict", required = false) String subdistrict,
+                                          @RequestParam(value = "cameraId", required = false) Long cameraId,
+                                          @RequestParam(value = "name", required = false) String name
+                                          ){
+        try {
+            UserLoginedConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
+            Integer count = this.cameraService.countCamera(type,district,subdistrict,cameraId,name,loginUser );
+            return  Result.success("查询成功!",count);
+        }catch (BDException e) {
+            log.error("当前摄像头个数查询-出现异常",e);
+            return  PageResult.error(e.getMessage());
+        } catch (Exception e) {
+            log.error("摄像头管理: 当前摄像头个数出现异常",e);
+            return PageResult.error( "获取数据失败");
+        }
+    }
 
 
     @GetMapping("/listCamera")
@@ -47,7 +76,7 @@ public class CameraController {
             @ApiImplicitParam(paramType = "query", name = "type", value = "摄像头类型,1摄像机,2抓拍设备"),
             @ApiImplicitParam(paramType = "query", name = "district", value = "所属区域"),
             @ApiImplicitParam(paramType = "query", name = "subdistrict", value = "所属街道"),
-            @ApiImplicitParam(paramType = "query", name = "communityId", value = "小区ID"),
+            @ApiImplicitParam(paramType = "query", name = "cameraId", value = "摄像头ID"),
             @ApiImplicitParam(paramType = "query", name = "name", value = "摄像头名称")
 
     })
@@ -55,12 +84,12 @@ public class CameraController {
                                                  @RequestParam(value = "type", required = true) String type,
                                                  @RequestParam(value = "district", required = false) String district,
                                                  @RequestParam(value = "subdistrict", required = false) String subdistrict,
-                                                 @RequestParam(value = "communityId", required = false) Long communityId,
+                                                 @RequestParam(value = "cameraId", required = false) Long cameraId,
                                                  @RequestParam(value = "name", required = false) String name,
                                                  PageReqVO pageReqVo){
         try {
             UserLoginedConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
-            IPage<CameraVO> pageResponse = this.cameraService.listCamera(type,district,subdistrict,communityId,name,loginUser ,pageReqVo);
+            IPage<CameraVO> pageResponse = this.cameraService.listCamera(type,district,subdistrict,cameraId,name,loginUser ,pageReqVo);
             return PageResult.success(pageResponse.getRecords(),pageResponse.getCurrent(),pageResponse.getSize(),pageResponse.getTotal());
         }catch (BDException e) {
             log.error("摄像头列表查询-分页列表出现异常",e);

+ 24 - 0
src/main/java/com/iden/bms/controller/CommunityController.java

@@ -38,6 +38,30 @@ public class CommunityController {
     @Autowired
     private CommunityService communityService;
 
+    @GetMapping("/countCommunity")
+    @ApiOperation(value = "当前小区个数查询")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(paramType = "query", name = "district", value = "所属区域"),
+            @ApiImplicitParam(paramType = "query", name = "subdistrict", value = "所属街道"),
+            @ApiImplicitParam(paramType = "query", name = "name", value = "小区名称")
+
+    })
+    public Result<Integer> countCommunity(HttpServletRequest request, @RequestHeader(value = "token") String token,
+                                                       @RequestParam(value = "district", required = false) String district,
+                                                       @RequestParam(value = "subdistrict", required = false) String subdistrict,
+                                                       @RequestParam(value = "name", required = false) String name){
+        try {
+            UserLoginedConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
+            Integer count = this.communityService.countCommunity(district,subdistrict,name,loginUser);
+            return  Result.success("查询成功!",count);
+        }catch (BDException e) {
+            log.error("当前小区个数查询-出现异常",e);
+            return  PageResult.error(e.getMessage());
+        } catch (Exception e) {
+            log.error("小区管理: 当前小区个数查询出现异常",e);
+            return PageResult.error( "获取数据失败");
+        }
+    }
 
 
     @GetMapping("/listCommunity")

+ 36 - 0
src/main/java/com/iden/bms/controller/PersonController.java

@@ -10,6 +10,7 @@ import com.iden.common.logaspect.OperateType;
 import com.iden.common.util.PageResult;
 import com.iden.common.util.Result;
 import com.iden.common.util.WebPageUtils;
+import com.iden.common.vo.PersonStaVO;
 import com.iden.common.vo.PersonVO;
 import com.iden.common.vo.PageReqVO;
 import com.iden.common.vo.UserLoginedConvertVO;
@@ -37,7 +38,42 @@ public class PersonController {
     @Autowired
     private PersonService personService;
 
+    @GetMapping("/getPersonStaVO")
+    @ApiOperation(value = "查询人员统计值 ")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(paramType = "query", name = "type", value = "类型:1、重点人员,2、小区人员"),
+            @ApiImplicitParam(paramType = "query", name = "nameOrCred", value = "名称/身份证"),
+            @ApiImplicitParam(paramType = "query", name = "district", value = "所属区域"),
+            @ApiImplicitParam(paramType = "query", name = "subdistrict", value = "所属街道"),
+            @ApiImplicitParam(paramType = "query", name = "communityId", value = "小区ID"),
+            @ApiImplicitParam(paramType = "query", name = "crowdId", value = "人群id"),
+            @ApiImplicitParam(paramType = "query", name = "address", value = "详细地址"),
+            @ApiImplicitParam(paramType = "query", name = "gender", value = "性别:M:男 W:女"),
+            @ApiImplicitParam(paramType = "query", name = "populationType", value = "人口类型:1:常住人口 2:暂住人口 3:境外长住人口 4:流动人口 5:寄住人口 6: 临时住宿人口 99其他")
 
+    })
+    public Result<PersonStaVO> getPersonStaVO(HttpServletRequest request, @RequestHeader(value = "token") String token,
+                                              @RequestParam(value = "type", required = true) String type,
+                                              @RequestParam(value = "nameOrCred", required = false) String nameOrCred,
+                                              @RequestParam(value = "district", required = false) String district,
+                                              @RequestParam(value = "subdistrict", required = false) String subdistrict,
+                                              @RequestParam(value = "communityId", required = false) Long communityId,
+                                              @RequestParam(value = "crowdId", required = false) Long crowdId,
+                                              @RequestParam(value = "address", required = false) String address,
+                                              @RequestParam(value = "gender", required = false) String gender,
+                                              @RequestParam(value = "populationType", required = false) String populationType){
+        try {
+            UserLoginedConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
+            PersonStaVO personStaVO = this.personService.getPersonStaVO(type,nameOrCred,district,subdistrict,communityId,crowdId,address,gender,populationType,loginUser );
+            return  Result.success("查询成功!",personStaVO);
+        }catch (BDException e) {
+            log.error("查询人员统计值-出现异常",e);
+            return  PageResult.error(e.getMessage());
+        } catch (Exception e) {
+            log.error("小区管理: 查询人员统计值出现异常",e);
+            return PageResult.error( "获取数据失败");
+        }
+    }
 
     @GetMapping("/listPerson")
     @ApiOperation(value = "人员列表分页 ")

+ 32 - 0
src/main/java/com/iden/bms/controller/WarningStaController.java

@@ -5,6 +5,7 @@ import com.iden.bms.service.WarningStaService;
 import com.iden.common.annotation.Permission;
 import com.iden.common.exception.BDException;
 import com.iden.common.util.PageResult;
+import com.iden.common.util.Result;
 import com.iden.common.util.WebPageUtils;
 
 import com.iden.common.vo.PageReqVO;
@@ -38,6 +39,37 @@ public class WarningStaController {
 
 
 
+    @GetMapping("/countCommunity")
+    @ApiOperation(value = "当前小区个数查询")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(paramType = "query", name = "type", value = "预警类型,1 陌生人员预警 2重点人员预警 3常住人员预警 4昼伏夜出人员预警"),
+            @ApiImplicitParam(paramType = "query", name = "district", value = "所属区域"),
+            @ApiImplicitParam(paramType = "query", name = "subdistrict", value = "所属街道"),
+            @ApiImplicitParam(paramType = "query", name = "communityName", value = "小区名称"),
+            @ApiImplicitParam(paramType = "query", name = "beginDate", value = "开始时间"),
+            @ApiImplicitParam(paramType = "query", name = "endDate", value = "结束时间")
+
+    })
+    public Result<Integer> countCommunity(HttpServletRequest request, @RequestHeader(value = "token") String token,
+                                          @RequestParam(value = "type", required = true) String type,
+                                          @RequestParam(value = "district", required = false) String district,
+                                          @RequestParam(value = "subdistrict", required = false) String subdistrict,
+                                          @RequestParam(value = "communityName", required = false) String communityName,
+                                          @RequestParam(value = "beginDate", required = false) String beginDate,
+                                          @RequestParam(value = "endDate", required = false) String endDate){
+        try {
+            UserLoginedConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
+            Integer count = this.warningStaService.countCommunity(type,district,subdistrict,communityName,beginDate,endDate,loginUser);
+            return  Result.success("查询成功!",count);
+        }catch (BDException e) {
+            log.error("当前小区个数查询-出现异常",e);
+            return  PageResult.error(e.getMessage());
+        } catch (Exception e) {
+            log.error("预警管理: 当前小区个数查询出现异常",e);
+            return PageResult.error( "获取数据失败");
+        }
+    }
+
     @GetMapping("/listWarningSta")
     @ApiOperation(value = "预警统计列表分页 ")
     @ApiImplicitParams(value = {

+ 1 - 1
src/main/java/com/iden/bms/face/FaceIdenService.java

@@ -59,7 +59,7 @@ public class FaceIdenService {
     private static final Logger logger = LogManager.getLogger(FaceIdenService.class);
 
     /**
-     *  处理各摄像头上传的图像
+     *  处理各摄像头上传的图像,去除模糊的、没有人脸的、连拍的图像
      * @throws Exception
      */
     public void handleCameraImage() throws Exception {

+ 6 - 0
src/main/java/com/iden/bms/face/FaceIdenTool.java

@@ -115,6 +115,12 @@ public class FaceIdenTool {
         return null;
     }
 
+    /**
+     * 使用dataPath的图片去库里查找,返回命中结果
+     * @param idenRoot
+     * @param dataPath
+     * @return
+     */
     public static RecogResult watchFrame(String idenRoot,  String dataPath) {
         //初始化引擎
         FaceMonitor faceMonitor = new FaceMonitor();

+ 10 - 1
src/main/java/com/iden/bms/service/CameraService.java

@@ -34,7 +34,16 @@ public class CameraService {
     @Resource
     private IdenCameraService idenCameraService;
 
-    
+    public Integer countCamera(String type, String district, String subdistrict, Long communityId, String name, UserLoginedConvertVO loginUser) {
+        QueryWrapper<IdenCamera> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().like(StrUtil.isNotEmpty(name),IdenCamera::getName,name)
+                .eq(StrUtil.isNotEmpty(district),IdenCamera::getDistrict,district)
+                .eq(StrUtil.isNotEmpty(subdistrict),IdenCamera::getSubdistrict,subdistrict)
+                .eq(communityId != null,IdenCamera::getCommunityId,communityId)
+                .eq(StrUtil.isNotEmpty(type),IdenCamera::getType,type);
+        return this.idenCameraService.count(queryWrapper);
+
+    }
 
     /**
      * 查询摄像头列表

+ 9 - 1
src/main/java/com/iden/bms/service/CommunityService.java

@@ -33,7 +33,15 @@ public class CommunityService {
     @Resource
     private IdenCommunityService idenCommunityService;
 
-    
+
+    public Integer countCommunity(String district, String subdistrict, String name, UserLoginedConvertVO loginUser) {
+        QueryWrapper<IdenCommunity> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().like(StrUtil.isNotEmpty(name),IdenCommunity::getName,name)
+                .eq(StrUtil.isNotEmpty(district),IdenCommunity::getDistrict,district)
+                .eq(StrUtil.isNotEmpty(subdistrict),IdenCommunity::getSubdistrict,subdistrict);
+        return this.idenCommunityService.count(queryWrapper);
+
+    }
 
     /**
      * 查询小区列表

+ 50 - 4
src/main/java/com/iden/bms/service/PersonService.java

@@ -20,6 +20,7 @@ import com.iden.common.service.IdenPersonService;
 import com.iden.common.util.DateUtils;
 import com.iden.common.util.ImgUtil;
 import com.iden.common.util.MyBeanUtils;
+import com.iden.common.vo.PersonStaVO;
 import com.iden.common.vo.PersonVO;
 import com.iden.common.vo.PageReqVO;
 import com.iden.common.vo.UserLoginedConvertVO;
@@ -33,10 +34,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.annotation.Resource;
 import java.io.File;
 import java.io.FileOutputStream;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
 
 /**
  *
@@ -59,6 +57,54 @@ public class PersonService {
     @Value("${file.url:#{null}}")
     private String fileUrl;
 
+
+    public PersonStaVO getPersonStaVO(String type, String nameOrCred, String district, String subdistrict, Long communityId, Long crowdId, String address, String gender, String populationType, UserLoginedConvertVO loginUser) {
+        QueryWrapper<IdenPerson> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().like(IdenPerson::getType,type)
+                .like(StrUtil.isNotEmpty(address), IdenPerson::getAddress,address)
+                .eq(StrUtil.isNotEmpty(gender),IdenPerson::getGender,gender)
+                .eq(StrUtil.isNotEmpty(populationType),IdenPerson::getPopulationType,populationType)
+                .eq(StrUtil.isNotEmpty(district),IdenPerson::getDistrict,district)
+                .eq(StrUtil.isNotEmpty(subdistrict),IdenPerson::getSubdistrict,subdistrict)
+                .eq(communityId != null,IdenPerson::getCommunityId,communityId)
+                .and(StrUtil.isNotEmpty(nameOrCred),wrapper -> wrapper.like(IdenPerson::getName,nameOrCred)
+                        .or().like(IdenPerson::getCredentialsCode,nameOrCred));
+         Integer personCount = this.idenPersonService.count(queryWrapper);
+
+        QueryWrapper<IdenPerson> queryWrapper1 = new QueryWrapper<>();
+        queryWrapper1.lambda().like(IdenPerson::getType,type)
+                .like(StrUtil.isNotEmpty(address), IdenPerson::getAddress,address)
+                .eq(StrUtil.isNotEmpty(gender),IdenPerson::getGender,gender)
+                .eq(StrUtil.isNotEmpty(populationType),IdenPerson::getPopulationType,populationType)
+                .eq(StrUtil.isNotEmpty(district),IdenPerson::getDistrict,district)
+                .eq(StrUtil.isNotEmpty(subdistrict),IdenPerson::getSubdistrict,subdistrict)
+                .eq(communityId != null,IdenPerson::getCommunityId,communityId)
+                .and(StrUtil.isNotEmpty(nameOrCred),wrapper -> wrapper.like(IdenPerson::getName,nameOrCred)
+                        .or().like(IdenPerson::getCredentialsCode,nameOrCred))
+                .isNotNull(IdenPerson::getImage);
+        Integer faceImageCount = this.idenPersonService.count(queryWrapper1);
+
+        QueryWrapper<IdenPerson>  queryWrapper2 = new QueryWrapper<>();
+        queryWrapper2.select("distinct community_id")
+                .lambda().like(IdenPerson::getType,type)
+                .like(StrUtil.isNotEmpty(address), IdenPerson::getAddress,address)
+                .eq(StrUtil.isNotEmpty(gender),IdenPerson::getGender,gender)
+                .eq(StrUtil.isNotEmpty(populationType),IdenPerson::getPopulationType,populationType)
+                .eq(StrUtil.isNotEmpty(district),IdenPerson::getDistrict,district)
+                .eq(StrUtil.isNotEmpty(subdistrict),IdenPerson::getSubdistrict,subdistrict)
+                .eq(communityId != null,IdenPerson::getCommunityId,communityId)
+                .and(StrUtil.isNotEmpty(nameOrCred),wrapper -> wrapper.like(IdenPerson::getName,nameOrCred)
+                        .or().like(IdenPerson::getCredentialsCode,nameOrCred));
+
+        Integer communityCount = this.idenPersonService.count(queryWrapper2);
+
+        PersonStaVO vo = new PersonStaVO();
+        vo.setCommunityCount(communityCount);
+        vo.setFaceImageCount(faceImageCount);
+        vo.setPersonCount(personCount);
+        return vo;
+    }
+
     /**
      * 查询人员列表
      * @return

+ 21 - 1
src/main/java/com/iden/bms/service/WarningStaService.java

@@ -29,7 +29,27 @@ public class WarningStaService {
     @Resource
     private IdenWarningStaService idenWarningStaService;
 
-    
+    public Integer countCommunity(String type,String district, String subdistrict, String communityName, String beginDate, String endDate, UserLoginedConvertVO loginUser) {
+        QueryWrapper<IdenWarningSta> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(IdenWarningSta::getType,type)
+                .like(StrUtil.isNotEmpty(communityName),IdenWarningSta::getCommunityName,communityName)
+                .eq(StrUtil.isNotEmpty(district),IdenWarningSta::getDistrict,district)
+                .eq(StrUtil.isNotEmpty(subdistrict),IdenWarningSta::getSubdistrict,subdistrict)
+                .ge(StrUtil.isNotEmpty(beginDate),IdenWarningSta::getDataDate,beginDate)
+                .le(StrUtil.isNotEmpty(endDate),IdenWarningSta::getDataDate,endDate);
+        queryWrapper.groupBy("community_id");
+        queryWrapper.select(
+                "community_id communityId",
+                "max(community_code) communityCode",
+                "max(community_name) communityName",
+                "max(district) district",
+                "max(subdistrict) subdistrict",
+                "max(data_date) dataDate",
+                "IFNULL(SUM(total),0) total"
+        );
+        return this.idenWarningStaService.count(queryWrapper);
+
+    }
 
     /**
      * 查询预警统计列表

+ 32 - 0
src/main/java/com/iden/common/vo/PersonStaVO.java

@@ -0,0 +1,32 @@
+package com.iden.common.vo;
+
+
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @author makejava
+ * @since 2021-12-22 17:23:47
+ */
+
+@Data
+@ApiModel(value = "人员统计", description = "")
+public class PersonStaVO implements Serializable {
+    private static final long serialVersionUID = -95513090380191735L;
+
+    @ApiModelProperty("小区个数")
+    private int communityCount;
+
+    @ApiModelProperty("总人数")
+    private int personCount;
+
+    @ApiModelProperty("已录入人脸数")
+    private int faceImageCount;
+
+
+}