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