海康下发修改
This commit is contained in:
parent
9677938533
commit
ca1beb9b27
@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.jeecg.common.execption.OpenPromptException;
|
||||
import com.zhgd.jeecg.common.util.SpringContextUtils;
|
||||
import com.zhgd.jeecg.common.util.pass.HttpUtils;
|
||||
@ -551,11 +552,11 @@ public class AsyncHikvision {
|
||||
String redNotice = "";
|
||||
List<String> redNameList = workerList.stream().filter(w -> NumberUtils.lt(w.getSafeScore(), 80D)).map(WorkerInfo::getWorkerName).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(redNameList)) {
|
||||
redNotice = StrUtil.format(",其中{}是红码不下发", StrUtil.join(",", redNameList));
|
||||
redNotice = StrUtil.format(",{}是红码不下发", StrUtil.join(",", redNameList));
|
||||
}
|
||||
Notice notice = new Notice();
|
||||
notice.setAccountId(userId);
|
||||
notice.setMsg(StrUtil.format("已经完成批量向设备下发{}个人{}", workerList.size(), redNotice));
|
||||
notice.setMsg(StrUtil.format("已经完成批量向设备下发{}个人{}", workerList.size() - redNameList.size(), redNotice));
|
||||
notice.setTitle("人员批量下发设备提醒");
|
||||
notice.setSendTime(format1.format(new Date()));
|
||||
notice.setType("1");
|
||||
@ -579,16 +580,22 @@ public class AsyncHikvision {
|
||||
private void sendExcNotice(Exception e, List<WorkerInfo> workerList, UfaceDev dev) {
|
||||
String exc;
|
||||
if (HttpUtils.isTimeOut(e)) {
|
||||
exc = ",网络异常";
|
||||
exc = ",连接ISC网络异常";
|
||||
} else {
|
||||
exc = ",下发异常";
|
||||
}
|
||||
List<WorkerInfo> failWorkers = workerList.stream().filter(workerInfo -> !Objects.equals(workerInfo.getSendSuccessStatus(), 1)).collect(Collectors.toList());
|
||||
for (WorkerInfo workerInfo : failWorkers) {
|
||||
if (ThreadLocalUtil.getByKey(Cts.TL_AUTH_USER, UserInfo.class) != null) {
|
||||
noticeService.addUserNotice(ThreadLocalUtil.getByKey(Cts.TL_AUTH_USER, UserInfo.class).getUserId(),
|
||||
StrUtil.format("{}{}设备下发权限失败{}", workerInfo.getWorkerName(), dev != null ? dev.getDevName() : "有些", exc),
|
||||
"人员下发设备提醒", "1");
|
||||
if (CollUtil.isNotEmpty(workerList)) {
|
||||
List<WorkerInfo> failWorkers = workerInfoService.list(Wrappers.<WorkerInfo>lambdaQuery()
|
||||
.eq(WorkerInfo::getProjectSn, dev.getProjectSn())
|
||||
.ne(WorkerInfo::getSendSuccessStatus, 1)
|
||||
.in(WorkerInfo::getId, workerList.stream().map(WorkerInfo::getId).collect(Collectors.toList()))
|
||||
);
|
||||
for (WorkerInfo workerInfo : failWorkers) {
|
||||
if (ThreadLocalUtil.getByKey(Cts.TL_AUTH_USER, UserInfo.class) != null) {
|
||||
noticeService.addUserNotice(ThreadLocalUtil.getByKey(Cts.TL_AUTH_USER, UserInfo.class).getUserId(),
|
||||
StrUtil.format("[{}]下发{}设备权限失败{}", workerInfo.getWorkerName(), dev != null ? "[" + dev.getDevName() + "]" : "有些", exc),
|
||||
"人员下发设备提醒", "1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1792,7 +1792,7 @@ public class HikvisionCall {
|
||||
JSONArray orgList = getOrgList(project, StrUtil.join(",", enterpriseId, enterpriseInfo != null ? enterpriseInfo.getProjectEnterprise().getId() : ""), project.getProjectSn());
|
||||
String index = null;
|
||||
if (CollUtil.isEmpty(orgList)) {
|
||||
index = String.valueOf(enterpriseInfo.getProjectEnterprise().getId());
|
||||
index = enterpriseInfo != null ? String.valueOf(enterpriseInfo.getProjectEnterprise().getId()) : enterpriseId;
|
||||
} else {
|
||||
index = orgList.getJSONObject(0).getString("orgIndexCode");
|
||||
}
|
||||
|
||||
@ -29,6 +29,6 @@
|
||||
<if test="param.isBigScreen == null or param.isBigScreen == '0'.toString()">
|
||||
AND type not in (31,32)
|
||||
</if>
|
||||
ORDER BY send_time DESC
|
||||
ORDER BY send_time DESC,id desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -646,9 +646,6 @@ public class WorkerInfoController {
|
||||
})
|
||||
@PostMapping(value = "/uploadWorkerInfoImgs")
|
||||
public Result uploadWorkerInfoImgs(MultipartFile file, String projectSn) throws IOException {
|
||||
if (!redisRepository.setNx("uploadWorkerInfoImgs:projectSn" + projectSn, 1000 * 30L)) {
|
||||
return Result.ok("正在导入中,请耐心等待通知!");
|
||||
}
|
||||
workerInfoService.uploadWorkerInfoImgs(file, projectSn);
|
||||
return Result.ok("导入中,请耐心等待通知!");
|
||||
}
|
||||
|
||||
@ -457,6 +457,12 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
return workerInfo;
|
||||
}
|
||||
|
||||
@Async("workerHkExecutor")
|
||||
public Future editWorkerInfoAsync(WorkerInfo workerInfo) {
|
||||
this.editWorkerInfo(workerInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员编辑
|
||||
*
|
||||
@ -1808,15 +1814,13 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
continue;
|
||||
}
|
||||
workerInfo.setId(oldWorkerInfo.getId());
|
||||
//同步海康
|
||||
workerInfoService.editWorkerInfo(workerInfo);
|
||||
workerInfoService.editWorkerForUploadExcel(workerInfo);
|
||||
} else {
|
||||
String uuid = UUID.randomUUID().toString().replace("-", "").toUpperCase();
|
||||
workerInfo.setPersonSn(uuid);
|
||||
workerInfo.setAddTime(new Date());
|
||||
workerInfo.setAttendanceNumber(workerInfo.getIdCard());
|
||||
//同步海康
|
||||
workerInfoService.saveWorkerInfo(workerInfo);
|
||||
workerInfoService.addWorkerForUploadExcel(workerInfo);
|
||||
}
|
||||
asyncJiLianDa.saveWorkerInfo(workerInfo);
|
||||
}
|
||||
@ -1836,6 +1840,20 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void editWorkerForUploadExcel(WorkerInfo workerInfo) {
|
||||
workerInfoMapper.updateById(workerInfo);
|
||||
//同步海康
|
||||
this.editWorkerForHikvision(workerInfo);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addWorkerForUploadExcel(WorkerInfo workerInfo) {
|
||||
workerInfoMapper.insert(workerInfo);
|
||||
//同步海康
|
||||
this.addWorkerForHikvision(workerInfo);
|
||||
}
|
||||
|
||||
private void checkParams(List<Map<String, String>> list, Map<String, Object> teamMap, Map<String, Object> departmentMap) {
|
||||
for (Map<String, String> importInfo : list) {
|
||||
String name = importInfo.get("*姓名");
|
||||
@ -2206,15 +2224,21 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
List<WorkerInfo> editWorkerInfos = getEditWorkerInfos(f.getAbsolutePath(), formatSb, sucSb, projectSn);
|
||||
allEditWorkerInfos.addAll(editWorkerInfos);
|
||||
}
|
||||
ArrayList<Future> futures = new ArrayList<>();
|
||||
for (WorkerInfo workerInfo : allEditWorkerInfos) {
|
||||
workerInfoService.editWorkerInfo(workerInfo);
|
||||
Future future = workerInfoService.editWorkerInfoAsync(workerInfo);
|
||||
futures.add(future);
|
||||
}
|
||||
for (Future future : futures) {
|
||||
while (!future.isDone()) {
|
||||
}
|
||||
}
|
||||
//通知
|
||||
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
|
||||
String msg = "";
|
||||
String sucSbStr = sucSb.toString();
|
||||
if (StrUtil.isNotBlank(sucSbStr)) {
|
||||
msg = "成功>" + sucSbStr;
|
||||
msg = "导入图片:" + sucSbStr;
|
||||
}
|
||||
String failStr = failSb.toString();
|
||||
if (StrUtil.isNotBlank(failStr)) {
|
||||
@ -2230,7 +2254,6 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, "更新人员图片成功", "2");
|
||||
FileUtil.del(folderFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2371,9 +2394,11 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
.eq(WorkerInfo::getIdCard, idCard)
|
||||
.eq(WorkerInfo::getProjectSn, projectSn)
|
||||
);
|
||||
sucSb.append(workerName + ",");
|
||||
workerInfo.setFieldAcquisitionUrl(saveName);
|
||||
rtList.add(workerInfo);
|
||||
if (workerInfo != null) {
|
||||
workerInfo.setFieldAcquisitionUrl(saveName);
|
||||
rtList.add(workerInfo);
|
||||
sucSb.append(workerName + ",");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user