commit
8509c92af8
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-23 00:09:57 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-176] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-23 00:09:58 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-176] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-23 00:09:58 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-23 00:13:57 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-177] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-23 00:13:57 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-177] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-23 00:13:57 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-23 00:19:57 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-178] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-23 00:19:57 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-178] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-23 00:19:57 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-23 00:24:57 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-179] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-23 00:24:57 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-179] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-23 00:24:57 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-23 00:59:57 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-180] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-23 00:59:57 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-180] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-23 00:59:57 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-25 00:09:57 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-179] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-25 00:09:58 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-179] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-25 00:09:58 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-25 00:13:57 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-180] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-25 00:13:57 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-180] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-25 00:13:57 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-25 00:19:57 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-181] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-25 00:19:57 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-181] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-25 00:19:57 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-25 00:24:57 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-182] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-25 00:24:57 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-182] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-25 00:24:57 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-25 00:59:57 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-183] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-25 00:59:57 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-183] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-25 00:59:57 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-26 00:09:58 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-184] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-26 00:09:58 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-184] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-26 00:09:58 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-26 00:13:58 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-185] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-26 00:13:58 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-185] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-26 00:13:58 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-26 00:19:58 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-186] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-26 00:19:58 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-186] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-26 00:19:58 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-26 00:24:58 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-187] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-26 00:24:58 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-187] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-26 00:24:58 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-26 00:59:57 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-188] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-26 00:59:57 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-188] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-26 00:59:57 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-27 00:09:54 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-189] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-27 00:09:54 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-189] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-27 00:09:54 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-27 00:13:53 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-190] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-27 00:13:53 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-190] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-27 00:13:53 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-27 00:19:53 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-191] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-27 00:19:53 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-191] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-27 00:19:53 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-27 00:24:53 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-192] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-27 00:24:53 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-192] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-27 00:24:53 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
2026-07-27 00:59:53 [com.xxl.job.core.thread.JobThread#run]-[130]-[Thread-193] <br>----------- xxl-job job execute start -----------<br>----------- Param:null
|
||||||
|
2026-07-27 00:59:54 [com.xxl.job.core.thread.JobThread#run]-[176]-[Thread-193] <br>----------- xxl-job job execute end(finish) -----------<br>----------- Result: handleCode=200, handleMsg = null
|
||||||
|
2026-07-27 00:59:54 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] <br>----------- xxl-job job callback finish.
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
dahua:
|
||||||
|
oauth:
|
||||||
|
host: 123.183.159.35
|
||||||
|
client-id: 123.183.159.35
|
||||||
|
client-secret: 4edfdcd2-67e6-41db-a1ae-b98d47a70266
|
||||||
|
username: system
|
||||||
|
password: zcloud88888
|
||||||
|
http: false
|
||||||
|
port: 4443
|
||||||
|
|
@ -15,7 +15,7 @@ spring:
|
||||||
name: ${application.name}${application.version}
|
name: ${application.name}${application.version}
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: test
|
active: test,local
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
config:
|
config:
|
||||||
|
|
@ -41,5 +41,4 @@ spring:
|
||||||
- config-flyway.yml
|
- config-flyway.yml
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: ${spring.cloud.nacos.config.server-addr}
|
server-addr: ${spring.cloud.nacos.config.server-addr}
|
||||||
namespace: ${spring.cloud.nacos.config.namespace}
|
namespace: ${spring.cloud.nacos.config.namespace}
|
||||||
|
|
||||||
|
|
@ -2,13 +2,20 @@ package com.zcloud.primeport.web;
|
||||||
|
|
||||||
import com.alibaba.cola.dto.SingleResponse;
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
import com.zcloud.primeport.api.DaHuaServiceI;
|
import com.zcloud.primeport.api.DaHuaServiceI;
|
||||||
|
import com.zcloud.primeport.domain.model.DaHuaAccessRecordCmd;
|
||||||
|
import com.zcloud.primeport.domain.model.DaHuaCarAddCmd;
|
||||||
|
import com.zcloud.primeport.domain.model.DaHuaCarPageCmd;
|
||||||
import com.zcloud.primeport.domain.model.DaHuaPersonSyncCmd;
|
import com.zcloud.primeport.domain.model.DaHuaPersonSyncCmd;
|
||||||
|
import com.zcloud.primeport.dto.DaHuaCarDeleteCmd;
|
||||||
|
import com.zcloud.primeport.dto.DaHuaPersonDeleteCmd;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Api(tags = "大华平台对接")
|
@Api(tags = "大华平台对接")
|
||||||
@RequestMapping("/${application.gateway}/dahua")
|
@RequestMapping("/${application.gateway}/dahua")
|
||||||
@RestController
|
@RestController
|
||||||
|
|
@ -17,6 +24,15 @@ public class DaHuaController {
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
private DaHuaServiceI daHuaService;
|
private DaHuaServiceI daHuaService;
|
||||||
|
|
||||||
|
@ApiOperation("生成人员全局ID")
|
||||||
|
@GetMapping("/person/generate-id")
|
||||||
|
public SingleResponse<Long> generatePersonId() {
|
||||||
|
if (daHuaService == null) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
|
return daHuaService.generatePersonId();
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("同步人员到大华平台-新增")
|
@ApiOperation("同步人员到大华平台-新增")
|
||||||
@PostMapping("/person/sync")
|
@PostMapping("/person/sync")
|
||||||
public SingleResponse<Boolean> syncPerson(@Validated @RequestBody DaHuaPersonSyncCmd cmd) {
|
public SingleResponse<Boolean> syncPerson(@Validated @RequestBody DaHuaPersonSyncCmd cmd) {
|
||||||
|
|
@ -26,4 +42,67 @@ public class DaHuaController {
|
||||||
}
|
}
|
||||||
return daHuaService.syncPerson(cmd);
|
return daHuaService.syncPerson(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改人员")
|
||||||
|
@PutMapping("/person/update")
|
||||||
|
public SingleResponse<Boolean> updatePerson(@Validated @RequestBody DaHuaPersonSyncCmd cmd) {
|
||||||
|
if (daHuaService == null) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
|
return daHuaService.updatePerson(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("新增车辆")
|
||||||
|
@PostMapping("/car/add")
|
||||||
|
public SingleResponse<Boolean> addCar(@Validated @RequestBody DaHuaCarAddCmd cmd) {
|
||||||
|
if (daHuaService == null) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
|
return daHuaService.addCar(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改车辆")
|
||||||
|
@PutMapping("/car/update")
|
||||||
|
public SingleResponse<Boolean> updateCar(@Validated @RequestBody DaHuaCarAddCmd cmd) {
|
||||||
|
if (daHuaService == null) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
|
return daHuaService.updateCar(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("车辆分页查询(根据车牌查carCode)")
|
||||||
|
@PostMapping("/car/page")
|
||||||
|
public SingleResponse<Map<String, Object>> pageCar(@Validated @RequestBody DaHuaCarPageCmd cmd) {
|
||||||
|
if (daHuaService == null) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
|
return daHuaService.pageCar(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除车辆")
|
||||||
|
@PostMapping("/car/delete")
|
||||||
|
public SingleResponse<Boolean> deleteCar(@Validated @RequestBody DaHuaCarDeleteCmd cmd) {
|
||||||
|
if (daHuaService == null) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
|
return daHuaService.deleteCar(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("门禁事件查询(刷卡记录分页)")
|
||||||
|
@PostMapping("/access/record")
|
||||||
|
public SingleResponse<Map<String, Object>> queryAccessRecord(@Validated @RequestBody DaHuaAccessRecordCmd cmd) {
|
||||||
|
if (daHuaService == null) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
|
return daHuaService.queryAccessRecord(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除人员")
|
||||||
|
@PostMapping("/person/delete")
|
||||||
|
public SingleResponse<Boolean> deletePerson(@Validated @RequestBody DaHuaPersonDeleteCmd cmd) {
|
||||||
|
if (daHuaService == null) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
|
return daHuaService.deletePerson(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,22 +3,196 @@ package com.zcloud.primeport.service;
|
||||||
import com.alibaba.cola.dto.SingleResponse;
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
import com.zcloud.primeport.api.DaHuaServiceI;
|
import com.zcloud.primeport.api.DaHuaServiceI;
|
||||||
import com.zcloud.primeport.domain.gateway.DaHuaGateway;
|
import com.zcloud.primeport.domain.gateway.DaHuaGateway;
|
||||||
|
import com.zcloud.primeport.domain.model.DaHuaAccessRecordCmd;
|
||||||
|
import com.zcloud.primeport.domain.model.DaHuaCarAddCmd;
|
||||||
|
import com.zcloud.primeport.domain.model.DaHuaCarPageCmd;
|
||||||
import com.zcloud.primeport.domain.model.DaHuaPersonSyncCmd;
|
import com.zcloud.primeport.domain.model.DaHuaPersonSyncCmd;
|
||||||
|
import com.zcloud.primeport.dto.DaHuaCarDeleteCmd;
|
||||||
|
import com.zcloud.primeport.dto.DaHuaPersonDeleteCmd;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class DaHuaServiceImpl implements DaHuaServiceI {
|
public class DaHuaServiceImpl implements DaHuaServiceI {
|
||||||
|
|
||||||
@Autowired(required = false)
|
@Autowired
|
||||||
private DaHuaGateway daHuaGateway;
|
private DaHuaGateway daHuaGateway;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SingleResponse<Long> generatePersonId() {
|
||||||
|
Long id = daHuaGateway.generatePersonId();
|
||||||
|
System.out.println("大华生成人员ID返回: " + id);
|
||||||
|
return SingleResponse.of(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SingleResponse<Boolean> syncPerson(DaHuaPersonSyncCmd cmd) {
|
public SingleResponse<Boolean> syncPerson(DaHuaPersonSyncCmd cmd) {
|
||||||
if (daHuaGateway == null) {
|
Long personId = daHuaGateway.generatePersonId();
|
||||||
throw new RuntimeException("大华服务未配置");
|
System.out.println("大华自动生成人员ID: " + personId);
|
||||||
|
cmd.setId(personId);
|
||||||
|
Map<String, Object> syncResult = daHuaGateway.syncPerson(cmd);
|
||||||
|
Boolean passed = (Boolean) syncResult.get("passed");
|
||||||
|
Boolean dhSuccess = (Boolean) syncResult.get("success");
|
||||||
|
String dhCode = (String) syncResult.get("code");
|
||||||
|
String dhErrMsg = (String) syncResult.get("errMsg");
|
||||||
|
SingleResponse<Boolean> resp = new SingleResponse<>();
|
||||||
|
resp.setSuccess(dhSuccess != null ? dhSuccess : passed);
|
||||||
|
resp.setErrCode(dhCode);
|
||||||
|
resp.setErrMessage(dhErrMsg);
|
||||||
|
resp.setData(passed);
|
||||||
|
System.out.println("大华同步人员最终返回 - success:" + resp.isSuccess() + ", errCode:" + resp.getErrCode() + ", errMessage:" + resp.getErrMessage() + ", data:" + resp.getData());
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SingleResponse<Boolean> updatePerson(DaHuaPersonSyncCmd cmd) {
|
||||||
|
Map<String, Object> updateResult = daHuaGateway.updatePerson(cmd);
|
||||||
|
Boolean passed = (Boolean) updateResult.get("passed");
|
||||||
|
Boolean dhSuccess = (Boolean) updateResult.get("success");
|
||||||
|
String dhCode = (String) updateResult.get("code");
|
||||||
|
String dhErrMsg = (String) updateResult.get("errMsg");
|
||||||
|
SingleResponse<Boolean> resp = new SingleResponse<>();
|
||||||
|
resp.setSuccess(dhSuccess != null ? dhSuccess : passed);
|
||||||
|
resp.setErrCode(dhCode);
|
||||||
|
resp.setErrMessage(dhErrMsg);
|
||||||
|
resp.setData(passed);
|
||||||
|
System.out.println("大华修改人员最终返回 - success:" + resp.isSuccess() + ", errCode:" + resp.getErrCode() + ", errMessage:" + resp.getErrMessage() + ", data:" + resp.getData());
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SingleResponse<Boolean> deletePerson(DaHuaPersonDeleteCmd cmd) {
|
||||||
|
Map<String, Object> deleteResult = daHuaGateway.deletePerson(cmd.getIds(), cmd.getOpenDeleteFlag());
|
||||||
|
Boolean passed = (Boolean) deleteResult.get("passed");
|
||||||
|
Boolean dhSuccess = (Boolean) deleteResult.get("success");
|
||||||
|
String dhCode = (String) deleteResult.get("code");
|
||||||
|
String dhErrMsg = (String) deleteResult.get("errMsg");
|
||||||
|
SingleResponse<Boolean> resp = new SingleResponse<>();
|
||||||
|
resp.setSuccess(dhSuccess != null ? dhSuccess : passed);
|
||||||
|
resp.setErrCode(dhCode);
|
||||||
|
resp.setErrMessage(dhErrMsg);
|
||||||
|
resp.setData(passed);
|
||||||
|
System.out.println("大华删除人员最终返回 - success:" + resp.isSuccess() + ", errCode:" + resp.getErrCode() + ", errMessage:" + resp.getErrMessage() + ", data:" + resp.getData());
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SingleResponse<Boolean> addCar(DaHuaCarAddCmd cmd) {
|
||||||
|
Map<String, Object> addResult = daHuaGateway.addCar(cmd);
|
||||||
|
Boolean passed = (Boolean) addResult.get("passed");
|
||||||
|
Boolean dhSuccess = (Boolean) addResult.get("success");
|
||||||
|
String dhCode = (String) addResult.get("code");
|
||||||
|
String dhErrMsg = (String) addResult.get("errMsg");
|
||||||
|
SingleResponse<Boolean> resp = new SingleResponse<>();
|
||||||
|
resp.setSuccess(dhSuccess != null ? dhSuccess : passed);
|
||||||
|
resp.setErrCode(dhCode);
|
||||||
|
resp.setErrMessage(dhErrMsg);
|
||||||
|
resp.setData(passed);
|
||||||
|
System.out.println("大华新增车辆最终返回 - success:" + resp.isSuccess() + ", errCode:" + resp.getErrCode() + ", errMessage:" + resp.getErrMessage() + ", data:" + resp.getData());
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SingleResponse<Boolean> updateCar(DaHuaCarAddCmd cmd) {
|
||||||
|
if ((cmd.getCarCode() == null || cmd.getCarCode().trim().isEmpty())
|
||||||
|
&& cmd.getCarNum() != null && !cmd.getCarNum().trim().isEmpty()) {
|
||||||
|
DaHuaCarPageCmd pageCmd = new DaHuaCarPageCmd();
|
||||||
|
pageCmd.setCarNumList(java.util.Collections.singletonList(cmd.getCarNum()));
|
||||||
|
System.out.println("大华修改车辆:carCode为空,尝试根据carNum=" + cmd.getCarNum() + "查询carCode");
|
||||||
|
Map<String, Object> pageResult = daHuaGateway.pageCar(pageCmd);
|
||||||
|
Boolean pagePassed = (Boolean) pageResult.get("passed");
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Map<String, Object> pageDataMap = (Map<String, Object>) pageResult.get("data");
|
||||||
|
if (pagePassed != null && pagePassed && pageDataMap != null) {
|
||||||
|
Object pageDataObj = pageDataMap.get("pageData");
|
||||||
|
if (pageDataObj instanceof java.util.List) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
java.util.List<Map<String, Object>> pageDataList = (java.util.List<Map<String, Object>>) pageDataObj;
|
||||||
|
for (Map<String, Object> item : pageDataList) {
|
||||||
|
Object carNumObj = item.get("carNum");
|
||||||
|
if (carNumObj != null && cmd.getCarNum().equals(carNumObj.toString())) {
|
||||||
|
Object carCodeObj = item.get("carCode");
|
||||||
|
if (carCodeObj != null) {
|
||||||
|
String foundCarCode = carCodeObj.toString();
|
||||||
|
cmd.setCarCode(foundCarCode);
|
||||||
|
System.out.println("大华修改车辆:根据carNum=" + cmd.getCarNum() + "自动匹配到carCode=" + foundCarCode);
|
||||||
|
if (cmd.getDepartmentId() == null && item.get("departmentId") != null) {
|
||||||
|
Long deptId = Long.valueOf(item.get("departmentId").toString());
|
||||||
|
cmd.setDepartmentId(deptId);
|
||||||
|
System.out.println("大华修改车辆:自动补充departmentId=" + deptId);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Boolean result = daHuaGateway.syncPerson(cmd);
|
Map<String, Object> updateResult = daHuaGateway.updateCar(cmd);
|
||||||
return SingleResponse.of(result);
|
Boolean passed = (Boolean) updateResult.get("passed");
|
||||||
|
Boolean dhSuccess = (Boolean) updateResult.get("success");
|
||||||
|
String dhCode = (String) updateResult.get("code");
|
||||||
|
String dhErrMsg = (String) updateResult.get("errMsg");
|
||||||
|
SingleResponse<Boolean> resp = new SingleResponse<>();
|
||||||
|
resp.setSuccess(dhSuccess != null ? dhSuccess : passed);
|
||||||
|
resp.setErrCode(dhCode);
|
||||||
|
resp.setErrMessage(dhErrMsg);
|
||||||
|
resp.setData(passed);
|
||||||
|
System.out.println("大华修改车辆最终返回 - success:" + resp.isSuccess() + ", errCode:" + resp.getErrCode() + ", errMessage:" + resp.getErrMessage() + ", data:" + resp.getData());
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public SingleResponse<Map<String, Object>> pageCar(DaHuaCarPageCmd cmd) {
|
||||||
|
Map<String, Object> pageResult = daHuaGateway.pageCar(cmd);
|
||||||
|
Boolean passed = (Boolean) pageResult.get("passed");
|
||||||
|
Boolean dhSuccess = (Boolean) pageResult.get("success");
|
||||||
|
String dhCode = (String) pageResult.get("code");
|
||||||
|
String dhErrMsg = (String) pageResult.get("errMsg");
|
||||||
|
Map<String, Object> dhData = (Map<String, Object>) pageResult.get("data");
|
||||||
|
SingleResponse<Map<String, Object>> resp = new SingleResponse<>();
|
||||||
|
resp.setSuccess(dhSuccess != null ? dhSuccess : passed);
|
||||||
|
resp.setErrCode(dhCode);
|
||||||
|
resp.setErrMessage(dhErrMsg);
|
||||||
|
resp.setData(dhData);
|
||||||
|
System.out.println("大华车辆分页查询最终返回 - success:" + resp.isSuccess() + ", errCode:" + resp.getErrCode() + ", errMessage:" + resp.getErrMessage() + ", data:" + (dhData != null ? "已返回数据" : "null"));
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SingleResponse<Boolean> deleteCar(DaHuaCarDeleteCmd cmd) {
|
||||||
|
Map<String, Object> deleteResult = daHuaGateway.deleteCar(cmd.getCarNumList());
|
||||||
|
Boolean passed = (Boolean) deleteResult.get("passed");
|
||||||
|
Boolean dhSuccess = (Boolean) deleteResult.get("success");
|
||||||
|
String dhCode = (String) deleteResult.get("code");
|
||||||
|
String dhErrMsg = (String) deleteResult.get("errMsg");
|
||||||
|
SingleResponse<Boolean> resp = new SingleResponse<>();
|
||||||
|
resp.setSuccess(dhSuccess != null ? dhSuccess : passed);
|
||||||
|
resp.setErrCode(dhCode);
|
||||||
|
resp.setErrMessage(dhErrMsg);
|
||||||
|
resp.setData(passed);
|
||||||
|
System.out.println("大华删除车辆最终返回 - success:" + resp.isSuccess() + ", errCode:" + resp.getErrCode() + ", errMessage:" + resp.getErrMessage() + ", data:" + resp.getData());
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public SingleResponse<Map<String, Object>> queryAccessRecord(DaHuaAccessRecordCmd cmd) {
|
||||||
|
Map<String, Object> queryResult = daHuaGateway.queryAccessRecord(cmd);
|
||||||
|
Boolean passed = (Boolean) queryResult.get("passed");
|
||||||
|
Boolean dhSuccess = (Boolean) queryResult.get("success");
|
||||||
|
String dhCode = (String) queryResult.get("code");
|
||||||
|
String dhErrMsg = (String) queryResult.get("errMsg");
|
||||||
|
Map<String, Object> dhData = (Map<String, Object>) queryResult.get("data");
|
||||||
|
SingleResponse<Map<String, Object>> resp = new SingleResponse<>();
|
||||||
|
resp.setSuccess(dhSuccess != null ? dhSuccess : passed);
|
||||||
|
resp.setErrCode(dhCode);
|
||||||
|
resp.setErrMessage(dhErrMsg);
|
||||||
|
resp.setData(dhData);
|
||||||
|
System.out.println("大华门禁事件查询最终返回 - success:" + resp.isSuccess() + ", errCode:" + resp.getErrCode() + ", errMessage:" + resp.getErrMessage() + ", data:" + (dhData != null ? "已返回数据" : "null"));
|
||||||
|
return resp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,33 @@
|
||||||
package com.zcloud.primeport.api;
|
package com.zcloud.primeport.api;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.MultiResponse;
|
||||||
import com.alibaba.cola.dto.SingleResponse;
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
|
import com.zcloud.primeport.domain.model.DaHuaAccessRecordCmd;
|
||||||
|
import com.zcloud.primeport.domain.model.DaHuaCarAddCmd;
|
||||||
|
import com.zcloud.primeport.domain.model.DaHuaCarPageCmd;
|
||||||
import com.zcloud.primeport.domain.model.DaHuaPersonSyncCmd;
|
import com.zcloud.primeport.domain.model.DaHuaPersonSyncCmd;
|
||||||
|
import com.zcloud.primeport.dto.DaHuaCarDeleteCmd;
|
||||||
|
import com.zcloud.primeport.dto.DaHuaPersonDeleteCmd;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface DaHuaServiceI {
|
public interface DaHuaServiceI {
|
||||||
|
|
||||||
|
SingleResponse<Long> generatePersonId();
|
||||||
|
|
||||||
SingleResponse<Boolean> syncPerson(DaHuaPersonSyncCmd cmd);
|
SingleResponse<Boolean> syncPerson(DaHuaPersonSyncCmd cmd);
|
||||||
|
|
||||||
|
SingleResponse<Boolean> updatePerson(DaHuaPersonSyncCmd cmd);
|
||||||
|
|
||||||
|
SingleResponse<Boolean> deletePerson(DaHuaPersonDeleteCmd cmd);
|
||||||
|
|
||||||
|
SingleResponse<Boolean> addCar(DaHuaCarAddCmd cmd);
|
||||||
|
|
||||||
|
SingleResponse<Boolean> updateCar(DaHuaCarAddCmd cmd);
|
||||||
|
|
||||||
|
SingleResponse<Map<String, Object>> pageCar(DaHuaCarPageCmd cmd);
|
||||||
|
|
||||||
|
SingleResponse<Boolean> deleteCar(DaHuaCarDeleteCmd cmd);
|
||||||
|
|
||||||
|
SingleResponse<Map<String, Object>> queryAccessRecord(DaHuaAccessRecordCmd cmd);
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.zcloud.primeport.dto;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.Command;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DaHuaCarDeleteCmd extends Command {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "车牌号数组", required = true)
|
||||||
|
@NotEmpty(message = "carNumList不能为空")
|
||||||
|
private List<String> carNumList;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.zcloud.primeport.dto;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.Command;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DaHuaCarPageCmd extends Command {
|
||||||
|
|
||||||
|
@ApiModelProperty("车牌列表,最大支持500")
|
||||||
|
private List<String> carNumList;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.zcloud.primeport.dto;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.Command;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DaHuaPersonDeleteCmd extends Command {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "人员id数组", required = true)
|
||||||
|
@NotEmpty(message = "ids不能为空")
|
||||||
|
private List<Long> ids;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否开放删除标识(默认不传:解绑卡片、删除车辆)")
|
||||||
|
private Integer openDeleteFlag;
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,30 @@
|
||||||
package com.zcloud.primeport.domain.gateway;
|
package com.zcloud.primeport.domain.gateway;
|
||||||
|
|
||||||
|
import com.zcloud.primeport.domain.model.DaHuaAccessRecordCmd;
|
||||||
|
import com.zcloud.primeport.domain.model.DaHuaCarAddCmd;
|
||||||
|
import com.zcloud.primeport.domain.model.DaHuaCarPageCmd;
|
||||||
import com.zcloud.primeport.domain.model.DaHuaPersonSyncCmd;
|
import com.zcloud.primeport.domain.model.DaHuaPersonSyncCmd;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface DaHuaGateway {
|
public interface DaHuaGateway {
|
||||||
|
|
||||||
Boolean syncPerson(DaHuaPersonSyncCmd cmd);
|
Long generatePersonId();
|
||||||
|
|
||||||
|
Map<String, Object> syncPerson(DaHuaPersonSyncCmd cmd);
|
||||||
|
|
||||||
|
Map<String, Object> updatePerson(DaHuaPersonSyncCmd cmd);
|
||||||
|
|
||||||
|
Map<String, Object> deletePerson(List<Long> ids, Integer openDeleteFlag);
|
||||||
|
|
||||||
|
Map<String, Object> addCar(DaHuaCarAddCmd cmd);
|
||||||
|
|
||||||
|
Map<String, Object> updateCar(DaHuaCarAddCmd cmd);
|
||||||
|
|
||||||
|
Map<String, Object> pageCar(DaHuaCarPageCmd cmd);
|
||||||
|
|
||||||
|
Map<String, Object> deleteCar(List<String> carNumList);
|
||||||
|
|
||||||
|
Map<String, Object> queryAccessRecord(DaHuaAccessRecordCmd cmd);
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
package com.zcloud.primeport.domain.model;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.Command;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DaHuaAccessRecordCmd extends Command {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "页码,正整数", required = true)
|
||||||
|
@NotNull(message = "pageNum不能为空")
|
||||||
|
private Integer pageNum;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "分页大小,正整数,推荐不超过10000", required = true)
|
||||||
|
@NotNull(message = "pageSize不能为空")
|
||||||
|
private Integer pageSize;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "刷卡开始时间,格式yyyy-MM-dd HH:mm:ss", required = true)
|
||||||
|
@NotBlank(message = "startSwingTime不能为空")
|
||||||
|
private String startSwingTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "刷卡结束时间,格式yyyy-MM-dd HH:mm:ss", required = true)
|
||||||
|
@NotBlank(message = "endSwingTime不能为空")
|
||||||
|
private String endSwingTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("入库开始时间,格式yyyy-MM-dd HH:mm:ss,V1.1.4新增")
|
||||||
|
private String startCreateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("入库结束时间,格式yyyy-MM-dd HH:mm:ss,V1.1.4新增")
|
||||||
|
private String endCreateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("开门类型")
|
||||||
|
private Integer openType;
|
||||||
|
|
||||||
|
@ApiModelProperty("开门类型多选")
|
||||||
|
private List<Integer> openTypes;
|
||||||
|
|
||||||
|
@ApiModelProperty("卡片类型,不传-全部,0-IC卡,1-有源RFID,2-CPU卡")
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
@ApiModelProperty("人员名称")
|
||||||
|
private String personName;
|
||||||
|
|
||||||
|
@ApiModelProperty("人员编号")
|
||||||
|
private String personCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("通道编码列表,最大500")
|
||||||
|
private List<String> channelCodes;
|
||||||
|
|
||||||
|
@ApiModelProperty("部门ID,多个逗号分隔")
|
||||||
|
private String deptIds;
|
||||||
|
|
||||||
|
@ApiModelProperty("卡号,字母或数字")
|
||||||
|
private String cardNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty("事件类型,不传-全部,1-进门,2-出门,3-进/出门")
|
||||||
|
private Integer enterOrExit;
|
||||||
|
|
||||||
|
@ApiModelProperty("开门结果,不传-全部,1-成功,0-失败")
|
||||||
|
private Integer openResult;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否超温")
|
||||||
|
private Boolean overTemp;
|
||||||
|
|
||||||
|
@ApiModelProperty("体温低限")
|
||||||
|
private Float curTempStart;
|
||||||
|
|
||||||
|
@ApiModelProperty("体温高限")
|
||||||
|
private Float curTempEnd;
|
||||||
|
|
||||||
|
@ApiModelProperty("口罩状态 3-戴口罩,2-没戴口罩,1-未识别")
|
||||||
|
private Integer maskState;
|
||||||
|
|
||||||
|
@ApiModelProperty("访客筛选,1-只查询访客记录,2-只查询非访客记录")
|
||||||
|
private Integer visitorFilter;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.zcloud.primeport.domain.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DaHuaCarAddCmd {
|
||||||
|
|
||||||
|
private String carCode;
|
||||||
|
|
||||||
|
private String carNum;
|
||||||
|
|
||||||
|
private String carNumColor;
|
||||||
|
|
||||||
|
private String carType;
|
||||||
|
|
||||||
|
private String carBrand;
|
||||||
|
|
||||||
|
private String carColor;
|
||||||
|
|
||||||
|
private Long departmentId;
|
||||||
|
|
||||||
|
private String departmentName;
|
||||||
|
|
||||||
|
private Long ownerId;
|
||||||
|
|
||||||
|
private String service;
|
||||||
|
|
||||||
|
private Object fieldExt;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.zcloud.primeport.domain.model;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.Command;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DaHuaCarPageCmd extends Command {
|
||||||
|
|
||||||
|
@ApiModelProperty("车牌列表,最大支持500")
|
||||||
|
private List<String> carNumList;
|
||||||
|
}
|
||||||
|
|
@ -39,5 +39,12 @@
|
||||||
<groupId>com.jjb.saas</groupId>
|
<groupId>com.jjb.saas</groupId>
|
||||||
<artifactId>jjb-saas-framework-facade</artifactId>
|
<artifactId>jjb-saas-framework-facade</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.bytebuddy</groupId>
|
||||||
|
<artifactId>byte-buddy</artifactId>
|
||||||
|
<version>1.12.23</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -3,26 +3,119 @@ package com.zcloud.primeport.dahua.api;
|
||||||
import com.dahuatech.icc.exception.ClientException;
|
import com.dahuatech.icc.exception.ClientException;
|
||||||
import com.dahuatech.icc.oauth.model.v202010.GeneralResponse;
|
import com.dahuatech.icc.oauth.model.v202010.GeneralResponse;
|
||||||
import com.zcloud.primeport.dahua.client.DaHuaApiClient;
|
import com.zcloud.primeport.dahua.client.DaHuaApiClient;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ConditionalOnBean(DaHuaApiClient.class)
|
|
||||||
public class DaHuaPersonApi {
|
public class DaHuaPersonApi {
|
||||||
|
|
||||||
@Resource
|
@Autowired(required = false)
|
||||||
private DaHuaApiClient daHuaApiClient;
|
private DaHuaApiClient daHuaApiClient;
|
||||||
|
|
||||||
private static final String PERSON_ADD_URL = "/evo-apigw/evo-brm/1.2.0/person/subsystem/add";
|
private static final String PERSON_ADD_URL = "/evo-apigw/evo-brm/1.2.0/person/subsystem/add";
|
||||||
|
private static final String PERSON_UPDATE_URL = "/evo-apigw/evo-brm/1.2.0/person/subsystem/update";
|
||||||
|
private static final String PERSON_GENERATE_ID_URL = "/evo-apigw/evo-brm/1.0.0/person/generate-id";
|
||||||
|
private static final String PERSON_DELETE_URL = "/evo-apigw/evo-brm/1.0.0/person/delete";
|
||||||
|
private static final String CAR_ADD_URL = "/evo-apigw/evo-brm/1.0.0/car/add";
|
||||||
|
private static final String CAR_UPDATE_URL = "/evo-apigw/evo-brm/1.0.0/car/update";
|
||||||
|
private static final String CAR_PAGE_URL = "/evo-apigw/evo-brm/1.2.0/car/subsystem/page";
|
||||||
|
private static final String CAR_DELETE_URL = "/evo-apigw/evo-brm/1.0.0/car/delete";
|
||||||
|
private static final String ACCESS_RECORD_URL = "/evo-apigw/evo-accesscontrol/1.0.0/card/accessControl/swingCardRecord/bycondition/combined";
|
||||||
|
|
||||||
|
public boolean isConfigured() {
|
||||||
|
return daHuaApiClient != null;
|
||||||
|
}
|
||||||
|
|
||||||
public GeneralResponse addPerson(Map<String, Object> body) throws ClientException {
|
public GeneralResponse addPerson(Map<String, Object> body) throws ClientException {
|
||||||
|
if (daHuaApiClient == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
String token = daHuaApiClient.getToken();
|
String token = daHuaApiClient.getToken();
|
||||||
Map<String, String> headers = new HashMap<>();
|
Map<String, String> headers = new HashMap<>();
|
||||||
headers.put("Authorization", "bearer " + token);
|
headers.put("Authorization", "bearer " + token);
|
||||||
return daHuaApiClient.postJson(PERSON_ADD_URL, body, headers);
|
return daHuaApiClient.postJson(PERSON_ADD_URL, body, headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GeneralResponse updatePerson(Map<String, Object> body) throws ClientException {
|
||||||
|
if (daHuaApiClient == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String token = daHuaApiClient.getToken();
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("Authorization", "bearer " + token);
|
||||||
|
return daHuaApiClient.putJson(PERSON_UPDATE_URL, body, headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeneralResponse generatePersonId() throws ClientException {
|
||||||
|
if (daHuaApiClient == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String token = daHuaApiClient.getToken();
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("Authorization", "bearer " + token);
|
||||||
|
return daHuaApiClient.getForm(PERSON_GENERATE_ID_URL, null, headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeneralResponse deletePerson(Map<String, Object> body) throws ClientException {
|
||||||
|
if (daHuaApiClient == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String token = daHuaApiClient.getToken();
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("Authorization", "bearer " + token);
|
||||||
|
return daHuaApiClient.postJson(PERSON_DELETE_URL, body, headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeneralResponse addCar(Map<String, Object> body) throws ClientException {
|
||||||
|
if (daHuaApiClient == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String token = daHuaApiClient.getToken();
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("Authorization", "bearer " + token);
|
||||||
|
return daHuaApiClient.postJson(CAR_ADD_URL, body, headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeneralResponse updateCar(Map<String, Object> body) throws ClientException {
|
||||||
|
if (daHuaApiClient == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String token = daHuaApiClient.getToken();
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("Authorization", "bearer " + token);
|
||||||
|
return daHuaApiClient.putJson(CAR_UPDATE_URL, body, headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeneralResponse pageCar(Map<String, Object> body) throws ClientException {
|
||||||
|
if (daHuaApiClient == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String token = daHuaApiClient.getToken();
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("Authorization", "bearer " + token);
|
||||||
|
return daHuaApiClient.postJson(CAR_PAGE_URL, body, headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeneralResponse deleteCar(Map<String, Object> body) throws ClientException {
|
||||||
|
if (daHuaApiClient == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String token = daHuaApiClient.getToken();
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("Authorization", "bearer " + token);
|
||||||
|
return daHuaApiClient.postJson(CAR_DELETE_URL, body, headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeneralResponse queryAccessRecord(Map<String, Object> body) throws ClientException {
|
||||||
|
if (daHuaApiClient == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String token = daHuaApiClient.getToken();
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("Authorization", "bearer " + token);
|
||||||
|
return daHuaApiClient.postJson(ACCESS_RECORD_URL, body, headers);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,18 +3,19 @@ package com.zcloud.primeport.dahua.config;
|
||||||
import com.dahuatech.icc.oauth.model.v202010.OauthConfigUserPwdInfo;
|
import com.dahuatech.icc.oauth.model.v202010.OauthConfigUserPwdInfo;
|
||||||
import com.zcloud.primeport.dahua.client.DaHuaApiClient;
|
import com.zcloud.primeport.dahua.client.DaHuaApiClient;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableConfigurationProperties(DaHuaProperties.class)
|
@EnableConfigurationProperties(DaHuaProperties.class)
|
||||||
@ConditionalOnProperty(prefix = "dahua.oauth", name = "host")
|
|
||||||
public class DaHuaAutoConfig {
|
public class DaHuaAutoConfig {
|
||||||
|
|
||||||
@Bean("dahuaApiOauthConfig")
|
@Bean("dahuaApiOauthConfig")
|
||||||
public OauthConfigUserPwdInfo dahuaApiOauthConfig(DaHuaProperties properties) {
|
public OauthConfigUserPwdInfo dahuaApiOauthConfig(DaHuaProperties properties) {
|
||||||
|
if (properties.getHost() == null || properties.getHost().trim().isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
OauthConfigUserPwdInfo config = new OauthConfigUserPwdInfo(
|
OauthConfigUserPwdInfo config = new OauthConfigUserPwdInfo(
|
||||||
properties.getHost(),
|
properties.getHost(),
|
||||||
properties.getClientId(),
|
properties.getClientId(),
|
||||||
|
|
@ -24,13 +25,20 @@ public class DaHuaAutoConfig {
|
||||||
properties.isHttp(),
|
properties.isHttp(),
|
||||||
properties.getPort()
|
properties.getPort()
|
||||||
);
|
);
|
||||||
config.getHttpConfigInfo().setReadTimeout(properties.getReadTimeout());
|
if (properties.getReadTimeout() != null) {
|
||||||
config.getHttpConfigInfo().setConnectionTimeout(properties.getConnectionTimeout());
|
config.getHttpConfigInfo().setReadTimeout(properties.getReadTimeout());
|
||||||
|
}
|
||||||
|
if (properties.getConnectionTimeout() != null) {
|
||||||
|
config.getHttpConfigInfo().setConnectionTimeout(properties.getConnectionTimeout());
|
||||||
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public DaHuaApiClient daHuaApiClient(@Qualifier("dahuaApiOauthConfig") OauthConfigUserPwdInfo oauthConfig) {
|
public DaHuaApiClient daHuaApiClient(@Qualifier("dahuaApiOauthConfig") OauthConfigUserPwdInfo oauthConfig) {
|
||||||
|
if (oauthConfig == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return new DaHuaApiClient(oauthConfig);
|
return new DaHuaApiClient(oauthConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,38 +1,181 @@
|
||||||
package com.zcloud.primeport.gatewayimpl;
|
package com.zcloud.primeport.gatewayimpl;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.dahuatech.icc.exception.ClientException;
|
import com.dahuatech.icc.exception.ClientException;
|
||||||
import com.dahuatech.icc.oauth.model.v202010.GeneralResponse;
|
import com.dahuatech.icc.oauth.model.v202010.GeneralResponse;
|
||||||
import com.zcloud.primeport.dahua.api.DaHuaPersonApi;
|
import com.zcloud.primeport.dahua.api.DaHuaPersonApi;
|
||||||
import com.zcloud.primeport.domain.gateway.DaHuaGateway;
|
import com.zcloud.primeport.domain.gateway.DaHuaGateway;
|
||||||
|
import com.zcloud.primeport.domain.model.DaHuaAccessRecordCmd;
|
||||||
|
import com.zcloud.primeport.domain.model.DaHuaCarAddCmd;
|
||||||
|
import com.zcloud.primeport.domain.model.DaHuaCarPageCmd;
|
||||||
import com.zcloud.primeport.domain.model.DaHuaPersonSyncCmd;
|
import com.zcloud.primeport.domain.model.DaHuaPersonSyncCmd;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
|
||||||
@ConditionalOnBean(DaHuaPersonApi.class)
|
|
||||||
public class DaHuaGatewayImpl implements DaHuaGateway {
|
public class DaHuaGatewayImpl implements DaHuaGateway {
|
||||||
|
|
||||||
private final DaHuaPersonApi daHuaPersonApi;
|
@Autowired(required = false)
|
||||||
|
private DaHuaPersonApi daHuaPersonApi;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean syncPerson(DaHuaPersonSyncCmd cmd) {
|
public Long generatePersonId() {
|
||||||
Map<String, Object> body = convertToMap(cmd);
|
if (daHuaPersonApi == null || !daHuaPersonApi.isConfigured()) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
GeneralResponse response = daHuaPersonApi.addPerson(body);
|
GeneralResponse response = daHuaPersonApi.generatePersonId();
|
||||||
return response != null && "0".equals(response.getCode());
|
String responseJson = JSONUtil.toJsonStr(response);
|
||||||
|
log.info("大华生成人员ID返回结果: {}", responseJson);
|
||||||
|
System.out.println("大华生成人员ID返回结果: " + responseJson);
|
||||||
|
if (response == null) {
|
||||||
|
throw new RuntimeException("大华生成人员ID失败: response为null");
|
||||||
|
}
|
||||||
|
if (!"0".equals(response.getCode())) {
|
||||||
|
throw new RuntimeException("大华生成人员ID失败: code=" + response.getCode() + ", response=" + responseJson);
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = JSONUtil.parseObj(responseJson);
|
||||||
|
String bizResult = null;
|
||||||
|
if (jsonObject.containsKey("result")) {
|
||||||
|
bizResult = jsonObject.getStr("result");
|
||||||
|
}
|
||||||
|
if (bizResult == null || bizResult.isEmpty()) {
|
||||||
|
throw new RuntimeException("大华生成人员ID失败: 未找到result字段, response=" + responseJson);
|
||||||
|
}
|
||||||
|
System.out.println("大华生成人员ID业务结果(result): " + bizResult);
|
||||||
|
JSONObject bizJson = JSONUtil.parseObj(bizResult);
|
||||||
|
if (bizJson.containsKey("data")) {
|
||||||
|
Object dataObj = bizJson.get("data");
|
||||||
|
if (dataObj != null) {
|
||||||
|
JSONObject data = JSONUtil.parseObj(dataObj);
|
||||||
|
if (data.containsKey("id")) {
|
||||||
|
Long id = data.getLong("id");
|
||||||
|
System.out.println("大华生成人员ID: " + id);
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new RuntimeException("大华生成人员ID失败: 未找到data.id字段, bizResult=" + bizResult);
|
||||||
} catch (ClientException e) {
|
} catch (ClientException e) {
|
||||||
throw new RuntimeException("同步人员到大华平台失败", e);
|
log.error("大华生成人员ID异常: {}", e.getMessage(), e);
|
||||||
|
throw new RuntimeException("大华生成人员ID异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> convertToMap(DaHuaPersonSyncCmd cmd) {
|
@Override
|
||||||
|
public Map<String, Object> syncPerson(DaHuaPersonSyncCmd cmd) {
|
||||||
|
if (daHuaPersonApi == null || !daHuaPersonApi.isConfigured()) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
|
Map<String, Object> body = convertToMap(cmd);
|
||||||
|
log.info("大华同步人员请求参数: {}", JSONUtil.toJsonStr(body));
|
||||||
|
System.out.println("大华同步人员请求参数: " + JSONUtil.toJsonStr(body));
|
||||||
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
try {
|
||||||
|
GeneralResponse response = daHuaPersonApi.addPerson(body);
|
||||||
|
String responseJson = JSONUtil.toJsonStr(response);
|
||||||
|
log.info("大华同步人员返回结果: {}", responseJson);
|
||||||
|
System.out.println("大华同步人员返回结果: " + responseJson);
|
||||||
|
if (response == null) {
|
||||||
|
log.error("大华同步人员失败: response为null");
|
||||||
|
resultMap.put("passed", false);
|
||||||
|
resultMap.put("success", false);
|
||||||
|
resultMap.put("code", "SYSTEM_ERROR");
|
||||||
|
resultMap.put("errMsg", "response为null");
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = JSONUtil.parseObj(responseJson);
|
||||||
|
Boolean dhSuccess = jsonObject.getBool("success", false);
|
||||||
|
String dhCode = jsonObject.getStr("code", response.getCode());
|
||||||
|
String dhErrMsg = jsonObject.getStr("errMsg", "");
|
||||||
|
String dhResult = jsonObject.getStr("result", "");
|
||||||
|
boolean passed = "0".equals(dhCode);
|
||||||
|
resultMap.put("passed", passed);
|
||||||
|
resultMap.put("success", dhSuccess);
|
||||||
|
resultMap.put("code", dhCode);
|
||||||
|
resultMap.put("errMsg", dhErrMsg);
|
||||||
|
resultMap.put("result", dhResult);
|
||||||
|
if (!passed) {
|
||||||
|
log.error("大华同步人员失败: code={}, errMsg={}, response={}", dhCode, dhErrMsg, responseJson);
|
||||||
|
System.out.println("大华同步人员失败: code=" + dhCode + ", errMsg=" + dhErrMsg);
|
||||||
|
}
|
||||||
|
return resultMap;
|
||||||
|
} catch (ClientException e) {
|
||||||
|
log.error("大华同步人员异常: {}", e.getMessage(), e);
|
||||||
|
resultMap.put("passed", false);
|
||||||
|
resultMap.put("success", false);
|
||||||
|
resultMap.put("code", "CLIENT_EXCEPTION");
|
||||||
|
resultMap.put("errMsg", e.getMessage());
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> updatePerson(DaHuaPersonSyncCmd cmd) {
|
||||||
|
if (daHuaPersonApi == null || !daHuaPersonApi.isConfigured()) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
|
if (cmd.getId() == null) {
|
||||||
|
Map<String, Object> emptyMap = new HashMap<>();
|
||||||
|
emptyMap.put("passed", false);
|
||||||
|
emptyMap.put("success", false);
|
||||||
|
emptyMap.put("code", "PARAM_ERROR");
|
||||||
|
emptyMap.put("errMsg", "id不能为空");
|
||||||
|
return emptyMap;
|
||||||
|
}
|
||||||
|
Map<String, Object> body = convertToMap(cmd);
|
||||||
|
log.info("大华修改人员请求参数: {}", JSONUtil.toJsonStr(body));
|
||||||
|
System.out.println("大华修改人员请求参数: " + JSONUtil.toJsonStr(body));
|
||||||
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
try {
|
||||||
|
GeneralResponse response = daHuaPersonApi.updatePerson(body);
|
||||||
|
String responseJson = JSONUtil.toJsonStr(response);
|
||||||
|
log.info("大华修改人员返回结果: {}", responseJson);
|
||||||
|
System.out.println("大华修改人员返回结果: " + responseJson);
|
||||||
|
if (response == null) {
|
||||||
|
log.error("大华修改人员失败: response为null");
|
||||||
|
resultMap.put("passed", false);
|
||||||
|
resultMap.put("success", false);
|
||||||
|
resultMap.put("code", "SYSTEM_ERROR");
|
||||||
|
resultMap.put("errMsg", "response为null");
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = JSONUtil.parseObj(responseJson);
|
||||||
|
Boolean dhSuccess = jsonObject.getBool("success", false);
|
||||||
|
String dhCode = jsonObject.getStr("code", response.getCode());
|
||||||
|
String dhErrMsg = jsonObject.getStr("errMsg", "");
|
||||||
|
String dhResult = jsonObject.getStr("result", "");
|
||||||
|
boolean passed = "0".equals(dhCode);
|
||||||
|
resultMap.put("passed", passed);
|
||||||
|
resultMap.put("success", dhSuccess);
|
||||||
|
resultMap.put("code", dhCode);
|
||||||
|
resultMap.put("errMsg", dhErrMsg);
|
||||||
|
resultMap.put("result", dhResult);
|
||||||
|
if (!passed) {
|
||||||
|
log.error("大华修改人员失败: code={}, errMsg={}, response={}", dhCode, dhErrMsg, responseJson);
|
||||||
|
System.out.println("大华修改人员失败: code=" + dhCode + ", errMsg=" + dhErrMsg);
|
||||||
|
}
|
||||||
|
return resultMap;
|
||||||
|
} catch (ClientException e) {
|
||||||
|
log.error("大华修改人员异常: {}", e.getMessage(), e);
|
||||||
|
resultMap.put("passed", false);
|
||||||
|
resultMap.put("success", false);
|
||||||
|
resultMap.put("code", "CLIENT_EXCEPTION");
|
||||||
|
resultMap.put("errMsg", e.getMessage());
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, Object> convertToMap(Object cmd) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
Field[] fields = cmd.getClass().getDeclaredFields();
|
Field[] fields = cmd.getClass().getDeclaredFields();
|
||||||
|
|
@ -48,4 +191,377 @@ public class DaHuaGatewayImpl implements DaHuaGateway {
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> deletePerson(List<Long> ids, Integer openDeleteFlag) {
|
||||||
|
if (daHuaPersonApi == null || !daHuaPersonApi.isConfigured()) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
|
if (ids == null || ids.isEmpty()) {
|
||||||
|
Map<String, Object> emptyMap = new HashMap<>();
|
||||||
|
emptyMap.put("passed", false);
|
||||||
|
emptyMap.put("success", false);
|
||||||
|
emptyMap.put("code", "PARAM_ERROR");
|
||||||
|
emptyMap.put("errMsg", "ids不能为空");
|
||||||
|
return emptyMap;
|
||||||
|
}
|
||||||
|
Map<String, Object> body = new HashMap<>();
|
||||||
|
body.put("ids", ids);
|
||||||
|
if (openDeleteFlag != null) {
|
||||||
|
body.put("openDeleteFlag", openDeleteFlag);
|
||||||
|
}
|
||||||
|
log.info("大华删除人员请求参数: {}", JSONUtil.toJsonStr(body));
|
||||||
|
System.out.println("大华删除人员请求参数: " + JSONUtil.toJsonStr(body));
|
||||||
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
try {
|
||||||
|
GeneralResponse response = daHuaPersonApi.deletePerson(body);
|
||||||
|
String responseJson = JSONUtil.toJsonStr(response);
|
||||||
|
log.info("大华删除人员返回结果: {}", responseJson);
|
||||||
|
System.out.println("大华删除人员返回结果: " + responseJson);
|
||||||
|
if (response == null) {
|
||||||
|
log.error("大华删除人员失败: response为null");
|
||||||
|
resultMap.put("passed", false);
|
||||||
|
resultMap.put("success", false);
|
||||||
|
resultMap.put("code", "SYSTEM_ERROR");
|
||||||
|
resultMap.put("errMsg", "response为null");
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = JSONUtil.parseObj(responseJson);
|
||||||
|
Boolean dhSuccess = jsonObject.getBool("success", false);
|
||||||
|
String dhCode = jsonObject.getStr("code", response.getCode());
|
||||||
|
String dhErrMsg = jsonObject.getStr("errMsg", "");
|
||||||
|
String dhResult = jsonObject.getStr("result", "");
|
||||||
|
boolean passed = "0".equals(dhCode);
|
||||||
|
resultMap.put("passed", passed);
|
||||||
|
resultMap.put("success", dhSuccess);
|
||||||
|
resultMap.put("code", dhCode);
|
||||||
|
resultMap.put("errMsg", dhErrMsg);
|
||||||
|
resultMap.put("result", dhResult);
|
||||||
|
if (!passed) {
|
||||||
|
log.error("大华删除人员失败: code={}, errMsg={}, response={}", dhCode, dhErrMsg, responseJson);
|
||||||
|
System.out.println("大华删除人员失败: code=" + dhCode + ", errMsg=" + dhErrMsg);
|
||||||
|
}
|
||||||
|
return resultMap;
|
||||||
|
} catch (ClientException e) {
|
||||||
|
log.error("大华删除人员异常: {}", e.getMessage(), e);
|
||||||
|
resultMap.put("passed", false);
|
||||||
|
resultMap.put("success", false);
|
||||||
|
resultMap.put("code", "CLIENT_EXCEPTION");
|
||||||
|
resultMap.put("errMsg", e.getMessage());
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> addCar(DaHuaCarAddCmd cmd) {
|
||||||
|
if (daHuaPersonApi == null || !daHuaPersonApi.isConfigured()) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
|
if (cmd.getCarNum() == null || cmd.getCarNum().trim().isEmpty()) {
|
||||||
|
Map<String, Object> emptyMap = new HashMap<>();
|
||||||
|
emptyMap.put("passed", false);
|
||||||
|
emptyMap.put("success", false);
|
||||||
|
emptyMap.put("code", "PARAM_ERROR");
|
||||||
|
emptyMap.put("errMsg", "carNum车牌号码不能为空");
|
||||||
|
return emptyMap;
|
||||||
|
}
|
||||||
|
if (cmd.getDepartmentId() == null) {
|
||||||
|
Map<String, Object> emptyMap = new HashMap<>();
|
||||||
|
emptyMap.put("passed", false);
|
||||||
|
emptyMap.put("success", false);
|
||||||
|
emptyMap.put("code", "PARAM_ERROR");
|
||||||
|
emptyMap.put("errMsg", "departmentId部门ID不能为空");
|
||||||
|
return emptyMap;
|
||||||
|
}
|
||||||
|
Map<String, Object> body = convertToMap(cmd);
|
||||||
|
log.info("大华新增车辆请求参数: {}", JSONUtil.toJsonStr(body));
|
||||||
|
System.out.println("大华新增车辆请求参数: " + JSONUtil.toJsonStr(body));
|
||||||
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
try {
|
||||||
|
GeneralResponse response = daHuaPersonApi.addCar(body);
|
||||||
|
String responseJson = JSONUtil.toJsonStr(response);
|
||||||
|
log.info("大华新增车辆返回结果: {}", responseJson);
|
||||||
|
System.out.println("大华新增车辆返回结果: " + responseJson);
|
||||||
|
if (response == null) {
|
||||||
|
log.error("大华新增车辆失败: response为null");
|
||||||
|
resultMap.put("passed", false);
|
||||||
|
resultMap.put("success", false);
|
||||||
|
resultMap.put("code", "SYSTEM_ERROR");
|
||||||
|
resultMap.put("errMsg", "response为null");
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = JSONUtil.parseObj(responseJson);
|
||||||
|
Boolean dhSuccess = jsonObject.getBool("success", false);
|
||||||
|
String dhCode = jsonObject.getStr("code", response.getCode());
|
||||||
|
String dhErrMsg = jsonObject.getStr("errMsg", "");
|
||||||
|
String dhResult = jsonObject.getStr("result", "");
|
||||||
|
boolean passed = "0".equals(dhCode);
|
||||||
|
resultMap.put("passed", passed);
|
||||||
|
resultMap.put("success", dhSuccess);
|
||||||
|
resultMap.put("code", dhCode);
|
||||||
|
resultMap.put("errMsg", dhErrMsg);
|
||||||
|
resultMap.put("result", dhResult);
|
||||||
|
if (!passed) {
|
||||||
|
log.error("大华新增车辆失败: code={}, errMsg={}, response={}", dhCode, dhErrMsg, responseJson);
|
||||||
|
System.out.println("大华新增车辆失败: code=" + dhCode + ", errMsg=" + dhErrMsg);
|
||||||
|
}
|
||||||
|
return resultMap;
|
||||||
|
} catch (ClientException e) {
|
||||||
|
log.error("大华新增车辆异常: {}", e.getMessage(), e);
|
||||||
|
resultMap.put("passed", false);
|
||||||
|
resultMap.put("success", false);
|
||||||
|
resultMap.put("code", "CLIENT_EXCEPTION");
|
||||||
|
resultMap.put("errMsg", e.getMessage());
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> updateCar(DaHuaCarAddCmd cmd) {
|
||||||
|
if (daHuaPersonApi == null || !daHuaPersonApi.isConfigured()) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
|
if (cmd.getCarCode() == null || cmd.getCarCode().trim().isEmpty()) {
|
||||||
|
Map<String, Object> emptyMap = new HashMap<>();
|
||||||
|
emptyMap.put("passed", false);
|
||||||
|
emptyMap.put("success", false);
|
||||||
|
emptyMap.put("code", "PARAM_ERROR");
|
||||||
|
emptyMap.put("errMsg", "carCode车辆编号不能为空");
|
||||||
|
return emptyMap;
|
||||||
|
}
|
||||||
|
if (cmd.getCarNum() == null || cmd.getCarNum().trim().isEmpty()) {
|
||||||
|
Map<String, Object> emptyMap = new HashMap<>();
|
||||||
|
emptyMap.put("passed", false);
|
||||||
|
emptyMap.put("success", false);
|
||||||
|
emptyMap.put("code", "PARAM_ERROR");
|
||||||
|
emptyMap.put("errMsg", "carNum车牌号码不能为空");
|
||||||
|
return emptyMap;
|
||||||
|
}
|
||||||
|
if (cmd.getDepartmentId() == null) {
|
||||||
|
Map<String, Object> emptyMap = new HashMap<>();
|
||||||
|
emptyMap.put("passed", false);
|
||||||
|
emptyMap.put("success", false);
|
||||||
|
emptyMap.put("code", "PARAM_ERROR");
|
||||||
|
emptyMap.put("errMsg", "departmentId部门ID不能为空");
|
||||||
|
return emptyMap;
|
||||||
|
}
|
||||||
|
Map<String, Object> body = convertToMap(cmd);
|
||||||
|
log.info("大华修改车辆请求参数: {}", JSONUtil.toJsonStr(body));
|
||||||
|
System.out.println("大华修改车辆请求参数: " + JSONUtil.toJsonStr(body));
|
||||||
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
try {
|
||||||
|
GeneralResponse response = daHuaPersonApi.updateCar(body);
|
||||||
|
String responseJson = JSONUtil.toJsonStr(response);
|
||||||
|
log.info("大华修改车辆返回结果: {}", responseJson);
|
||||||
|
System.out.println("大华修改车辆返回结果: " + responseJson);
|
||||||
|
if (response == null) {
|
||||||
|
log.error("大华修改车辆失败: response为null");
|
||||||
|
resultMap.put("passed", false);
|
||||||
|
resultMap.put("success", false);
|
||||||
|
resultMap.put("code", "SYSTEM_ERROR");
|
||||||
|
resultMap.put("errMsg", "response为null");
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = JSONUtil.parseObj(responseJson);
|
||||||
|
Boolean dhSuccess = jsonObject.getBool("success", false);
|
||||||
|
String dhCode = jsonObject.getStr("code", response.getCode());
|
||||||
|
String dhErrMsg = jsonObject.getStr("errMsg", "");
|
||||||
|
String dhResult = jsonObject.getStr("result", "");
|
||||||
|
boolean passed = "0".equals(dhCode);
|
||||||
|
resultMap.put("passed", passed);
|
||||||
|
resultMap.put("success", dhSuccess);
|
||||||
|
resultMap.put("code", dhCode);
|
||||||
|
resultMap.put("errMsg", dhErrMsg);
|
||||||
|
resultMap.put("result", dhResult);
|
||||||
|
if (!passed) {
|
||||||
|
log.error("大华修改车辆失败: code={}, errMsg={}, response={}", dhCode, dhErrMsg, responseJson);
|
||||||
|
System.out.println("大华修改车辆失败: code=" + dhCode + ", errMsg=" + dhErrMsg);
|
||||||
|
}
|
||||||
|
return resultMap;
|
||||||
|
} catch (ClientException e) {
|
||||||
|
log.error("大华修改车辆异常: {}", e.getMessage(), e);
|
||||||
|
resultMap.put("passed", false);
|
||||||
|
resultMap.put("success", false);
|
||||||
|
resultMap.put("code", "CLIENT_EXCEPTION");
|
||||||
|
resultMap.put("errMsg", e.getMessage());
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> pageCar(DaHuaCarPageCmd cmd) {
|
||||||
|
if (daHuaPersonApi == null || !daHuaPersonApi.isConfigured()) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
|
Map<String, Object> body = convertToMap(cmd);
|
||||||
|
log.info("大华车辆分页查询请求参数: {}", JSONUtil.toJsonStr(body));
|
||||||
|
System.out.println("大华车辆分页查询请求参数: " + JSONUtil.toJsonStr(body));
|
||||||
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
try {
|
||||||
|
GeneralResponse response = daHuaPersonApi.pageCar(body);
|
||||||
|
String responseJson = JSONUtil.toJsonStr(response);
|
||||||
|
log.info("大华车辆分页查询返回结果: {}", responseJson);
|
||||||
|
System.out.println("大华车辆分页查询返回结果: " + responseJson);
|
||||||
|
if (response == null) {
|
||||||
|
log.error("大华车辆分页查询失败: response为null");
|
||||||
|
resultMap.put("passed", false);
|
||||||
|
resultMap.put("success", false);
|
||||||
|
resultMap.put("code", "SYSTEM_ERROR");
|
||||||
|
resultMap.put("errMsg", "response为null");
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = JSONUtil.parseObj(responseJson);
|
||||||
|
String bizResult = jsonObject.getStr("result", "");
|
||||||
|
Boolean dhSuccess = jsonObject.getBool("success", false);
|
||||||
|
String dhCode = jsonObject.getStr("code", response.getCode());
|
||||||
|
String dhErrMsg = jsonObject.getStr("errMsg", "");
|
||||||
|
Object dhData = jsonObject.get("data");
|
||||||
|
if (bizResult != null && !bizResult.trim().isEmpty()) {
|
||||||
|
try {
|
||||||
|
JSONObject bizObj = JSONUtil.parseObj(bizResult);
|
||||||
|
dhSuccess = bizObj.getBool("success", dhSuccess);
|
||||||
|
dhCode = bizObj.getStr("code", dhCode);
|
||||||
|
dhErrMsg = bizObj.getStr("errMsg", dhErrMsg);
|
||||||
|
Object tmpData = bizObj.get("data");
|
||||||
|
if (tmpData != null) {
|
||||||
|
dhData = tmpData;
|
||||||
|
}
|
||||||
|
System.out.println("大华车辆分页查询解析result字段成功, data=" + (dhData != null ? "已获取" : "null"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("大华车辆分页查询解析result字段失败,使用外层字段: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boolean passed = "0".equals(dhCode);
|
||||||
|
resultMap.put("passed", passed);
|
||||||
|
resultMap.put("success", dhSuccess);
|
||||||
|
resultMap.put("code", dhCode);
|
||||||
|
resultMap.put("errMsg", dhErrMsg);
|
||||||
|
resultMap.put("data", dhData);
|
||||||
|
if (!passed) {
|
||||||
|
log.error("大华车辆分页查询失败: code={}, errMsg={}, response={}", dhCode, dhErrMsg, responseJson);
|
||||||
|
System.out.println("大华车辆分页查询失败: code=" + dhCode + ", errMsg=" + dhErrMsg);
|
||||||
|
}
|
||||||
|
return resultMap;
|
||||||
|
} catch (ClientException e) {
|
||||||
|
log.error("大华车辆分页查询异常: {}", e.getMessage(), e);
|
||||||
|
resultMap.put("passed", false);
|
||||||
|
resultMap.put("success", false);
|
||||||
|
resultMap.put("code", "CLIENT_EXCEPTION");
|
||||||
|
resultMap.put("errMsg", e.getMessage());
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> deleteCar(List<String> carNumList) {
|
||||||
|
if (daHuaPersonApi == null || !daHuaPersonApi.isConfigured()) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
|
Map<String, Object> body = new HashMap<>();
|
||||||
|
body.put("carNumList", carNumList);
|
||||||
|
log.info("大华删除车辆请求参数: {}", JSONUtil.toJsonStr(body));
|
||||||
|
System.out.println("大华删除车辆请求参数: " + JSONUtil.toJsonStr(body));
|
||||||
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
try {
|
||||||
|
GeneralResponse response = daHuaPersonApi.deleteCar(body);
|
||||||
|
String responseJson = JSONUtil.toJsonStr(response);
|
||||||
|
log.info("大华删除车辆返回结果: {}", responseJson);
|
||||||
|
System.out.println("大华删除车辆返回结果: " + responseJson);
|
||||||
|
if (response == null) {
|
||||||
|
log.error("大华删除车辆失败: response为null");
|
||||||
|
resultMap.put("passed", false);
|
||||||
|
resultMap.put("success", false);
|
||||||
|
resultMap.put("code", "SYSTEM_ERROR");
|
||||||
|
resultMap.put("errMsg", "response为null");
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = JSONUtil.parseObj(responseJson);
|
||||||
|
Boolean dhSuccess = jsonObject.getBool("success", false);
|
||||||
|
String dhCode = jsonObject.getStr("code", response.getCode());
|
||||||
|
String dhErrMsg = jsonObject.getStr("errMsg", "");
|
||||||
|
String dhResult = jsonObject.getStr("result", "");
|
||||||
|
boolean passed = "0".equals(dhCode);
|
||||||
|
resultMap.put("passed", passed);
|
||||||
|
resultMap.put("success", dhSuccess);
|
||||||
|
resultMap.put("code", dhCode);
|
||||||
|
resultMap.put("errMsg", dhErrMsg);
|
||||||
|
resultMap.put("result", dhResult);
|
||||||
|
if (!passed) {
|
||||||
|
log.error("大华删除车辆失败: code={}, errMsg={}, response={}", dhCode, dhErrMsg, responseJson);
|
||||||
|
System.out.println("大华删除车辆失败: code=" + dhCode + ", errMsg=" + dhErrMsg);
|
||||||
|
}
|
||||||
|
return resultMap;
|
||||||
|
} catch (ClientException e) {
|
||||||
|
log.error("大华删除车辆异常: {}", e.getMessage(), e);
|
||||||
|
resultMap.put("passed", false);
|
||||||
|
resultMap.put("success", false);
|
||||||
|
resultMap.put("code", "CLIENT_EXCEPTION");
|
||||||
|
resultMap.put("errMsg", e.getMessage());
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryAccessRecord(DaHuaAccessRecordCmd cmd) {
|
||||||
|
if (daHuaPersonApi == null || !daHuaPersonApi.isConfigured()) {
|
||||||
|
throw new RuntimeException("大华服务未配置");
|
||||||
|
}
|
||||||
|
Map<String, Object> body = convertToMap(cmd);
|
||||||
|
log.info("大华门禁事件查询请求参数: {}", JSONUtil.toJsonStr(body));
|
||||||
|
System.out.println("大华门禁事件查询请求参数: " + JSONUtil.toJsonStr(body));
|
||||||
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
try {
|
||||||
|
GeneralResponse response = daHuaPersonApi.queryAccessRecord(body);
|
||||||
|
String responseJson = JSONUtil.toJsonStr(response);
|
||||||
|
log.info("大华门禁事件查询返回结果: {}", responseJson);
|
||||||
|
System.out.println("大华门禁事件查询返回结果: " + responseJson);
|
||||||
|
if (response == null) {
|
||||||
|
log.error("大华门禁事件查询失败: response为null");
|
||||||
|
resultMap.put("passed", false);
|
||||||
|
resultMap.put("success", false);
|
||||||
|
resultMap.put("code", "SYSTEM_ERROR");
|
||||||
|
resultMap.put("errMsg", "response为null");
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = JSONUtil.parseObj(responseJson);
|
||||||
|
String bizResult = jsonObject.getStr("result", "");
|
||||||
|
Boolean dhSuccess = jsonObject.getBool("success", false);
|
||||||
|
String dhCode = jsonObject.getStr("code", response.getCode());
|
||||||
|
String dhErrMsg = jsonObject.getStr("errMsg", "");
|
||||||
|
Object dhData = jsonObject.get("data");
|
||||||
|
if (bizResult != null && !bizResult.trim().isEmpty()) {
|
||||||
|
try {
|
||||||
|
JSONObject bizObj = JSONUtil.parseObj(bizResult);
|
||||||
|
dhSuccess = bizObj.getBool("success", dhSuccess);
|
||||||
|
dhCode = bizObj.getStr("code", dhCode);
|
||||||
|
dhErrMsg = bizObj.getStr("errMsg", dhErrMsg);
|
||||||
|
Object tmpData = bizObj.get("data");
|
||||||
|
if (tmpData != null) {
|
||||||
|
dhData = tmpData;
|
||||||
|
}
|
||||||
|
System.out.println("大华门禁事件查询解析result字段成功, data=" + (dhData != null ? "已获取" : "null"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("大华门禁事件查询解析result字段失败,使用外层字段: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boolean passed = "0".equals(dhCode);
|
||||||
|
resultMap.put("passed", passed);
|
||||||
|
resultMap.put("success", dhSuccess);
|
||||||
|
resultMap.put("code", dhCode);
|
||||||
|
resultMap.put("errMsg", dhErrMsg);
|
||||||
|
resultMap.put("data", dhData);
|
||||||
|
if (!passed) {
|
||||||
|
log.error("大华门禁事件查询失败: code={}, errMsg={}, response={}", dhCode, dhErrMsg, responseJson);
|
||||||
|
System.out.println("大华门禁事件查询失败: code=" + dhCode + ", errMsg=" + dhErrMsg);
|
||||||
|
}
|
||||||
|
return resultMap;
|
||||||
|
} catch (ClientException e) {
|
||||||
|
log.error("大华门禁事件查询异常: {}", e.getMessage(), e);
|
||||||
|
resultMap.put("passed", false);
|
||||||
|
resultMap.put("success", false);
|
||||||
|
resultMap.put("code", "CLIENT_EXCEPTION");
|
||||||
|
resultMap.put("errMsg", e.getMessage());
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,39 +1,24 @@
|
||||||
package com.zcloud.primeport.plan.mjDevice;
|
package com.zcloud.primeport.plan.mjDevice;
|
||||||
|
|
||||||
import com.dahuatech.icc.oauth.model.v202010.OauthConfigUserPwdInfo;
|
import com.dahuatech.icc.oauth.model.v202010.OauthConfigUserPwdInfo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description:
|
|
||||||
* @Date: 2026/7/2
|
|
||||||
* @User: tianxinlei
|
|
||||||
*/
|
|
||||||
@Component
|
@Component
|
||||||
@ConditionalOnBean(name = "dahuaApiOauthConfig")
|
|
||||||
public class DaHuaSdkUtil {
|
public class DaHuaSdkUtil {
|
||||||
|
|
||||||
private final OauthConfigUserPwdInfo oauthConfig;
|
@Autowired(required = false)
|
||||||
|
@Qualifier("dahuaApiOauthConfig")
|
||||||
|
private OauthConfigUserPwdInfo oauthConfig;
|
||||||
|
|
||||||
public DaHuaSdkUtil(@Qualifier("dahuaApiOauthConfig") OauthConfigUserPwdInfo oauthConfig) {
|
|
||||||
this.oauthConfig = oauthConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化登录
|
|
||||||
*/
|
|
||||||
public String login() {
|
public String login() {
|
||||||
// 内部使用 oauthConfig 执行登录逻辑,返回token
|
if (oauthConfig == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 释放SDK资源
|
|
||||||
*/
|
|
||||||
public void logout() {
|
public void logout() {
|
||||||
// SDK注销、销毁连接
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 其他设备查询、回放、抓拍等业务方法
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
dahua:
|
dahua:
|
||||||
|
oauth:
|
||||||
host: 123.183.159.35
|
host: 123.183.159.35
|
||||||
client-id: 123.183.159.35
|
client-id: 123.183.159.35
|
||||||
client-secret: 4edfdcd2-67e6-41db-a1ae-b98d47a70266
|
client-secret: 4edfdcd2-67e6-41db-a1ae-b98d47a70266
|
||||||
username: system
|
username: system
|
||||||
password: zcloud88888
|
password: zcloud88888
|
||||||
http: false
|
http: false
|
||||||
port: 4443
|
port: 4443
|
||||||
|
|
||||||
Loading…
Reference in New Issue