多加班打开机调整

This commit is contained in:
andy 2025-11-01 11:29:13 +08:00
parent b2de42d99a
commit ba4332b4ce
6 changed files with 37 additions and 18 deletions

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.evo.attendance.domain.vo.RzAttendanceData; import com.evo.attendance.domain.vo.RzAttendanceData;
import com.evo.attendance.domain.vo.RzAttendanceVo; import com.evo.attendance.domain.vo.RzAttendanceVo;
import com.evo.common.constant.Constants; import com.evo.common.constant.Constants;
import com.evo.common.utils.ParamUtils;
import com.evo.common.utils.StringUtils; import com.evo.common.utils.StringUtils;
import com.evo.common.utils.spring.SpringUtils; import com.evo.common.utils.spring.SpringUtils;
import com.evo.personnelMatters.domain.EqOverStaff; import com.evo.personnelMatters.domain.EqOverStaff;
@ -65,11 +66,11 @@ public interface PunchTheClockStrategyExchangeProcessor {
//不是特殊打卡, 并且不是公共打卡, 并且当前打卡设备不是人员绑定设备 //不是特殊打卡, 并且不是公共打卡, 并且当前打卡设备不是人员绑定设备
//&& !sn.equals(com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE) //&& !sn.equals(com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE)
//!sn.equals(sysStaff.getTimeClock()) //!sn.equals(sysStaff.getTimeClock())
if(!sn.equals(com.evo.equipment.constant.Constants.EQ_DEVICE_OVER_TIME_CODE) && !sysStaff.getTimeClockList().contains(sn)){ if(!ParamUtils.getTsDevSn().contains(sn) && !sysStaff.getTimeClockList().contains(sn)){
return "未设置当前考勤机打卡权限"; return "未设置当前考勤机打卡权限";
} }
//是特殊打卡 并且 特殊打卡人员中, 不包含当前人员 //是特殊打卡 并且 特殊打卡人员中, 不包含当前人员
if(sn.equals(com.evo.equipment.constant.Constants.EQ_DEVICE_OVER_TIME_CODE) && StringUtils.isNull(SpringUtils.getBean(EqOverStaffMapper.class).selectEqOverStaffByUserId(sysStaff.getUserId()))){ if(ParamUtils.getTsDevSn().contains(sn) && StringUtils.isNull(SpringUtils.getBean(EqOverStaffMapper.class).selectEqOverStaffByUserId(sysStaff.getUserId()))){
return "未设置当前考勤机打卡权限"; return "未设置当前考勤机打卡权限";
} }
return ""; return "";

View File

@ -9,10 +9,7 @@ import com.evo.attendance.processor.PunchTheClockStrategyExchangeProcessor;
import com.evo.attendance.service.RzAttendanceDetailService; import com.evo.attendance.service.RzAttendanceDetailService;
import com.evo.common.constant.Constants; import com.evo.common.constant.Constants;
import com.evo.common.core.domain.entity.SysDept; import com.evo.common.core.domain.entity.SysDept;
import com.evo.common.utils.Collections; import com.evo.common.utils.*;
import com.evo.common.utils.DataUtils;
import com.evo.common.utils.DateUtils;
import com.evo.common.utils.StringUtils;
import com.evo.equipment.mapper.EqButtonMapper; import com.evo.equipment.mapper.EqButtonMapper;
import com.evo.personnelMatters.domain.RzOverTime; import com.evo.personnelMatters.domain.RzOverTime;
import com.evo.personnelMatters.domain.RzOverTimeDetail; import com.evo.personnelMatters.domain.RzOverTimeDetail;
@ -69,8 +66,8 @@ public class KQDeviceExchangeProcessor implements PunchTheClockStrategyExchangeP
@Override @Override
public boolean accept(String sn) { public boolean accept(String sn) {
//餐饮打卡机不下发按钮 //考勤打卡机不下发按钮
return !com.evo.equipment.constant.Constants.EQ_DEVICE_OVER_TIME_CODE.equals(sn); return !ParamUtils.getTsDevSn().contains(sn);
} }
@Override @Override

View File

@ -56,7 +56,7 @@ public class TSDeviceExchangeProcessor implements PunchTheClockStrategyExchangeP
@Override @Override
public boolean accept(String sn) { public boolean accept(String sn) {
return com.evo.equipment.constant.Constants.EQ_DEVICE_OVER_TIME_CODE.equals(sn); return ParamUtils.getTsDevSn().contains(sn);
} }
@Override @Override

View File

@ -157,6 +157,16 @@ public class ParamUtils {
RzSysParam param= paramService.getRzSysParam("需要自动计算请假时长的请假类型", "auto_calculation_holiday_type","54,56,57,58,59","需要自动计算请假时长的请假类型, 多个参数使用,隔开"); RzSysParam param= paramService.getRzSysParam("需要自动计算请假时长的请假类型", "auto_calculation_holiday_type","54,56,57,58,59","需要自动计算请假时长的请假类型, 多个参数使用,隔开");
return Collections.asList(param.getParamValue().split(",")); return Collections.asList(param.getParamValue().split(","));
} }
/***
* 获取那些请假类型需要自动计算请假时长
* @return
*/
public static List<String> getTsDevSn(){
RzSysParam param= paramService.getRzSysParam("获取特殊类型的打卡机型号", "ts_device_sn","ET74336,ET74335","获取特殊类型的打卡机型号, 多个参数使用,隔开");
return Collections.asList(param.getParamValue().split(","));
}
/*** /***
* 检查特殊打卡机的规则 * 检查特殊打卡机的规则
* sn 设备号 * sn 设备号

View File

@ -27,8 +27,11 @@ import com.evo.system.mapper.SysStaffMapper;
import com.evo.system.service.RzUploadService; import com.evo.system.service.RzUploadService;
import com.evo.system.service.impl.SysDeptServiceImpl; import com.evo.system.service.impl.SysDeptServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.websocket.Session; import javax.websocket.Session;
import java.util.ArrayList; import java.util.ArrayList;
@ -43,7 +46,7 @@ import java.util.stream.Collectors;
* @date 2024-08-07 * @date 2024-08-07
*/ */
@Service @Service
public class EqSnDetailServiceImpl extends ServiceImpl<EqSnDetailMapper, EqSnDetail> implements IEqSnDetailService public class EqSnDetailServiceImpl extends ServiceImpl<EqSnDetailMapper, EqSnDetail> implements IEqSnDetailService, ApplicationRunner
{ {
@Resource @Resource
private SysStaffMapper sysStaffMapper; private SysStaffMapper sysStaffMapper;
@ -116,7 +119,7 @@ public class EqSnDetailServiceImpl extends ServiceImpl<EqSnDetailMapper, EqSnDet
return getBaseMapper().selectEqSnDetailBySn(sn); return getBaseMapper().selectEqSnDetailBySn(sn);
} }
//com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE, //com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE,
static List<String> tsSn = Collections.asList(com.evo.equipment.constant.Constants.EQ_DEVICE_CODE,com.evo.equipment.constant.Constants.EQ_DEVICE_OVER_TIME_CODE); static List<String> tsSn = Collections.asList(com.evo.equipment.constant.Constants.EQ_DEVICE_CODE);
private List<Map<String, String>> getPhoto(List<SysStaff> userList){ private List<Map<String, String>> getPhoto(List<SysStaff> userList){
List<Map<String, String>> userPhotoList = Collections.emptyList(); List<Map<String, String>> userPhotoList = Collections.emptyList();
@ -147,7 +150,7 @@ public class EqSnDetailServiceImpl extends ServiceImpl<EqSnDetailMapper, EqSnDet
userList = sysStaffMapper.selectList(new LambdaQueryWrapper<SysStaff>().eq(SysStaff::getDelFlag, Constants.DELETE_FLAG_0).ne(SysStaff::getStatus, Constants.JOB_STATIS_11).select(SysStaff::getUserId, SysStaff::getDeptId, SysStaff::getName)); userList = sysStaffMapper.selectList(new LambdaQueryWrapper<SysStaff>().eq(SysStaff::getDelFlag, Constants.DELETE_FLAG_0).ne(SysStaff::getStatus, Constants.JOB_STATIS_11).select(SysStaff::getUserId, SysStaff::getDeptId, SysStaff::getName));
} }
//加班打卡机 //加班打卡机
if (deviceSn.equals(com.evo.equipment.constant.Constants.EQ_DEVICE_OVER_TIME_CODE)) { if (ParamUtils.getTsDevSn().contains(deviceSn)) {
List<Long> userIds = eqOverStaffMapper.selectList(new LambdaQueryWrapper<EqOverStaff>().eq(EqOverStaff::getDelFlag, Constants.DELETE_FLAG_0).select(EqOverStaff::getUserId)).stream().map(EqOverStaff::getUserId).collect(Collectors.toList()); List<Long> userIds = eqOverStaffMapper.selectList(new LambdaQueryWrapper<EqOverStaff>().eq(EqOverStaff::getDelFlag, Constants.DELETE_FLAG_0).select(EqOverStaff::getUserId)).stream().map(EqOverStaff::getUserId).collect(Collectors.toList());
userList = sysStaffMapper.selectList((new LambdaQueryWrapper<SysStaff>().in(SysStaff::getUserId, userIds).eq(SysStaff::getDelFlag, Constants.DELETE_FLAG_0).ne(SysStaff::getStatus, Constants.JOB_STATIS_11).select(SysStaff::getUserId, SysStaff::getDeptId, SysStaff::getName))); userList = sysStaffMapper.selectList((new LambdaQueryWrapper<SysStaff>().in(SysStaff::getUserId, userIds).eq(SysStaff::getDelFlag, Constants.DELETE_FLAG_0).ne(SysStaff::getStatus, Constants.JOB_STATIS_11).select(SysStaff::getUserId, SysStaff::getDeptId, SysStaff::getName)));
} }
@ -300,4 +303,9 @@ public class EqSnDetailServiceImpl extends ServiceImpl<EqSnDetailMapper, EqSnDet
public void checkDevice(String sessionId) { public void checkDevice(String sessionId) {
update(new UpdateWrapper<EqSnDetail>().set("type","连接已断开").set("session_id","").eq( "session_id", sessionId)); update(new UpdateWrapper<EqSnDetail>().set("type","连接已断开").set("session_id","").eq( "session_id", sessionId));
} }
@Override
public void run(ApplicationArguments args) throws Exception {
tsSn.addAll(ParamUtils.getTsDevSn());
}
} }

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.evo.common.core.controller.BaseController; import com.evo.common.core.controller.BaseController;
import com.evo.common.core.domain.AjaxResult; import com.evo.common.core.domain.AjaxResult;
import com.evo.common.core.page.TableDataInfo; import com.evo.common.core.page.TableDataInfo;
import com.evo.common.utils.ParamUtils;
import com.evo.equipment.constant.Constants; import com.evo.equipment.constant.Constants;
import com.evo.equipment.domain.vo.StaffData; import com.evo.equipment.domain.vo.StaffData;
import com.evo.equipment.domain.vo.StaffDto; import com.evo.equipment.domain.vo.StaffDto;
@ -133,8 +134,6 @@ public class SpecialOverTimeController extends BaseController {
cau.setCmd("to_device"); cau.setCmd("to_device");
//无用值空串 //无用值空串
cau.setForm(""); cau.setForm("");
//设备号
cau.setTo(Constants.EQ_DEVICE_OVER_TIME_CODE);
//给服务端预留的补充字段设备端不处理这个字段内容设备在响应这条指令时原样返回 //给服务端预留的补充字段设备端不处理这个字段内容设备在响应这条指令时原样返回
cau.setExtra(""); cau.setExtra("");
//发送的数据 //发送的数据
@ -149,10 +148,14 @@ public class SpecialOverTimeController extends BaseController {
caud.setPhone(""); caud.setPhone("");
caud.setMode(0); caud.setMode(0);
cau.setData(caud); cau.setData(caud);
//Java对象转换成JSON字符串 for (String sn : ParamUtils.getTsDevSn()){
message = JSONObject.toJSONString(cau); //设备号
//调用websocket推送给设备 cau.setTo(Constants.EQ_DEVICE_OVER_TIME_CODE);
WebSocketUsers.sendMessageToUsersByText(message); //Java对象转换成JSON字符串
message = JSONObject.toJSONString(cau);
//调用websocket推送给设备
WebSocketUsers.sendMessageToUsersByText(message);
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }