Commit 9a162b73 authored by 赵啸非's avatar 赵啸非

修改蓬溪考勤记录获取时间段问题

parent 3a79cad0
...@@ -82,7 +82,7 @@ public class SyncDoorsEventTaskImpl implements ITaskExcuteService { ...@@ -82,7 +82,7 @@ public class SyncDoorsEventTaskImpl implements ITaskExcuteService {
} else { } else {
log.info("同步设备上门禁事件!"); log.info("同步设备上门禁事件!");
HikDoorEventReq hikDoorEventReq = new HikDoorEventReq(); HikDoorEventReq hikDoorEventReq = new HikDoorEventReq();
hikDoorEventReq.setStartTime(startTime.toJdkDate()); hikDoorEventReq.setStartTime(DateUtil.parseDate( startTime.toDateStr()).toJdkDate());
hikDoorEventReq.setEndTime(DateUtil.endOfDay(new Date())); hikDoorEventReq.setEndTime(DateUtil.endOfDay(new Date()));
List<DoorEntity> doorEntities = doorService.find(new DoorQuery()); List<DoorEntity> doorEntities = doorService.find(new DoorQuery());
for (DoorEntity doorEntity : doorEntities) { for (DoorEntity doorEntity : doorEntities) {
......
...@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime; ...@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
...@@ -26,11 +27,16 @@ import com.mortals.xhx.module.attendance.service.AttendanceRecordHikService; ...@@ -26,11 +27,16 @@ import com.mortals.xhx.module.attendance.service.AttendanceRecordHikService;
import com.mortals.xhx.module.dept.model.DeptEntity; import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery; import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService; import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.door.model.DoorEntity;
import com.mortals.xhx.module.door.model.DoorQuery;
import com.mortals.xhx.module.door.service.DoorService;
import com.mortals.xhx.module.hik.door.model.req.door.HikDoorEventReq;
import com.mortals.xhx.module.staff.model.StaffEntity; import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffQuery; import com.mortals.xhx.module.staff.model.StaffQuery;
import com.mortals.xhx.module.staff.service.StaffService; import com.mortals.xhx.module.staff.service.StaffService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StopWatch; import org.springframework.util.StopWatch;
...@@ -74,6 +80,11 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro ...@@ -74,6 +80,11 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro
private AttendanceClassService classService; private AttendanceClassService classService;
@Autowired @Autowired
private ICacheService cacheService; private ICacheService cacheService;
@Value("${hik.host:}")
protected String hikhost;
@Autowired
private DoorService doorService;
public AttendanceRecordHikController() { public AttendanceRecordHikController() {
super.setModuleDesc("考勤打卡记录汇总信息"); super.setModuleDesc("考勤打卡记录汇总信息");
...@@ -228,8 +239,20 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro ...@@ -228,8 +239,20 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro
stopWatch.start("执行本地方法"); stopWatch.start("执行本地方法");
hikEntity.setAttendanceDateStart(curDate.toDateStr()); hikEntity.setAttendanceDateStart(curDate.toDateStr());
hikEntity.setAttendanceDateEnd(curDate.toDateStr()); hikEntity.setAttendanceDateEnd(curDate.toDateStr());
hikService.syncDoorEvents(hikEntity); if (!ObjectUtils.isEmpty(hikhost)) {
hikService.deletFakeRecord(hikEntity, context); hikService.syncDoorEvents(hikEntity);
hikService.deletFakeRecord(hikEntity, context);
} else {
HikDoorEventReq hikDoorEventReq = new HikDoorEventReq();
hikDoorEventReq.setStartTime(DateUtil.parseDate(curDate.toDateStr()).toJdkDate());
hikDoorEventReq.setEndTime(DateUtil.endOfDay(new Date()));
log.info("同步设备上门禁事件!req==>{}", JSON.toJSONString(hikDoorEventReq));
List<DoorEntity> doorEntities = doorService.find(new DoorQuery());
for (DoorEntity doorEntity : doorEntities) {
doorService.syncDoorDeviceEvents(doorEntity, hikDoorEventReq);
}
this.service.deletFakeRecord(hikEntity, null);
}
stopWatch.stop(); stopWatch.stop();
log.info("考勤计算日期:{} 完成,耗时:{}ms", curDate.toDateStr(), stopWatch.getLastTaskTimeMillis()); log.info("考勤计算日期:{} 完成,耗时:{}ms", curDate.toDateStr(), stopWatch.getLastTaskTimeMillis());
} }
......
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