瀏覽代碼

海康车辆数据查询

dzx 1 月之前
父節點
當前提交
441d0f8e36

+ 63 - 2
src/main/java/com/xjrsoft/module/hikvision/controller/OutInController.java

@@ -1,6 +1,8 @@
 package com.xjrsoft.module.hikvision.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.dev33.satoken.stp.StpUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.gson.Gson;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
@@ -8,16 +10,20 @@ import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.PageOutput;
+import com.xjrsoft.module.hikvision.dto.HikvisionCarOutinPageDto;
 import com.xjrsoft.module.hikvision.dto.HikvisionOutinPageDto;
 import com.xjrsoft.module.hikvision.service.IHikvisionDataService;
 import com.xjrsoft.module.hikvision.util.ApiUtil;
+import com.xjrsoft.module.hikvision.vo.HikvisionCarListVo;
+import com.xjrsoft.module.hikvision.vo.HikvisionCarOutinPageVo;
 import com.xjrsoft.module.hikvision.vo.HikvisionOutinPageVo;
+import com.xjrsoft.module.personnel.entity.CarMessageApply;
+import com.xjrsoft.module.personnel.service.ICarMessageApplyService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -33,6 +39,7 @@ import java.util.List;
 public class OutInController {
 
     private final IHikvisionDataService hkvisionDataService;
+    private final ICarMessageApplyService carApplyService;
 
     @GetMapping("/page")
     @ApiOperation(value="海康记录查询(分页)")
@@ -71,7 +78,61 @@ public class OutInController {
         output.setTotalPage(data.get("totalPage").getAsInt());
         output.setTotal(data.get("total").getAsInt());
         output.setList(result);
-        
+
+        return RT.ok(output);
+    }
+
+    @GetMapping("/car-list")
+    @ApiOperation(value="根据用户id查询车牌号")
+    @SaCheckPermission("outin:detail")
+    public RT<List<HikvisionCarListVo>> carList(@Valid HikvisionCarOutinPageDto dto){
+        if(dto.getUserId() == null){
+            dto.setUserId(StpUtil.getLoginIdAsLong());
+        }
+        List<CarMessageApply> list = carApplyService.list(new QueryWrapper<CarMessageApply>().lambda().eq(CarMessageApply::getUserId, dto.getUserId()));
+        List<HikvisionCarListVo> result = new ArrayList<>();
+        for (CarMessageApply el : list) {
+            result.add(
+                    new HikvisionCarListVo(){{
+                        setPlateNo(el.getCarNumber());
+                    }}
+            );
+        }
+        return RT.ok(result);
+    }
+
+
+    @GetMapping("/car-page")
+    @ApiOperation(value="海康车辆出入记录查询(分页)")
+    @SaCheckPermission("outin:detail")
+    public RT<PageOutput<HikvisionCarOutinPageVo>> carPage(@Valid HikvisionCarOutinPageDto dto){
+        ApiUtil apiUtil = new ApiUtil();
+        String apiPath = "/api/pms/v1/crossRecords/page";
+
+        JsonObject paramJson = new JsonObject();
+        paramJson.addProperty("pageNo", dto.getLimit());
+        paramJson.addProperty("pageSize", dto.getSize());
+        paramJson.addProperty("sort", "crossTime");
+        paramJson.addProperty("order", "desc");
+        paramJson.addProperty("plateNo", dto.getPlateNo());
+
+        String doPost = apiUtil.doPost(apiPath, paramJson.toString(), null);
+        JsonParser parser = new JsonParser();
+        JsonObject data = parser.parse(doPost).getAsJsonObject().get("data").getAsJsonObject();
+        JsonArray list = data.get("list").getAsJsonArray();
+        List<HikvisionCarOutinPageVo> result = new ArrayList<>();
+        Gson gson = new Gson();
+        for (JsonElement jsonElement : list) {
+            result.add(gson.fromJson(jsonElement.getAsJsonObject(), HikvisionCarOutinPageVo.class));
+        }
+
+        PageOutput<HikvisionCarOutinPageVo> output = new PageOutput<>();
+        output.setCurrentPage(dto.getLimit());
+        output.setPageSize(dto.getSize());
+//        output.setTotalPage(data.get("totalPage").getAsInt());
+        output.setTotal(data.get("total").getAsInt());
+        output.setList(result);
+
         return RT.ok(output);
     }
 }

+ 21 - 0
src/main/java/com/xjrsoft/module/hikvision/dto/HikvisionCarOutinPageDto.java

@@ -0,0 +1,21 @@
+package com.xjrsoft.module.hikvision.dto;
+
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author dzx
+ * @date 2024年9月19日
+ */
+@Data
+public class HikvisionCarOutinPageDto extends PageInput {
+
+
+    @ApiModelProperty("用户id")
+    private Long userId;
+
+    @ApiModelProperty("车牌号(最大长度16)")
+    private String plateNo;
+
+}

+ 18 - 0
src/main/java/com/xjrsoft/module/hikvision/vo/HikvisionCarListVo.java

@@ -0,0 +1,18 @@
+package com.xjrsoft.module.hikvision.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * 查询海康门禁点事件返回结果对象
+ * @Author: dzx
+ * @Date: 2024年9月19日
+ */
+@Data
+public class HikvisionCarListVo {
+
+
+    @ApiModelProperty("车牌号码")
+    private String plateNo;
+}

+ 93 - 0
src/main/java/com/xjrsoft/module/hikvision/vo/HikvisionCarOutinPageVo.java

@@ -0,0 +1,93 @@
+package com.xjrsoft.module.hikvision.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * 查询海康门禁点事件返回结果对象
+ * @Author: dzx
+ * @Date: 2024年9月19日
+ */
+@Data
+public class HikvisionCarOutinPageVo {
+
+
+    @ApiModelProperty("过车记录唯一标识")
+    private String crossRecordSyscode;
+
+    @ApiModelProperty("停车库唯一标识")
+    private String parkSyscode;
+
+    @ApiModelProperty("停车库名称")
+    private String parkName;
+
+    @ApiModelProperty("出入口唯一标识")
+    private String entranceSyscode;
+
+    @ApiModelProperty("出入口名称")
+    private String entranceName;
+
+    @ApiModelProperty("车道唯一标识")
+    private String roadwaySyscode;
+
+    @ApiModelProperty("车道名称")
+    private String roadwayName;
+
+    @ApiModelProperty("是否出场(0-进场, 1-出场)")
+    private Integer vehicleOut;
+
+    @ApiModelProperty("放行模式(0-禁止放行,1-固定车包期,2-临时车入场,3-预约车入场,10-离线出场,11-缴费出场,12-预付费出场,13-免费出场,30- 非法卡不放行,31-手动放行,32-特殊车辆放行,33-节假日放行,35-群组放行,36-遥控器开闸)")
+    private Integer releaseMode;
+
+    @ApiModelProperty("放行结果(0-未放行 1-正常放行 2-离线放行)")
+    private Integer releaseResult;
+
+    @ApiModelProperty("放行方式(10-未开闸 11-自动开闸 12-人工/人工开闸 13-遥控器开闸)")
+    private Integer releaseWay;
+
+    @ApiModelProperty("放行原因(100-固定车自动放行 101-临时车自动放行 102-预约车自动放行 103-一户多车自动放行)")
+    private Integer releaseReason;
+
+    @ApiModelProperty("车牌号码")
+    private String plateNo;
+
+    @ApiModelProperty("卡片号码")
+    private String cardNo;
+
+    @ApiModelProperty("车辆颜色(0:其他颜色; 1:白色; 2:银色; 3:灰色; 4:黑色; 5:红色; 6:深蓝色; 7:蓝色; 8:黄色; 9:绿色; 10:棕色; 11:粉色; 12:紫色)")
+    private Integer vehicleColor;
+
+    @ApiModelProperty("车辆类型(0:其他车; 1:小型车; 2:大型车; 3:摩托车)")
+    private Integer vehicleType;
+
+    @ApiModelProperty("车牌颜色(0:蓝色,1:黄色,2:白色,3:黑色,4:绿色,5:民航黑色, 255:其他颜色)")
+    private Integer plateColor;
+
+    @ApiModelProperty("车牌类型(0:标准民用车,1:02式民用车,3:警车,4:民用车双行尾牌车,5:使馆车,6:农用车,7:摩托车,8:新能源车)")
+    private Integer plateType;
+
+    @ApiModelProperty("车辆分类")
+    private String carCategory;
+
+    @ApiModelProperty("车辆分类名称")
+    private String carCategoryName;
+
+    @ApiModelProperty("车辆图片uri")
+    private String vehiclePicUri;
+
+    @ApiModelProperty("车牌图片uri")
+    private String plateNoPicUri;
+
+    @ApiModelProperty("人脸图片uri")
+    private String facePicUri;
+
+    @ApiModelProperty("图片服务唯一标识")
+    private String aswSyscode;
+
+    @ApiModelProperty("通过时间")
+    private String crossTime;
+
+    @ApiModelProperty("创建时间")
+    private String createTime;
+}