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

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

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