人员状态修改
This commit is contained in:
parent
65280f9a97
commit
e8f3b594a9
@ -15,6 +15,7 @@ import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
|
|||||||
import com.zhgd.xmgl.modules.worker.entity.TeamInfo;
|
import com.zhgd.xmgl.modules.worker.entity.TeamInfo;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||||
import com.zhgd.xmgl.modules.worker.mapper.EnterpriseInfoMapper;
|
import com.zhgd.xmgl.modules.worker.mapper.EnterpriseInfoMapper;
|
||||||
|
import com.zhgd.xmgl.modules.worker.service.impl.WorkerInfoServiceImpl;
|
||||||
import com.zhgd.xmgl.modules.xz.entity.XzHikvisionSync;
|
import com.zhgd.xmgl.modules.xz.entity.XzHikvisionSync;
|
||||||
import com.zhgd.xmgl.modules.xz.mapper.XzHikvisionSyncMapper;
|
import com.zhgd.xmgl.modules.xz.mapper.XzHikvisionSyncMapper;
|
||||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||||
@ -35,6 +36,9 @@ import java.util.Objects;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class AsyncHikvision {
|
public class AsyncHikvision {
|
||||||
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
WorkerInfoServiceImpl workerInfoService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@Lazy
|
@Lazy
|
||||||
HikvisionCall hikvisionCall;
|
HikvisionCall hikvisionCall;
|
||||||
@ -60,6 +64,10 @@ public class AsyncHikvision {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private XzHikvisionSyncMapper xzHikvisionSyncMapper;
|
private XzHikvisionSyncMapper xzHikvisionSyncMapper;
|
||||||
|
|
||||||
|
public static Date getSyncLotNow() {
|
||||||
|
return ThreadLocalUtil.getNotNull().getDate("now");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加劳务人员-海康
|
* 添加劳务人员-海康
|
||||||
*
|
*
|
||||||
@ -78,7 +86,7 @@ public class AsyncHikvision {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addWorkerForHikvision(WorkerInfo workerInfo) {
|
public void addWorkerForHikvision(WorkerInfo workerInfo) {
|
||||||
Date now = ThreadLocalUtil.getNotNull().getDate("now");
|
Date now = getSyncLotNow();
|
||||||
xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(1).setOperate(1).setWhoId(workerInfo.getId()).setCreateDate(now));
|
xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(1).setOperate(1).setWhoId(workerInfo.getId()).setCreateDate(now));
|
||||||
xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(2).setOperate(1).setWhoId(workerInfo.getId()).setCreateDate(now));
|
xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(2).setOperate(1).setWhoId(workerInfo.getId()).setCreateDate(now));
|
||||||
asyncHikvision.addWorkerForHikvisionAsync(workerInfo, now);
|
asyncHikvision.addWorkerForHikvisionAsync(workerInfo, now);
|
||||||
@ -96,7 +104,7 @@ public class AsyncHikvision {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void editWorkerForHikvision(WorkerInfo workerInfo) {
|
public void editWorkerForHikvision(WorkerInfo workerInfo) {
|
||||||
Date now = ThreadLocalUtil.getNotNull().getDate("now");
|
Date now = getSyncLotNow();
|
||||||
xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(1).setOperate(2).setWhoId(workerInfo.getId()).setCreateDate(now));
|
xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(1).setOperate(2).setWhoId(workerInfo.getId()).setCreateDate(now));
|
||||||
xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(2).setOperate(2).setWhoId(workerInfo.getId()).setCreateDate(now));
|
xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(2).setOperate(2).setWhoId(workerInfo.getId()).setCreateDate(now));
|
||||||
asyncHikvision.editWorkerForHikvisionAsync(workerInfo, now);
|
asyncHikvision.editWorkerForHikvisionAsync(workerInfo, now);
|
||||||
@ -116,7 +124,7 @@ public class AsyncHikvision {
|
|||||||
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
|
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
|
||||||
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type);
|
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type);
|
||||||
}
|
}
|
||||||
hikvisionCall.updateAllFailStatusIfNullByNow(workerInfo.getProjectSn(), workerInfo.getId(), 1, ThreadLocalUtil.getNotNull().getDate("now"));
|
hikvisionCall.updateAllFailStatusIfNullByNow(workerInfo.getProjectSn(), workerInfo.getId(), 1, getSyncLotNow());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Async("hikvisionExecutor")
|
@Async("hikvisionExecutor")
|
||||||
@ -131,7 +139,7 @@ public class AsyncHikvision {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void deleteWorkerForHikvision(WorkerInfo workerInfo) {
|
public void deleteWorkerForHikvision(WorkerInfo workerInfo) {
|
||||||
Date now = ThreadLocalUtil.getNotNull().getDate("now");
|
Date now = getSyncLotNow();
|
||||||
xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(1).setOperate(3).setWhoId(workerInfo.getId()).setCreateDate(now));
|
xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(1).setOperate(3).setWhoId(workerInfo.getId()).setCreateDate(now));
|
||||||
xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(2).setOperate(3).setWhoId(workerInfo.getId()).setCreateDate(now));
|
xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(2).setOperate(3).setWhoId(workerInfo.getId()).setCreateDate(now));
|
||||||
asyncHikvision.deleteWorkerForHikvisionAsync(workerInfo, now);
|
asyncHikvision.deleteWorkerForHikvisionAsync(workerInfo, now);
|
||||||
@ -180,7 +188,6 @@ public class AsyncHikvision {
|
|||||||
hikvisionCall.handleAlarmCar(project, carInfo);
|
hikvisionCall.handleAlarmCar(project, carInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void sendNoticeForCar(CarInfo carInfo, Exception e, String action) {
|
private void sendNoticeForCar(CarInfo carInfo, Exception e, String action) {
|
||||||
String title = action + "车辆到海康isc失败";
|
String title = action + "车辆到海康isc失败";
|
||||||
String type = "24";
|
String type = "24";
|
||||||
@ -195,7 +202,7 @@ public class AsyncHikvision {
|
|||||||
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
|
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
|
||||||
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type);
|
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type);
|
||||||
}
|
}
|
||||||
hikvisionCall.updateAllFailStatusIfNullByNow(carInfo.getProjectSn(), carInfo.getId(), 4, ThreadLocalUtil.getNotNull().getDate("now"));
|
hikvisionCall.updateAllFailStatusIfNullByNow(carInfo.getProjectSn(), carInfo.getId(), 4, getSyncLotNow());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void editCarInfoForHikvision(CarInfo carInfo, CarInfo old) {
|
public void editCarInfoForHikvision(CarInfo carInfo, CarInfo old) {
|
||||||
@ -367,7 +374,7 @@ public class AsyncHikvision {
|
|||||||
if (StringUtils.isBlank(devSn)) {
|
if (StringUtils.isBlank(devSn)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Date now = ThreadLocalUtil.getNotNull().getDate("now");
|
Date now = getSyncLotNow();
|
||||||
String[] devSnArr = StringUtils.split(devSn, ",");
|
String[] devSnArr = StringUtils.split(devSn, ",");
|
||||||
for (String ds : devSnArr) {
|
for (String ds : devSnArr) {
|
||||||
xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(3).setOperate(1).setWhoId(workerInfo.getId()).setDeviceSn(ds).setCreateDate(now));
|
xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(3).setOperate(1).setWhoId(workerInfo.getId()).setDeviceSn(ds).setCreateDate(now));
|
||||||
@ -392,7 +399,7 @@ public class AsyncHikvision {
|
|||||||
} else {
|
} else {
|
||||||
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), e.getMessage(), "人员下发设备提醒", "1");
|
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), e.getMessage(), "人员下发设备提醒", "1");
|
||||||
}
|
}
|
||||||
hikvisionCall.updateAllFailStatusIfNullByNowForAuth(workerInfo.getProjectSn(), workerInfo.getId(), 3, 1, ThreadLocalUtil.getNotNull().getDate("now"));
|
hikvisionCall.updateAllFailStatusIfNullByNowForAuth(workerInfo.getProjectSn(), workerInfo.getId(), 3, 1, getSyncLotNow());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,7 +419,7 @@ public class AsyncHikvision {
|
|||||||
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
|
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
|
||||||
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), StringUtils.substring(msg, 0, msg.length() - 1), title, type);
|
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), StringUtils.substring(msg, 0, msg.length() - 1), title, type);
|
||||||
}
|
}
|
||||||
hikvisionCall.updateAllFailStatusIfNullByNowForAuth(workerInfo.getProjectSn(), workerInfo.getId(), 3, 1, ThreadLocalUtil.getNotNull().getDate("now"));
|
hikvisionCall.updateAllFailStatusIfNullByNowForAuth(workerInfo.getProjectSn(), workerInfo.getId(), 3, 1, getSyncLotNow());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("海康:", e);
|
log.error("海康:", e);
|
||||||
}
|
}
|
||||||
@ -428,7 +435,7 @@ public class AsyncHikvision {
|
|||||||
if (StringUtils.isBlank(devSns)) {
|
if (StringUtils.isBlank(devSns)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Date now = ThreadLocalUtil.getNotNull().getDate("now");
|
Date now = getSyncLotNow();
|
||||||
String[] devSnArr = StringUtils.split(devSns, ",");
|
String[] devSnArr = StringUtils.split(devSns, ",");
|
||||||
for (String ds : devSnArr) {
|
for (String ds : devSnArr) {
|
||||||
xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(3).setOperate(3).setWhoId(workerInfo.getId()).setDeviceSn(ds).setCreateDate(now));
|
xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(3).setOperate(3).setWhoId(workerInfo.getId()).setDeviceSn(ds).setCreateDate(now));
|
||||||
@ -456,7 +463,7 @@ public class AsyncHikvision {
|
|||||||
} else {
|
} else {
|
||||||
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), e.getMessage(), "人员下发设备提醒", "1");
|
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), e.getMessage(), "人员下发设备提醒", "1");
|
||||||
}
|
}
|
||||||
hikvisionCall.updateAllFailStatusIfNullByNowForAuth(workerInfo.getProjectSn(), workerInfo.getId(), 3, 3, ThreadLocalUtil.getNotNull().getDate("now"));
|
hikvisionCall.updateAllFailStatusIfNullByNowForAuth(workerInfo.getProjectSn(), workerInfo.getId(), 3, 3, getSyncLotNow());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,7 +483,7 @@ public class AsyncHikvision {
|
|||||||
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
|
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
|
||||||
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), StringUtils.substring(msg, 0, msg.length() - 1), title, type);
|
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), StringUtils.substring(msg, 0, msg.length() - 1), title, type);
|
||||||
}
|
}
|
||||||
hikvisionCall.updateAllFailStatusIfNullByNowForAuth(workerInfo.getProjectSn(), workerInfo.getId(), 3, 3, ThreadLocalUtil.getNotNull().getDate("now"));
|
hikvisionCall.updateAllFailStatusIfNullByNowForAuth(workerInfo.getProjectSn(), workerInfo.getId(), 3, 3, getSyncLotNow());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("海康:", e);
|
log.error("海康:", e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1211,7 +1211,7 @@ public class HikvisionCall {
|
|||||||
updateTotalStatus(projectSn, whoId, type, now);
|
updateTotalStatus(projectSn, whoId, type, now);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTotalStatus(String projectSn, Long whoId, Integer bigType, Date now) {
|
public void updateTotalStatus(String projectSn, Long whoId, Integer bigType, Date now) {
|
||||||
List<XzHikvisionSync> xzHikvisionSyncs = xzHikvisionSyncMapper.selectList(new LambdaQueryWrapper<XzHikvisionSync>()
|
List<XzHikvisionSync> xzHikvisionSyncs = xzHikvisionSyncMapper.selectList(new LambdaQueryWrapper<XzHikvisionSync>()
|
||||||
.eq(XzHikvisionSync::getProjectSn, projectSn)
|
.eq(XzHikvisionSync::getProjectSn, projectSn)
|
||||||
.eq(XzHikvisionSync::getWhoId, whoId)
|
.eq(XzHikvisionSync::getWhoId, whoId)
|
||||||
|
|||||||
@ -16,11 +16,13 @@ import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
|||||||
import com.zhgd.xmgl.modules.worker.mapper.UfaceDevMapper;
|
import com.zhgd.xmgl.modules.worker.mapper.UfaceDevMapper;
|
||||||
import com.zhgd.xmgl.modules.worker.mapper.UfaceDevToGroupMapper;
|
import com.zhgd.xmgl.modules.worker.mapper.UfaceDevToGroupMapper;
|
||||||
import com.zhgd.xmgl.modules.worker.mapper.UserDevAuthorityMapper;
|
import com.zhgd.xmgl.modules.worker.mapper.UserDevAuthorityMapper;
|
||||||
|
import com.zhgd.xmgl.modules.worker.service.impl.WorkerInfoServiceImpl;
|
||||||
import com.zhgd.xmgl.util.*;
|
import com.zhgd.xmgl.util.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@ -37,6 +39,9 @@ import java.util.stream.Collectors;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfigMapper, ProjectUfaceConfig> implements IProjectUfaceConfigService {
|
public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfigMapper, ProjectUfaceConfig> implements IProjectUfaceConfigService {
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private WorkerInfoServiceImpl workerInfoService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectUfaceConfigMapper projectUfaceConfigMapper;
|
private ProjectUfaceConfigMapper projectUfaceConfigMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -311,6 +316,7 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
workerInfoService.resetHkStatus(workerInfo);
|
||||||
} else {
|
} else {
|
||||||
Map<String, Object> param = new HashMap<>();
|
Map<String, Object> param = new HashMap<>();
|
||||||
param.put("projectSn", workerInfo.getProjectSn());
|
param.put("projectSn", workerInfo.getProjectSn());
|
||||||
|
|||||||
@ -14,7 +14,6 @@ import cn.hutool.poi.excel.ExcelWriter;
|
|||||||
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.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@ -434,10 +433,6 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
|||||||
}
|
}
|
||||||
WorkerInfo oldWorkerInfo = workerInfoMapper.selectById(workerInfo.getId());
|
WorkerInfo oldWorkerInfo = workerInfoMapper.selectById(workerInfo.getId());
|
||||||
workerInfoMapper.updateById(workerInfo);
|
workerInfoMapper.updateById(workerInfo);
|
||||||
workerInfoMapper.update(null, new LambdaUpdateWrapper<WorkerInfo>()
|
|
||||||
.set(WorkerInfo::getSendSuccessStatus, null)
|
|
||||||
.eq(WorkerInfo::getId, workerInfo.getId())
|
|
||||||
);
|
|
||||||
//同步海康
|
//同步海康
|
||||||
asyncHikvision.editWorkerForHikvision(workerInfo);
|
asyncHikvision.editWorkerForHikvision(workerInfo);
|
||||||
|
|
||||||
@ -456,9 +451,14 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
|||||||
govtOpenApiService.workerInfoAddSync(workerInfo);
|
govtOpenApiService.workerInfoAddSync(workerInfo);
|
||||||
}
|
}
|
||||||
asyncJiLianDa.saveWorkerInfo(workerInfo);
|
asyncJiLianDa.saveWorkerInfo(workerInfo);
|
||||||
|
resetHkStatus(workerInfo);
|
||||||
return workerInfo;
|
return workerInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetHkStatus(WorkerInfo workerInfo) {
|
||||||
|
hikvisionCall.updateTotalStatus(workerInfo.getProjectSn(), workerInfo.getId(), 1, AsyncHikvision.getSyncLotNow());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据Id删除人员
|
* 根据Id删除人员
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user