Commit 17a8e916 authored by 姬鋆屾's avatar 姬鋆屾
parents 511383a9 a9a27b5f
...@@ -8,9 +8,9 @@ module.exports = { ...@@ -8,9 +8,9 @@ module.exports = {
hot: true,//自动保存 hot: true,//自动保存
proxy: { proxy: {
'/attendance': { '/attendance': {
target: 'http://192.168.0.98:11039', //target: 'http://192.168.0.98:11039',
// target: 'http://112.19.80.237:11039', // target: 'http://112.19.80.237:11039',
// target: 'http://localhost:17500', target: 'http://localhost:17500',
changeOrigin: true, changeOrigin: true,
secure: false, secure: false,
cookieDomainRewrite: 'localhost', cookieDomainRewrite: 'localhost',
......
...@@ -11,4 +11,8 @@ public class TestReq { ...@@ -11,4 +11,8 @@ public class TestReq {
private Date createTimeStart; private Date createTimeStart;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTimeEnd; private Date createTimeEnd;
private Long deviceId;
} }
...@@ -42,12 +42,6 @@ public class SyncDoorsEventAfterTaskImpl implements ITaskExcuteService { ...@@ -42,12 +42,6 @@ public class SyncDoorsEventAfterTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
private AttendanceRecordHikService recordHikService; private AttendanceRecordHikService recordHikService;
@Autowired
private StaffService staffService;
@Autowired
private IHikDoorService hikDoorService;
@Autowired @Autowired
private AttendanceStatService attendanceStatService; private AttendanceStatService attendanceStatService;
......
...@@ -38,7 +38,7 @@ import java.util.stream.Collectors; ...@@ -38,7 +38,7 @@ import java.util.stream.Collectors;
* 同步获取当天海康门禁事件 * 同步获取当天海康门禁事件
*/ */
@Slf4j @Slf4j
@Service("SyncDoorsEventByDevicesTask") //@Service("SyncDoorsEventByDevicesTask")
public class SyncDoorsEventByDevicesTaskImpl implements ITaskExcuteService { public class SyncDoorsEventByDevicesTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
...@@ -87,110 +87,6 @@ public class SyncDoorsEventByDevicesTaskImpl implements ITaskExcuteService { ...@@ -87,110 +87,6 @@ public class SyncDoorsEventByDevicesTaskImpl implements ITaskExcuteService {
} }
} }
/**
* 查询当前间隔时间的门禁事件
*
* @param doorEntity
*/
private void syncDoorEvents(DoorEntity doorEntity) {
HikDoorEventReq hikDoorEventReq = new HikDoorEventReq();
//当前时间前一个小时
// Date startTime = DateUtil.offsetHour(new Date(), -1).toJdkDate();
Date startTime = DateUtil.offsetDay(new Date(), -1).toJdkDate();
Date endTime = new Date();
hikDoorEventReq.setStartTime(startTime);
hikDoorEventReq.setEndTime(endTime);
Rest<List<EventInfo>> listRest = hikDoorService.searchDoorEventsList(hikDoorEventReq, doorEntity);
if (listRest.getCode() == YesNoEnum.YES.getValue()) {
List<EventInfo> list = listRest.getData();
List<AttendanceRecordHikEntity> attRecords = list.stream().map(item -> {
AttendanceRecordHikEntity recordHikEntity = new AttendanceRecordHikEntity();
recordHikEntity.initAttrValue();
String jobNo = "";
byte[] byEmployeeNo = item.getStruAcsEventInfo().getByEmployeeNo();
if (ObjectUtils.isEmpty(new String(byEmployeeNo).trim())) {
int dwEmployeeNo = item.getStruAcsEventInfo().getDwEmployeeNo();
if (dwEmployeeNo == 0) {
//log.info("jobNo is null ==>{}", JSON.toJSONString(item));
return null;
} else {
jobNo = String.valueOf(dwEmployeeNo);
}
} else {
jobNo = new String(byEmployeeNo).trim();
}
log.info("jobNo==>{}",jobNo);
//查看考勤状态
int dwMajor = item.getDwMajor();//报警主类型
int dwMinor = item.getDwMinor();//报警次类型
String dwMinorStr = Integer.toHexString(dwMinor);
//判断次类型 是否在白名单里面
Set<String> dwSet = DwMinorEnum.getEnumMap().keySet();
if (dwSet.contains(dwMinorStr)) {
//符号考勤 添加到考勤里面
StruTime struTime = item.getStruTime();
//格式化时间 年月日 时分秒 yyyy-MM-dd HH:mm:ss
int dwYear = struTime.getDwYear();
int dwMonth = struTime.getDwMonth();
int dwDay = struTime.getDwDay();
int dwHour = struTime.getDwHour();
int dwMinute = struTime.getDwMinute();
int dwSecond = struTime.getDwSecond();
LocalDateTime localDateTime = LocalDateTime.of(dwYear, dwMonth, dwDay, dwHour, dwMinute, dwSecond);
ZoneId zoneId = ZoneId.systemDefault();
ZonedDateTime zdt = localDateTime.atZone(zoneId);
Date attendDate = Date.from(zdt.toInstant());
StaffEntity staffCache = staffService.getExtCache(StrUtil.padPre(jobNo, 8, "0"));
if (ObjectUtils.isEmpty(staffCache)) {
log.info("staff is null !staffCode:{}", jobNo);
return null;
}
recordHikEntity.setStaffId(staffCache.getId());
recordHikEntity.setStaffName(staffCache.getName());
recordHikEntity.setWorkNum(staffCache.getWorkNum());
recordHikEntity.setDeptId(staffCache.getDeptId());
recordHikEntity.setDeptName(staffCache.getDeptName());
recordHikEntity.setPositionId(staffCache.getPositionId());
recordHikEntity.setPositionName(staffCache.getPositionName());
recordHikEntity.setAttendanceDate(attendDate);
// recordHikEntity.setAttendanceAddress(item.getDoorName());
recordHikEntity.setEventSource("门禁点");
//recordHikEntity.setRemark(item.getEventId());
recordHikEntity.setCreateTime(new Date());
recordHikEntity.setCreateUserName("系统管理员");
recordHikEntity.setCreateUserId(1L);
return recordHikEntity;
} else {
log.info("考勤次类型dwMinorCode:" + dwMinorStr);
return null;
}
}).filter(f -> f != null).collect(Collectors.toList());
log.info("attRecords size:{}", attRecords.size());
if (!ObjectUtils.isEmpty(attRecords)) {
//单个插入 去掉重复时间段的打卡记录
for (AttendanceRecordHikEntity recordHikEntity : attRecords) {
try {
recordHikService.getDao().insert(recordHikEntity);
} catch (Exception e) {
log.error("基础考勤数据保存异常", e.getMessage());
}
}
}
}
}
@Override @Override
public void stopTask(ITask task) throws AppException { public void stopTask(ITask task) throws AppException {
......
...@@ -50,24 +50,13 @@ public class SyncDoorsEventTaskImpl implements ITaskExcuteService { ...@@ -50,24 +50,13 @@ public class SyncDoorsEventTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
private AttendanceRecordHikService recordHikService; private AttendanceRecordHikService recordHikService;
@Autowired
private StaffService staffService;
@Autowired
private IHikDoorService hikDoorService;
private Integer day; private Integer day;
@Autowired
private ICacheService cacheService;
@Value("${hik.host:}") @Value("${hik.host:}")
protected String hikhost; protected String hikhost;
@Autowired @Autowired
private DoorService doorService; private DoorService doorService;
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
//同步多久时间段的 偏移量为天 默认当天 //同步多久时间段的 偏移量为天 默认当天
...@@ -77,20 +66,20 @@ public class SyncDoorsEventTaskImpl implements ITaskExcuteService { ...@@ -77,20 +66,20 @@ public class SyncDoorsEventTaskImpl implements ITaskExcuteService {
} else { } else {
day = 0; day = 0;
} }
Date beginDateTime=DateUtil.parseDateTime(DateUtil.today()+" 08:00:00"); Date beginDateTime = DateUtil.parseDateTime(DateUtil.today() + " 08:00:00");
Date endDateTime=DateUtil.parseDateTime(DateUtil.today()+" 23:30:00"); Date endDateTime = DateUtil.parseDateTime(DateUtil.today() + " 23:30:00");
boolean in = DateUtil.isIn(new Date(), beginDateTime, endDateTime); boolean in = DateUtil.isIn(new Date(), beginDateTime, endDateTime);
if(in){ if (in) {
AttendanceRecordHikQuery hikQuery = new AttendanceRecordHikQuery(); AttendanceRecordHikQuery hikQuery = new AttendanceRecordHikQuery();
DateTime startTime = DateUtil.offsetDay(new Date(), day > 0 ? -day : 0); DateTime startTime = DateUtil.offsetDay(new Date(), day > 0 ? -day : 0);
hikQuery.setAttendanceDateStart( startTime.toDateStr()); hikQuery.setAttendanceDateStart(startTime.toDateStr());
// 获取当天的结束时间 // 获取当天的结束时间
hikQuery.setAttendanceDateEnd(DateUtil.today()); hikQuery.setAttendanceDateEnd(DateUtil.today());
if (!ObjectUtils.isEmpty(hikhost)) { if (!ObjectUtils.isEmpty(hikhost)) {
recordHikService.syncDoorEvents(hikQuery); recordHikService.syncDoorEvents(hikQuery);
recordHikService.deletFakeRecord(hikQuery, null); recordHikService.deletFakeRecord(hikQuery, null);
}else{ } else {
log.info("同步设备上门禁事件!"); log.info("同步设备上门禁事件!");
HikDoorEventReq hikDoorEventReq = new HikDoorEventReq(); HikDoorEventReq hikDoorEventReq = new HikDoorEventReq();
hikDoorEventReq.setStartTime(startTime.toJdkDate()); hikDoorEventReq.setStartTime(startTime.toJdkDate());
...@@ -104,114 +93,6 @@ public class SyncDoorsEventTaskImpl implements ITaskExcuteService { ...@@ -104,114 +93,6 @@ public class SyncDoorsEventTaskImpl implements ITaskExcuteService {
} }
} }
private void syncDoorEvents() {
DoorEventReq doorEventReq = new DoorEventReq();
List<Integer> eventTypes = new ArrayList<>();
eventTypes.add(196885);
eventTypes.add(196887);
eventTypes.add(196893);
eventTypes.add(196888);
eventTypes.add(196889);
eventTypes.add(196890);
eventTypes.add(196891);
// eventTypes.add(196893);//人脸认证通过
doorEventReq.setEventTypes(eventTypes);
// 获取当天的开始时间
//Date todayStart = DateUtil.offsetHour(new Date(), -5).toJdkDate();
Date todayStart = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), day > 0 ? -day : 0));
// 获取当天的结束时间
Date todayEnd = DateUtil.endOfDay(new Date());
doorEventReq.setStartTime(todayStart);
doorEventReq.setEndTime(todayEnd);
doorEventReq.setPageNo(1);
doorEventReq.setPageSize(1);
Rest<DoorEventDataInfo> doorEventsRest = hikDoorService.getDoorEvents(doorEventReq);
log.info("doorEventsRest:{} msg:{}", doorEventsRest.getCode(), doorEventsRest.getMsg());
if (doorEventsRest.getCode() == YesNoEnum.YES.getValue()) {
//分页获取考勤数据
Integer total = doorEventsRest.getData().getTotal();
int pageCount = PageUtil.totalPage(total, 1000);
for (int i = 1; i <= pageCount; i++) {
doorEventReq.setPageNo(i);
doorEventReq.setPageSize(1000);
doorEventsRest = hikDoorService.getDoorEvents(doorEventReq);
log.info("doorEventsRest:{} msg:{},page:{}", doorEventsRest.getCode(), doorEventsRest.getMsg(), doorEventReq.getPageNo());
getDoorEvents(doorEventsRest);
}
}
}
private void getDoorEvents(Rest<DoorEventDataInfo> doorEventsRest) {
//同步当前考勤数据
List<AttendanceRecordHikEntity> attRecords = doorEventsRest.getData().getList().stream().map(item -> {
AttendanceRecordHikEntity recordHikEntity = new AttendanceRecordHikEntity();
recordHikEntity.initAttrValue();
if (ObjectUtils.isEmpty(item.getJobNo())) {
log.info("jobNo is null ==>{}", JSON.toJSONString(item));
return null;
}
StaffEntity staffCache = staffService.getExtCache(StrUtil.padPre(item.getJobNo(), 8, "0"));
if (ObjectUtils.isEmpty(staffCache)) {
log.info("staff is null !staffCode:{}", item.getJobNo());
return null;
}
recordHikEntity.setStaffId(staffCache.getId());
recordHikEntity.setStaffName(staffCache.getName());
recordHikEntity.setWorkNum(staffCache.getWorkNum());
recordHikEntity.setDeptId(staffCache.getDeptId());
recordHikEntity.setDeptName(staffCache.getDeptName());
recordHikEntity.setSalaId(staffCache.getSalaId());
recordHikEntity.setSalaName(staffCache.getSalaName());
recordHikEntity.setPositionId(staffCache.getPositionId());
recordHikEntity.setPositionName(staffCache.getPositionName());
recordHikEntity.setAttendanceDate(item.getEventTime());
recordHikEntity.setAttendanceAddress(item.getDoorName());
recordHikEntity.setEventSource("门禁点");
recordHikEntity.setRemark(item.getEventId());
recordHikEntity.setCreateTime(new Date());
recordHikEntity.setCreateUserName("系统管理员");
recordHikEntity.setCreateUserId(1L);
return recordHikEntity;
}).filter(f -> f != null).collect(Collectors.toList());
log.info("attRecords size:{}", attRecords.size());
List<String> eventIds = attRecords.parallelStream().filter(f -> !ObjectUtils.isEmpty(f) && !ObjectUtils.isEmpty(f.getRemark())).map(i -> i.getRemark()).collect(Collectors.toList());
//查询当天考勤记录是否有重复的 有的 则不添加
AttendanceRecordHikQuery recordHikQuery = new AttendanceRecordHikQuery();
recordHikQuery.setAttendanceDateStart(DateUtil.format(DateUtil.beginOfDay(new Date()), "yyyy-MM-dd"));
recordHikQuery.setAttendanceDateEnd(DateUtil.format(DateUtil.beginOfDay(new Date()), "yyyy-MM-dd"));
recordHikQuery.setRemarkList(eventIds);
Set<String> eventIdSet = recordHikService.find(recordHikQuery).parallelStream().map(i -> i.getRemark()).collect(Collectors.toSet());
//去重 时分秒打卡的 也要去掉重复。
List<AttendanceRecordHikEntity> saveRecordList = attRecords.stream().filter(f -> !eventIdSet.contains(f.getRemark())).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(saveRecordList)) {
//单个插入 去掉重复时间段的打卡记录
for (AttendanceRecordHikEntity recordHikEntity : saveRecordList) {
try {
recordHikService.getDao().insert(recordHikEntity);
} catch (Exception e) {
//log.error("基础考勤数据保存异常", e.getMessage());
}
}
// recordHikService.save(saveRecordList);
}
log.info("saveRecordList size:{}", saveRecordList.size());
AttendanceRecordHikQuery hikQuery = new AttendanceRecordHikQuery();
hikQuery.setAttendanceDateStart(DateUtil.beginOfMonth(new Date()).toDateStr());
hikQuery.setAttendanceDateEnd(DateUtil.today());
Long totalCache = recordHikService.find(hikQuery).parallelStream().map(item -> item.getStaffId()).distinct().count();
cacheService.hset(RedisKey.KEY_ATTENC_TOTOAL_CACHE, DateUtil.format(new Date(), "yyyy-MM"), totalCache);
}
@Override @Override
public void stopTask(ITask task) throws AppException { public void stopTask(ITask task) throws AppException {
......
...@@ -67,10 +67,6 @@ public class SyncPortalUserTaskImpl implements ITaskExcuteService { ...@@ -67,10 +67,6 @@ public class SyncPortalUserTaskImpl implements ITaskExcuteService {
//当前用户map //当前用户map
Map<String, UserEntity> oldUserMap = oldUserList.parallelStream().collect(Collectors.toMap(x -> x.getLoginName(), y -> y, (o, n) -> n)); Map<String, UserEntity> oldUserMap = oldUserList.parallelStream().collect(Collectors.toMap(x -> x.getLoginName(), y -> y, (o, n) -> n));
//门户用户map
// Map<String, UserEntity> newUserMap = newUserList.stream().collect(Collectors.toMap(x -> x.getLoginName(), y -> y, (o, n) -> n));
List<UserEntity> saveUserList = newUserList.stream().map(item -> { List<UserEntity> saveUserList = newUserList.stream().map(item -> {
if (!oldUserMap.containsKey(item.getLoginName())) { if (!oldUserMap.containsKey(item.getLoginName())) {
item.setCreateUserId(1L); item.setCreateUserId(1L);
...@@ -88,10 +84,7 @@ public class SyncPortalUserTaskImpl implements ITaskExcuteService { ...@@ -88,10 +84,7 @@ public class SyncPortalUserTaskImpl implements ITaskExcuteService {
userService.getUserDao().insert(item); userService.getUserDao().insert(item);
}); });
} }
} }
//查找新增 与更新
} }
} }
......
...@@ -53,41 +53,13 @@ public class SyncRegisterUserPicTaskImpl implements ITaskExcuteService { ...@@ -53,41 +53,13 @@ public class SyncRegisterUserPicTaskImpl implements ITaskExcuteService {
} else { } else {
List<DoorEntity> doorEntities = doorService.find(new DoorQuery()); List<DoorEntity> doorEntities = doorService.find(new DoorQuery());
for (DoorEntity doorEntity : doorEntities) { for (DoorEntity doorEntity : doorEntities) {
//todo 直连设备 //todo 直连设备获取员工照片
} }
} }
// syncRegisterUsersPhotos();
log.info("同步员工任务照片完成"); log.info("同步员工任务照片完成");
} }
private void syncRegisterUsersPhotos() {
List<StaffEntity> staffList = staffService.find(new StaffQuery().source(1)).stream()
.filter(item -> ObjectUtils.isEmpty(item.getPhotoPath()))
.filter(item -> !ObjectUtils.isEmpty(item.getPicUri())).collect(Collectors.toList());
for (StaffEntity staff : staffList) {
ImgReq imgReq = new ImgReq();
imgReq.setServerIndexCode(staff.getServerIndexCode());
imgReq.setPicUri(staff.getPicUri());
try {
InputStream inputStream = hikFaceService.callPostImgs(imgReq);
if (!ObjectUtils.isEmpty(inputStream)) {
MultipartFile file = ServletUtils.getMultipartFile(inputStream, "photo.jpg");
String filePath = uploadService.saveFileUpload(file, "file/fileupload/staff", null);
staff.setPhotoPath(filePath);
staffService.update(staff);
} else {
log.error("获取图片异常!");
}
} catch (Exception e) {
log.error("下载图片异常", e.getMessage());
}
}
}
@Override @Override
public void stopTask(ITask task) throws AppException { public void stopTask(ITask task) throws AppException {
......
...@@ -30,7 +30,7 @@ import java.util.List; ...@@ -30,7 +30,7 @@ import java.util.List;
* 同步海康用户 * 同步海康用户
*/ */
@Slf4j @Slf4j
@Service("SyncUserByDeviceDoorsTask") //@Service("SyncUserByDeviceDoorsTask")
public class SyncUserByDeviceDoorsTaskImpl implements ITaskExcuteService { public class SyncUserByDeviceDoorsTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
......
...@@ -99,16 +99,9 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -99,16 +99,9 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
log.error("同步钉钉usreId失败"); log.error("同步钉钉usreId失败");
} }
} else { } else {
//todo 设备直连 log.info("设备直连同步人员信息");
deptService.syncDeptByDevice(null);
staffService.syncPersonsByDevices(null); staffService.syncPersonsByDevices(null);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("同步人事异常", e); log.error("同步人事异常", e);
} }
......
...@@ -92,7 +92,7 @@ public class AcsMain { ...@@ -92,7 +92,7 @@ public class AcsMain {
/**登录*/ /**登录*/
login_V40("192.168.0.111","admin","asd12345",(short)8000); login_V40("10.102.221.201","admin","10.102.221.201",(short)8000);
/**远程控门*/ /**远程控门*/
......
...@@ -53,13 +53,9 @@ public class DoorServiceImpl extends AbstractCRUDServiceImpl<DoorDao, DoorEntity ...@@ -53,13 +53,9 @@ public class DoorServiceImpl extends AbstractCRUDServiceImpl<DoorDao, DoorEntity
@Override @Override
public Rest<Void> syncDoorDeviceEvents(DoorEntity doorEntity, HikDoorEventReq hikDoorEventReq) { public Rest<Void> syncDoorDeviceEvents(DoorEntity doorEntity, HikDoorEventReq hikDoorEventReq) {
Rest<List<EventInfo>> listRest = hikDoorService.searchDoorEventsList(hikDoorEventReq, doorEntity); Rest<List<EventInfo>> listRest = hikDoorService.searchDoorEventsList(hikDoorEventReq, doorEntity);
if (listRest.getCode() == YesNoEnum.YES.getValue()) { if (listRest.getCode() == YesNoEnum.YES.getValue()) {
List<EventInfo> list = listRest.getData(); List<EventInfo> list = listRest.getData();
List<AttendanceRecordHikEntity> attRecords = list.stream().map(item -> { List<AttendanceRecordHikEntity> attRecords = list.stream().map(item -> {
AttendanceRecordHikEntity recordHikEntity = new AttendanceRecordHikEntity(); AttendanceRecordHikEntity recordHikEntity = new AttendanceRecordHikEntity();
recordHikEntity.initAttrValue(); recordHikEntity.initAttrValue();
......
...@@ -33,4 +33,21 @@ public interface IHikStaffService { ...@@ -33,4 +33,21 @@ public interface IHikStaffService {
/**
* 获取人员人脸信息
*
* @param personReq
* @return
*/
Rest<UserSearchInfo> getPersonPicByDevices(StaffReq personReq, DoorEntity doorEntity);
/**
* 下发图片到指定设备
*
* @param personReq
* @return
*/
Rest<UserSearchInfo> downPersonPicToDevice(StaffReq personReq, DoorEntity doorEntity);
} }
...@@ -202,4 +202,14 @@ public class HikStaffServiceImpl extends AbstractHikService implements IHikStaff ...@@ -202,4 +202,14 @@ public class HikStaffServiceImpl extends AbstractHikService implements IHikStaff
} }
} }
@Override
public Rest<UserSearchInfo> getPersonPicByDevices(StaffReq personReq, DoorEntity doorEntity) {
return null;
}
@Override
public Rest<UserSearchInfo> downPersonPicToDevice(StaffReq personReq, DoorEntity doorEntity) {
return null;
}
} }
...@@ -33,6 +33,7 @@ import com.mortals.xhx.module.staff.model.vo.StaffCheckAuthorizePdu; ...@@ -33,6 +33,7 @@ import com.mortals.xhx.module.staff.model.vo.StaffCheckAuthorizePdu;
import com.mortals.xhx.module.staff.model.vo.StaffInfoVo; import com.mortals.xhx.module.staff.model.vo.StaffInfoVo;
import com.mortals.xhx.module.staff.service.StaffService; import com.mortals.xhx.module.staff.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -70,6 +71,9 @@ public class StaffController extends BaseCRUDJsonBodyMappingController<StaffServ ...@@ -70,6 +71,9 @@ public class StaffController extends BaseCRUDJsonBodyMappingController<StaffServ
@Autowired @Autowired
private AttendanceLeaveRecordService leaveRecordService; private AttendanceLeaveRecordService leaveRecordService;
@Value("${hik.host:}")
protected String hikhost;
public StaffController() { public StaffController() {
super.setModuleDesc("员工基本信息"); super.setModuleDesc("员工基本信息");
...@@ -227,11 +231,15 @@ public class StaffController extends BaseCRUDJsonBodyMappingController<StaffServ ...@@ -227,11 +231,15 @@ public class StaffController extends BaseCRUDJsonBodyMappingController<StaffServ
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
String busiDesc = this.getModuleDesc() + "同步"; String busiDesc = this.getModuleDesc() + "同步";
try { try {
//同步部门 if (!ObjectUtils.isEmpty(hikhost)) {
deptService.syncDept(getContext()); //同步部门
Rest<Void> rest = this.service.syncPersons(getContext()); deptService.syncDept(getContext());
if (rest.getCode() == YesNoEnum.NO.getValue()) { Rest<Void> rest = this.service.syncPersons(getContext());
throw new AppException("同步异常!"); if (rest.getCode() == YesNoEnum.NO.getValue()) {
throw new AppException("同步异常!");
}
}else{
this.service.syncPersonsByDevices(null);
} }
recordSysLog(request, busiDesc + " 【成功】"); recordSysLog(request, busiDesc + " 【成功】");
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
......
...@@ -11,6 +11,12 @@ ...@@ -11,6 +11,12 @@
"baseLogin": "http://192.168.0.98:11078/base" "baseLogin": "http://192.168.0.98:11078/base"
}, },
"pengxi": {
"baseUrl": "http://10.102.252.13:11039/attendance",
"baseLogin": "http://192.168.0.98:11078/base"
},
"portal": { "portal": {
"baseUrl": "http://192.168.0.98:11072/zwfw", "baseUrl": "http://192.168.0.98:11072/zwfw",
"baseLogin": "http://192.168.0.98:11078/base" "baseLogin": "http://192.168.0.98:11078/base"
......
...@@ -146,3 +146,8 @@ Content-Type: application/json ...@@ -146,3 +146,8 @@ Content-Type: application/json
"windowNum": "123123" "windowNum": "123123"
} }
###设备直连更新人员
GET {{baseUrl}}/test/updatePersonsByDevices
Content-Type: application/json
{}
\ No newline at end of file
<?xml version="1.0" encoding="GB2312"?>
<SdkLocal>
<SdkLog>
<logLevel>3</logLevel><!--req, 1-ERROR, 2-DEBUG, 3-INFO-->
<logDirectory>./SDKLOG/</logDirectory><!--the end of the string must be '/'-->
<autoDelete>true</autoDelete><!--true: There are less than 10 files in the directory, it will be auto deleted by sdk when the files are more than 10; false: No upper limit to the number of log files-->
</SdkLog>
<HeartbeatCfg>
<Interval>120</Interval> <!-- 心跳时间间隔,单位秒,等于0,使用默认值120s,取值范围为[30, 120] 小于30s,间隔为30s,大于120s,间隔为120s-->
<Count>1</Count> <!-- 触发异常回调需要心跳交互异常的次数,等于0,使用默认值1次-->
</HeartbeatCfg>
</SdkLocal>
\ No newline at end of file
File added
File added
File added
File added
File added
【Demo内容说明】
-------------------------------------
1. 该Demo主要介绍以卡为中心的卡参数下发、人脸下发、指纹下发、人脸采集、事件查询等功能。
2. 该Demo使用Eclipse开发和编译运行。
【注意事项】
------------------------------------
1. 请到海康威视官网下载最新版本设备网络SDK:https://open.hikvision.com/download/5cda567cf47ae80dd41a54b3?type=10
2. 请修改程序代码,其中AcsMain.java中CreateSDKInstance()接口中指定SDK动态库的路径。此Demo在Win和Linux系统下通用,切换到Linux系统运行,CreateSDKInstance()接口中设置Linux系统SDK库文件路径。
3. Windows开发时需要将“库文件”文件夹中的HCNetSDK.dll、HCCore.dll、HCNetSDKCom文件夹、libssl-1_1-x64.dll、libcrypto-1_1-x64.dll、hlog.dll、hpr.dll、zlib1.dll等文件拷贝到lib文件夹下,HCNetSDKCom文件夹(包含里面的功能组件dll库文件)需要和HCNetSDK.dll、HCCore.dll一起加载,放在同一个目录下,且HCNetSDKCom文件夹名不能修改。如果自行开发软件不能正常实现相应功能,而且程序没有指定加载的dll库路径,请在程序运行的情况下尝试删除HCNetSDK.dll。如果可以删除,说明程序可能调用到系统盘Windows->System32目录下的dll文件,建议删除或者更新该目录下的相关dll文件;如果不能删除,dll文件右键选择属性确认SDK库版本。
4. Linux开发时需要将“库文件”文件夹中libhcnetsdk.so、libHCCore.so、libcrypto.so.1.1、libssl.so.1.1、libhpr.so、libz.so等文件拷贝到lib文件夹下。HCNetSDKCom文件夹(包含里面的功能组件dll库文件)需要和libhcnetsdk.so、libHCCore.so一起加载,放在同一个目录下,且HCNetSDKCom文件夹名不能修改。如果库文件加载有问题,初始化失败,也可以尝试将SDK所在路径添加到LD_LIBRARY_PATH环境变量中。
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment