下发修改

This commit is contained in:
guoshengxiong 2024-06-15 14:25:52 +08:00
parent 70cefcc887
commit 4f8a3236f2
8 changed files with 50 additions and 33 deletions

View File

@ -493,29 +493,31 @@ public class AsyncHikvision {
@Async("sendBatchExecutor")
public void sendBatchWorkerInfoAsync(List<UfaceDev> allDevList, List<WorkerInfo> workerList, List<JSONObject> workerAndDevSnList, Long userId, String projectSn) {
try {
Map<String, WorkerInfo> workerIdMap = workerList.stream().collect(Collectors.toMap(workerInfo -> workerInfo.getId() + "", Function.identity()));
Map<String, UfaceDev> devSnMap = allDevList.stream().collect(Collectors.toMap(UfaceDev::getDevSn, Function.identity()));
ProjectInfoExtVo project = projectService.getProjectInfoBySn(projectSn);
Map<String, List<JSONObject>> devSnToJoMap = workerAndDevSnList.stream().collect(Collectors.groupingBy(jsonObject -> jsonObject.getString("devSn")));
JSONObject gdvJo = HikvisionUtil.getDoorsV2(project, HikvisionUtil.addPageParamIfAbsent(new JSONObject()));
JSONObject gdvDataJo = HikvisionUtil.getJSONObjectData(gdvJo);
//门禁设备编号parentIndexCode门禁点编号indexCode门禁设备资源通道号channelNo
Map<String, JSONObject> devSnToIscDevSnMap = gdvDataJo.getJSONArray("list").stream().collect(Collectors.toMap(o -> ((JSONObject) o).getString("indexCode"), o -> (JSONObject) o));
Map<String, Map<String, JSONObject>> iscDevSnToMyMap = gdvDataJo.getJSONArray("list").stream().collect(Collectors.toMap(o -> ((JSONObject) o).getString("parentIndexCode"), o -> {
HashMap<String, JSONObject> m1 = new HashMap<>();
m1.put(((JSONObject) o).getString("channelNo"), (JSONObject) o);
return m1;
}, (o1, o2) -> {
o1.putAll(o2);
return o1;
}));
ArrayList<Future> futures = new ArrayList<>();
for (Map.Entry<String, List<JSONObject>> entry : devSnToJoMap.entrySet()) {
Future future = asyncHikvision.sendBatchWorkersForOneDevAsync(workerIdMap, devSnMap, project, devSnToIscDevSnMap, iscDevSnToMyMap, entry, projectSn);
futures.add(future);
}
for (Future future : futures) {
while (!future.isDone()) {
if (CollUtil.isNotEmpty(workerAndDevSnList)) {
Map<String, WorkerInfo> workerIdMap = workerList.stream().collect(Collectors.toMap(workerInfo -> workerInfo.getId() + "", Function.identity()));
Map<String, UfaceDev> devSnMap = allDevList.stream().collect(Collectors.toMap(UfaceDev::getDevSn, Function.identity()));
ProjectInfoExtVo project = projectService.getProjectInfoBySn(projectSn);
Map<String, List<JSONObject>> devSnToJoMap = workerAndDevSnList.stream().collect(Collectors.groupingBy(jsonObject -> jsonObject.getString("devSn")));
JSONObject gdvJo = HikvisionUtil.getDoorsV2(project, HikvisionUtil.addPageParamIfAbsent(new JSONObject()));
JSONObject gdvDataJo = HikvisionUtil.getJSONObjectData(gdvJo);
//门禁设备编号parentIndexCode门禁点编号indexCode门禁设备资源通道号channelNo
Map<String, JSONObject> devSnToIscDevSnMap = gdvDataJo.getJSONArray("list").stream().collect(Collectors.toMap(o -> ((JSONObject) o).getString("indexCode"), o -> (JSONObject) o));
Map<String, Map<String, JSONObject>> iscDevSnToMyMap = gdvDataJo.getJSONArray("list").stream().collect(Collectors.toMap(o -> ((JSONObject) o).getString("parentIndexCode"), o -> {
HashMap<String, JSONObject> m1 = new HashMap<>();
m1.put(((JSONObject) o).getString("channelNo"), (JSONObject) o);
return m1;
}, (o1, o2) -> {
o1.putAll(o2);
return o1;
}));
ArrayList<Future> futures = new ArrayList<>();
for (Map.Entry<String, List<JSONObject>> entry : devSnToJoMap.entrySet()) {
Future future = asyncHikvision.sendBatchWorkersForOneDevAsync(workerIdMap, devSnMap, project, devSnToIscDevSnMap, iscDevSnToMyMap, entry, projectSn);
futures.add(future);
}
for (Future future : futures) {
while (!future.isDone()) {
}
}
}
//下发完成

View File

@ -1224,9 +1224,9 @@ public class HikvisionCall {
.eq(XzHikvisionSync::getWhoId, whoId)
.eq(XzHikvisionSync::getBigType, bigType)
);
Integer sendSuccessStatus = null;
Integer sendSuccessStatus = 4;
if (CollUtil.isEmpty(xzHikvisionSyncs) || xzHikvisionSyncs.stream().allMatch(xzHikvisionSync1 -> xzHikvisionSync1.getIsSuccess() == null)) {
sendSuccessStatus = null;
sendSuccessStatus = 4;
} else if (xzHikvisionSyncs.stream().allMatch(xzHikvisionSync1 -> Objects.equals(xzHikvisionSync1.getIsSuccess(), 1))) {
sendSuccessStatus = 1;
} else if (xzHikvisionSyncs.stream().allMatch(xzHikvisionSync1 -> xzHikvisionSync1.getIsSuccess() == null || Objects.equals(xzHikvisionSync1.getIsSuccess(), 0))) {

View File

@ -128,7 +128,7 @@ public class CarInfo implements Serializable {
private java.lang.String jqx;
@ApiModelProperty(value = "其他证明")
private java.lang.String otherProve;
@ApiModelProperty(value = "下发状态1成功2失败3部分成功")
@ApiModelProperty(value = "下发状态1成功2失败3部分成功4未下发")
private Integer sendSuccessStatus;
@ApiModelProperty(value = "外来车人员身份证号")
private java.lang.String outsideDriverIdCard;

View File

@ -117,7 +117,7 @@ public class CarInfoServiceImpl extends ServiceImpl<CarInfoMapper, CarInfo> impl
queryWrapper.lambda().eq(CarInfo::getProjectSn, c.getProjectSn())
.eq(CarInfo::getCarNumber, c.getCarNumber());
CarInfo old = carInfoMapper.selectOne(queryWrapper);
c.setSendSuccessStatus(null);
c.setSendSuccessStatus(4);
if (old != null) {
if (Objects.equals(old.getCarModuleType(), 1)) {
throw new OpenAlertException("该车辆已添加,请勿重复添加!");
@ -232,7 +232,7 @@ public class CarInfoServiceImpl extends ServiceImpl<CarInfoMapper, CarInfo> impl
CarInfo old = carInfoMapper.selectById(carInfo.getId());
carInfoMapper.updateById(carInfo);
carInfoMapper.update(null, new LambdaUpdateWrapper<CarInfo>()
.set(CarInfo::getSendSuccessStatus, null)
.set(CarInfo::getSendSuccessStatus, 4)
.eq(CarInfo::getId, carInfo.getId()));
if (isReservationType(old)) {

View File

@ -538,9 +538,6 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
}
}
}
if (CollUtil.isEmpty(workerAndDevSnList)) {
return;
}
asyncHikvision.sendBatchWorkerInfoAsync(allDevList, workerList, workerAndDevSnList, userId, projectUfaceConfig.getProjectSn());
}

View File

@ -16,6 +16,7 @@ import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService;
import com.zhgd.xmgl.util.Base64Util;
import com.zhgd.xmgl.util.EnvironmentUtil;
import com.zhgd.xmgl.util.MessageUtil;
import com.zhgd.xmgl.util.PathUtil;
import io.swagger.annotations.Api;
@ -60,6 +61,8 @@ public class UfaceRecognitionController {
private ProjectMapper projectMapper;
@Value("${upload.image.url.prefix:}")
private String imageUrlPrefix;
@Value("${xingzong.inner.upload.image.url.prefix:}")
private String xingzongInnerUploadImageUrlPrefix;
@ApiOperation(value = "检测人脸照片是否有人脸", notes = "列表查询人脸设备信息", httpMethod = "POST")
@ApiImplicitParams({
@ -124,7 +127,13 @@ public class UfaceRecognitionController {
if (Objects.equals(type, 2)) {
param.put("facePicBinaryData", Base64Util.convertFileToBase64(PathUtil.reviseSlash(basePath + "/" + fileUrl)));
} else {
param.put("facePicUrl", PathUtil.reviseSlash(imageUrlPrefix + "/" + fileUrl));
String url = "";
if (EnvironmentUtil.isXingZong()) {
url = xingzongInnerUploadImageUrlPrefix;
} else {
url = imageUrlPrefix;
}
param.put("facePicUrl", PathUtil.reviseSlash(url + "/" + fileUrl));
}
boolean b = hikvisionCall.faceScore(project, param);
//boolean b = true;

View File

@ -339,7 +339,7 @@ public class WorkerInfo implements Serializable {
private String ufaceDevGroupId;
@ApiModelProperty(value = "安全分数,低中高-80-90-")
private Double safeScore;
@ApiModelProperty(value = "下发状态1成功2失败3部分成功")
@ApiModelProperty(value = "下发状态1成功2失败3部分成功4未下发")
private Integer sendSuccessStatus;
@ApiModelProperty(value = "退场的安全分数")
private Double exitSafeScore;

View File

@ -134,4 +134,13 @@ public class EnvironmentUtil {
return Stream.of("baise").anyMatch(s -> s.equals(activeEnvironment));
}
/**
* 是否星纵环境
*
* @return
*/
public static boolean isXingZong() {
return Stream.of("xingzong", "xingzong-test").anyMatch(s -> s.equals(activeEnvironment));
}
}