bug修改

This commit is contained in:
guo 2024-04-16 17:03:18 +08:00
parent f0bf1590cb
commit 680651b0fc
7 changed files with 132 additions and 50 deletions

View File

@ -9,6 +9,7 @@ import com.zhgd.xmgl.call.HikvisionCall;
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
import com.zhgd.xmgl.modules.car.entity.CarInfo;
import com.zhgd.xmgl.modules.project.entity.Project;
import com.zhgd.xmgl.modules.project.entity.ProjectUfaceConfig;
import com.zhgd.xmgl.modules.project.entity.ProjectVideoConfig;
import com.zhgd.xmgl.modules.video.entity.ProjectVideoHkVqd;
import com.zhgd.xmgl.modules.video.entity.VideoItem;
@ -20,6 +21,7 @@ import com.zhgd.xmgl.modules.worker.entity.TeamInfo;
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
import com.zhgd.xmgl.security.util.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
@ -260,4 +262,19 @@ public class AsyncHikvision {
}
}
}
@Async
public void addPersonAuth(WorkerInfo workerInfo, ProjectUfaceConfig tempProjectUfaceConfig, String devSn) {
try {
if (StringUtils.isBlank(devSn)) {
return;
}
String[] devSnArr = StringUtils.split(devSn, ",");
for (String ds : devSnArr) {
hikvisionCall.addPersonAuth(workerInfo, tempProjectUfaceConfig, ds);
}
} catch (Exception e) {
log.error("海康:", e);
}
}
}

View File

@ -13,7 +13,6 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.redis.lock.RedisRepository;
import com.zhgd.xmgl.base.*;
import com.zhgd.xmgl.modules.basicdata.entity.HikvisionRequestRetry;
import com.zhgd.xmgl.modules.basicdata.service.impl.NoticeServiceImpl;
import com.zhgd.xmgl.modules.car.entity.CarCamera;
import com.zhgd.xmgl.modules.car.entity.CarInfo;
@ -23,6 +22,7 @@ import com.zhgd.xmgl.modules.car.mapper.CarInfoMapper;
import com.zhgd.xmgl.modules.car.mapper.CarPassRecordMapper;
import com.zhgd.xmgl.modules.car.mapper.CarTypeMapper;
import com.zhgd.xmgl.modules.project.entity.Project;
import com.zhgd.xmgl.modules.project.entity.ProjectUfaceConfig;
import com.zhgd.xmgl.modules.project.entity.ProjectVideoConfig;
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
import com.zhgd.xmgl.modules.worker.entity.*;
@ -44,7 +44,6 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -1697,10 +1696,6 @@ public class HikvisionCall {
return null;
}
public static void main(String[] args) {
System.out.println(DateUtil.format(new Date(), "yyyy-MM-dd'T'HH:mm:ss+'Z'"));
}
/**
* 查询车辆列表v2
*
@ -1883,4 +1878,83 @@ public class HikvisionCall {
jo.put("parkSyscode", param.getString("parkSyscode"));
return HikvisionUtil.doPost(host, path, jo.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
}
/**
* 查询门禁点列表v2
*
* @param project
* @param param
*/
public String doorSearchV2ForHttp(Project project, JSONObject param) {
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
return null;
}
final String ARTEMIS_PATH = "/artemis";
final String path = ARTEMIS_PATH + "/api/resource/v2/door/search";
String host = "https://" + project.getArtemisConfigHost();
return HikvisionUtil.doPost(host, path, param.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
}
/**
* 简单同步权限下载_根据人员与设备通道指定下载
*
* @param project
*/
public String simpleDownload(Project project, String param) {
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
return null;
}
final String ARTEMIS_PATH = "/artemis";
final String path = ARTEMIS_PATH + "/api/acps/v1/authDownload/task/simpleDownload";
String host = "https://" + project.getArtemisConfigHost();
return HikvisionUtil.doPost(host, path, param, null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
}
public void addPersonAuth(WorkerInfo workerInfo, ProjectUfaceConfig tempProjectUfaceConfig, String devSn) {
Project project = projectMapper.selectOne(new LambdaQueryWrapper<Project>().eq(Project::getProjectSn, workerInfo.getProjectSn()));
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
return;
}
String json = "{\n" +
" \"pageNo\": 1,\n" +
" \"pageSize\": 1,\n" +
"\t \"expressions\": [\n" +
" {\n" +
" \"key\": \"resourceIndexCode\",\n" +
" \"operator\": 0,\n" +
" \"values\": [\n" +
" \"" + devSn + "\"\n" +
" ]\n" +
" }\n" +
" ],\n" +
"}";
String rs = doorSearchV2ForHttp(project, JSONObject.parseObject(json));
if (rs == null) {
throw new OpenAlertException("添加人员权限网络超时name:" + workerInfo.getWorkerName() + ",devSn:" + devSn);
}
JSONObject jo = HikvisionUtil.getJSONObjectData(rs);
JSONArray listJa = jo.getJSONArray("list");
if (CollUtil.isEmpty(listJa)) {
return;
}
String channelNo = listJa.getJSONObject(0).getString("channelNo");
String sdStr = "{\n" +
"\t\"taskType\": 5,\n" +
"\t\"resourceInfo\": {\n" +
"\t\t\"channelNos\": [" + channelNo + "],\n" +
"\t\t\"resourceIndexCode\": \"" + devSn + "\",\n" +
"\t\t\"resourceType\": \"door\"\n" +
"\t},\n" +
"\t\"personInfo\": {\n" +
"\t\t\"personId\": \"" + workerInfo.getId() + "\",\n" +
"\t\t\"operatorType\": 0\n" +
"\t}\n" +
"}";
String sdRs = simpleDownload(project, sdStr);
if (sdRs == null) {
throw new OpenAlertException("添加人员权限网络超时name:" + workerInfo.getWorkerName() + ",devSn:" + devSn);
}
}
}

View File

@ -31,7 +31,7 @@ public class ProjectUfaceConfig implements Serializable {
@Excel(name = "项目SN", width = 15)
@ApiModelProperty(value="项目SN")
private java.lang.String projectSn;
@ApiModelProperty(value = "1杭州宇泛智能科技,2用jdpush推送,3.mqtt,4.芊熠智能,5佳信捷,6佳信捷新设备,7海康门禁8弹弓")
@ApiModelProperty(value = "1杭州宇泛智能科技,2用jdpush推送,3.mqtt,4.芊熠智能,5佳信捷,6佳信捷新设备,7海康门禁8弹弓,9海康门禁isc")
private java.lang.Integer supplierType;
/**项目应用Id*/
@Excel(name = "项目应用Id", width = 15)

View File

@ -1,14 +1,19 @@
package com.zhgd.xmgl.modules.project.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.xmgl.async.AsyncHikvision;
import com.zhgd.xmgl.modules.project.entity.ProjectUfaceConfig;
import com.zhgd.xmgl.modules.project.mapper.ProjectUfaceConfigMapper;
import com.zhgd.xmgl.modules.project.service.IProjectUfaceConfigService;
import com.zhgd.xmgl.modules.worker.entity.UfaceDev;
import com.zhgd.xmgl.modules.worker.entity.UfaceDevToGroup;
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
import com.zhgd.xmgl.modules.worker.mapper.UfaceDevMapper;
import com.zhgd.xmgl.modules.worker.mapper.UfaceDevToGroupMapper;
import com.zhgd.xmgl.modules.worker.mapper.UserDevAuthorityMapper;
import com.zhgd.xmgl.util.*;
import lombok.extern.slf4j.Slf4j;
@ -18,9 +23,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Description: 项目对应的人脸设备配置
@ -37,7 +41,11 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
@Autowired
private UfaceDevMapper ufaceDevMapper;
@Autowired
private UfaceDevToGroupMapper ufaceDevToGroupMapper;
@Autowired
private UserDevAuthorityMapper userDevAuthorityMapper;
@Autowired
private AsyncHikvision asyncHikvision;
@Value("${basePath}")
private String basePath;
@ -119,19 +127,29 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
if (tempProjectUfaceConfig != null && tempProjectUfaceConfig.getIssueDev() == 1) {
Map<String, Object> param = new HashMap<>();
param.put("projectSn", workerInfo.getProjectSn());
//if(workerInfo.getRegisterType()!=null){
if ("0".equals(workerInfo.getUfaceDevId())) {
workerInfo.setUfaceDevId(null);
}
if (StringUtils.isNotEmpty(workerInfo.getUfaceDevId())) {
param.put("registerType", workerInfo.getRegisterType());
param.put("accountType", workerInfo.getAccountType());
}
if (Objects.equals(workerInfo.getDevType(), 1)) {
param.put("devIds", workerInfo.getUfaceDevId());
} else if (Objects.equals(workerInfo.getDevType(), 2)) {
String ufaceDevGroupId = workerInfo.getUfaceDevGroupId();
if (StringUtils.isEmpty(ufaceDevGroupId)) {
ufaceDevGroupId = "0";
}
List<Long> ufaceIds = ufaceDevToGroupMapper.selectList(new LambdaQueryWrapper<UfaceDevToGroup>()
.in(UfaceDevToGroup::getUfaceDevGroupId, Arrays.asList(StringUtils.split(ufaceDevGroupId, ",")))).stream().map(UfaceDevToGroup::getUfaceDevId).collect(Collectors.toList());
if (CollUtil.isEmpty(ufaceIds)) {
ufaceIds.add(0L);
}
ufaceIds.stream().distinct();
param.put("devIds", StringUtils.join(ufaceIds, ","));
}
List<UfaceDev> list = ufaceDevMapper.selectUserUfaceDevList(param);
/*QueryWrapper<UfaceDev> qw =new QueryWrapper<>();
qw.lambda().eq(UfaceDev::getProjectSn, workerInfo.getProjectSn());
List<UfaceDev> list=ufaceDevMapper.selectList(qw);*/
if (list != null && list.size() > 0) {
StringBuilder devBuilder = new StringBuilder();
StringBuilder devIdBuilder = new StringBuilder();
@ -145,27 +163,6 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
devBuilder.append(dev.getDevSn());
devIdBuilder.append(dev.getDeviceId());
}
/*if (tempProjectUfaceConfig.getSupplierType() == 1) {
String image="";
if(StringUtils.isNotEmpty(workerInfo.getFieldAcquisitionUrl())&&workerInfo.getFieldAcquisitionUrl().startsWith("http")){
image=workerInfo.getFieldAcquisitionUrl();
}else{
image=basePath+"/"+workerInfo.getFieldAcquisitionUrl();
}
UniUbiUtil.addPerson(tempProjectUfaceConfig.getAppId(), tempProjectUfaceConfig.getAppKey(), tempProjectUfaceConfig.getAppSecret(),
workerInfo.getWorkerName(),workerInfo.getAttendanceNumber(),workerInfo.getIdCard(),
image,devBuilder.toString());
}else if (tempProjectUfaceConfig.getSupplierType() == 4) {
QYUfaceUtil.addOrUpdatePerson(tempProjectUfaceConfig.getAppId(), tempProjectUfaceConfig.getAppSecret(),1, workerInfo.getIdCard(),workerInfo.getWorkerName(),
"","", workerInfo.getIdCard(), "", "",3, "", devIdBuilder.toString().split(","), basePath+"/"+workerInfo.getFieldAcquisitionUrl());
}else if(tempProjectUfaceConfig.getSupplierType()==5){
//佳信捷设备
JxjUfaceUtil.addWorkerInfo(workerInfo,tempProjectUfaceConfig,serverUrl+"/image/");
}else if(tempProjectUfaceConfig.getSupplierType()==6){
//佳信捷新设备
JxjNewUfaceDevUtil.addOrUpdatePerson(workerInfo,tempProjectUfaceConfig,basePath,devBuilder.toString(),jxjDevImageType);
}*/
sendDev(tempProjectUfaceConfig, workerInfo, devBuilder.toString(), devIdBuilder.toString());
}
}
@ -194,7 +191,7 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
JxjNewUfaceDevUtil.deleteWorkerInfo(workerInfo, tempProjectUfaceConfig);
} else if (tempProjectUfaceConfig.getSupplierType() == 7) {
//海康门禁sdk
HikvisionUfaceUtil.deletePerson(workerInfo, tempProjectUfaceConfig, workerInfo.getUfaceDevId());
HikvisionUfaceSDKUtil.deletePerson(workerInfo, tempProjectUfaceConfig, workerInfo.getUfaceDevId());
}
}
}
@ -270,9 +267,9 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
JxjNewUfaceDevUtil.addOrUpdatePerson(workerInfo, tempProjectUfaceConfig, basePath, devBuilder.toString(), jxjDevImageType);
} else if (tempProjectUfaceConfig.getSupplierType() == 7) {
//海康门禁sdk
HikvisionUfaceUtil.deletePerson(workerInfo, tempProjectUfaceConfig, oldWorkerInfo.getUfaceDevId());
HikvisionUfaceSDKUtil.deletePerson(workerInfo, tempProjectUfaceConfig, oldWorkerInfo.getUfaceDevId());
if (hasDev) {
HikvisionUfaceUtil.addOrUpdatePerson(workerInfo, tempProjectUfaceConfig, devBuilder.toString());
HikvisionUfaceSDKUtil.addOrUpdatePerson(workerInfo, tempProjectUfaceConfig, devBuilder.toString());
}
}
}
@ -344,7 +341,10 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
JxjNewUfaceDevUtil.addOrUpdatePerson(workerInfo, tempProjectUfaceConfig, basePath, devSn, jxjDevImageType);
} else if (tempProjectUfaceConfig.getSupplierType() == 7) {
//海康门禁sdk
HikvisionUfaceUtil.addOrUpdatePerson(workerInfo, tempProjectUfaceConfig, devSn);
HikvisionUfaceSDKUtil.addOrUpdatePerson(workerInfo, tempProjectUfaceConfig, devSn);
} else if (tempProjectUfaceConfig.getSupplierType() == 9) {
//海康门禁isc
asyncHikvision.addPersonAuth(workerInfo, tempProjectUfaceConfig, devSn);
}
}

View File

@ -62,6 +62,7 @@ public class UfaceDevGroupController {
@ApiOperation(value = "列表查询门禁设备-分组信息", notes = "列表查询门禁设备-分组信息", httpMethod = "GET")
@GetMapping(value = "/list")
public Result<List<UfaceDevGroup>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> paramMap) {
int i = 1 / 0;
return Result.success(ufaceDevGroupService.queryList(paramMap));
}

View File

@ -77,16 +77,6 @@
else 2 end) device_state
from uface_dev
where project_sn = #{projectSn}
<!--<if test="registerType == '2'.toString()">
<if test="accountType == '1'.toString()">
<if test="devIds!=null and devIds!=''">
and FIND_IN_SET(id,#{devIds})
</if>
</if>
<if test="accountType == '2'.toString()">
and FIND_IN_SET(id,#{devIds})
</if>
</if>-->
<if test="accountType == '1'.toString()">
<if test="devIds != null and devIds != ''">
and FIND_IN_SET(id, #{devIds})

View File

@ -16,7 +16,7 @@ import java.util.Map;
* 海康门禁sdk
*/
@Slf4j
public class HikvisionUfaceUtil {
public class HikvisionUfaceSDKUtil {
private static String mqttTopic = "hikvision/uface/worker/";
/**