修改定时任务bug
This commit is contained in:
parent
51e4216ba0
commit
9fd8c803ff
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.system.job.equipment;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
||||
import cn.iocoder.yudao.framework.websocket.core.session.WebSocketSessionManager;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.equipment.AttendanceMachineDO;
|
||||
@ -32,18 +33,15 @@ public class AttendanceMachineJob {
|
||||
// 获得所有在线的设备
|
||||
List<AttendanceMachineDO> attendanceMachineDOS = attendanceMachineService.getListByStatus();
|
||||
for (AttendanceMachineDO reqDO : attendanceMachineDOS) {
|
||||
|
||||
// redis数据不存在,则为离线状态
|
||||
if (stringRedisTemplate.opsForValue().get(reqDO.getDeviceNo()) == null) {
|
||||
|
||||
String data = stringRedisTemplate.opsForValue().get(reqDO.getDeviceNo());
|
||||
if (StrUtil.isEmpty(data)) {
|
||||
attendanceMachineService.updateAttendanceMachineStatus(reqDO.getDeviceNo(), 0, null);
|
||||
|
||||
//同步 删除对应sessionId
|
||||
WebSocketSessionManager webSocketSessionManager = SpringContentUtils.getBean(WebSocketSessionManager.class);
|
||||
webSocketSessionManager.removeSession(webSocketSessionManager.getSessionByDeviceNum(reqDO.getDeviceNo()));
|
||||
}else {
|
||||
|
||||
attendanceMachineService.updateAttendanceMachineStatus(reqDO.getDeviceNo(), 1, stringRedisTemplate.opsForValue().get(reqDO.getDeviceNo()));
|
||||
} else {
|
||||
attendanceMachineService.updateAttendanceMachineStatus(reqDO.getDeviceNo(), 1, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ public class AttendanceServiceImpl implements AttendanceService {
|
||||
JSONObject data = JSONUtil.parseObj(o);
|
||||
data.forEach((k, v) -> {
|
||||
JSONObject item = JSONUtil.parseObj(v);
|
||||
map.put(item.get("date").toString(), item.get("isOffDay").toString());
|
||||
map.put(item.get("date").toString(), item.get("holiday").toString());
|
||||
});
|
||||
stringRedisTemplate.opsForHash().putAll(key, map);
|
||||
// -- 删除去年的
|
||||
|
@ -111,10 +111,9 @@ public class AttendanceMachineServiceImpl implements AttendanceMachineService {
|
||||
|
||||
@Override
|
||||
public void updateAttendanceMachineStatus(String deviceNo, Integer status, String dateTime) {
|
||||
|
||||
AttendanceMachineDO updateDO = new AttendanceMachineDO();
|
||||
updateDO.setStatus(status);
|
||||
updateDO.setUpdater(getLoginUserId().toString());
|
||||
// updateDO.setUpdater(getLoginUserId().toString());
|
||||
if (status == 1) {
|
||||
updateDO.setRequestTime(LocalDateTime.parse(dateTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
}
|
||||
@ -130,7 +129,7 @@ public class AttendanceMachineServiceImpl implements AttendanceMachineService {
|
||||
if (attendanceMachineDO == null) {
|
||||
|
||||
throw exception(ATTENDANCE_MACHINE_NOT_EXISTS);
|
||||
}else {
|
||||
} else {
|
||||
|
||||
if (!passwordEncoder.matches(updateReqVO.getOldPassword(), attendanceMachineDO.getPassword())) {
|
||||
|
||||
@ -221,7 +220,7 @@ public class AttendanceMachineServiceImpl implements AttendanceMachineService {
|
||||
|
||||
deviceNo = new ArrayList<>();
|
||||
deviceNo.add(addReqVO.getDeviceNo());
|
||||
}else {
|
||||
} else {
|
||||
|
||||
if (!deviceNo.contains(addReqVO.getDeviceNo())) {
|
||||
|
||||
@ -232,7 +231,7 @@ public class AttendanceMachineServiceImpl implements AttendanceMachineService {
|
||||
//设备 用户绑定设备
|
||||
data.setAttendanceMachineNos(deviceNo);
|
||||
});
|
||||
}else if (addReqVO.getMethod() == 1) {
|
||||
} else if (addReqVO.getMethod() == 1) {
|
||||
|
||||
usersExtDO.forEach(data -> {
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
SELECT
|
||||
a.id,
|
||||
a.util,
|
||||
a.assets_no,
|
||||
a.item_json,
|
||||
a.name,
|
||||
a.amount,
|
||||
|
Loading…
Reference in New Issue
Block a user