调整一个员工有多个打卡位置

This commit is contained in:
andy 2025-09-09 13:43:52 +08:00
parent ddb19b7759
commit 5f14fc2cf7
11 changed files with 54 additions and 27 deletions

View File

@ -78,7 +78,7 @@ public class RzAttendanceStatisticalController extends BaseController
/**
* 校正数据
*/
@PreAuthorize("@ss.hasPermi('attendance:statistics:correct')")
@PreAuthorize("@ss.hasPermi('attendance:statistical:correct')")
@RequestMapping(value = "correct")
public AjaxResult correct(@RequestBody RzAttendanceStatistical rzAttendanceStatistical)
{
@ -88,7 +88,7 @@ public class RzAttendanceStatisticalController extends BaseController
return rzAttendanceStatisticalService.autoCalculateTheDayBeforeAttendance(rzAttendanceStatistical.getMonth());
}
@PreAuthorize("@ss.hasPermi('attendance:statistics:import')")
@PreAuthorize("@ss.hasPermi('attendance:statistical:import')")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file) throws Exception
{

View File

@ -63,7 +63,9 @@ public interface PunchTheClockStrategyExchangeProcessor {
return "当前人员未注册打卡机";
}
//不是特殊打卡, 并且不是公共打卡, 并且当前打卡设备不是人员绑定设备
if(!sn.equals(com.evo.equipment.constant.Constants.EQ_DEVICE_OVER_TIME_CODE) && !sn.equals(com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE) && !sn.equals(sysStaff.getTimeClock())){
//&& !sn.equals(com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE)
//!sn.equals(sysStaff.getTimeClock())
if(!sn.equals(com.evo.equipment.constant.Constants.EQ_DEVICE_OVER_TIME_CODE) && !sysStaff.getTimeClockList().contains(sn)){
return "未设置当前考勤机打卡权限";
}
//是特殊打卡 并且 特殊打卡人员中, 不包含当前人员

View File

@ -27,7 +27,6 @@ import com.evo.system.mapper.SysStaffMapper;
import com.evo.wechat.service.SendClientService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -89,7 +88,9 @@ public class KQDeviceExchangeProcessor implements PunchTheClockStrategyExchangeP
return initMessage(1,"当前人员未注册打卡机", "000000000");
}
//当前设备不是公共打卡机, 并且
if(!sn.equals(com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE) && !sn.equals(sysStaff.getTimeClock())){
//!sn.equals(com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE) &&
//!sn.equals(sysStaff.getTimeClock())
if(!sysStaff.getTimeClockList().contains(sn)){
return initMessage(1,"未设置当前考勤机打卡权限", "000000000");
}
//检查当前打卡人是不是月薪, 如果是月薪 并且当天没有打卡, 则显示上班卡, 否则显示下班卡

View File

@ -105,14 +105,14 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
if(rzAttendance.getWorkEndTime() == null){
//跟新成功, 插入上班卡信息
if(getBaseMapper().updateRzAttendance(rzAttendance) > 0){
rzAttendanceDetailService.addOrUpdateDetail("fill_in", rzAttendance, rzAttendance.getRules(), sysUser.getTimeClock(), rzAttendance.getWorkStartTime(),rzAttendance.getRemark());
rzAttendanceDetailService.addOrUpdateDetail("fill_in", rzAttendance, rzAttendance.getRules(), sysUser.getTimeClockList().get(0), rzAttendance.getWorkStartTime(),rzAttendance.getRemark());
}
return 1;
}else if(rzAttendance.getWorkStartTime() != null && rzAttendance.getWorkEndTime() != null){
rzAttendanceDetailService.addOrUpdateDetail("fill_in",rzAttendance, rzAttendance.getRules(), sysUser.getTimeClock(), rzAttendance.getWorkStartTime(),rzAttendance.getRemark());
rzAttendanceDetailService.addOrUpdateDetail("fill_in",rzAttendance, rzAttendance.getRules(), sysUser.getTimeClockList().get(0), rzAttendance.getWorkStartTime(),rzAttendance.getRemark());
if(KqUtils.workOffDutyCard(rzAttendance.getWorkEndTime(), rzAttendance.getRules(), rzAttendance)){
//此处特殊, 使用rules 记录下班卡规则, 但是不持久化
rzAttendanceDetailService.addOrUpdateDetail("fill_in",rzAttendance, "下班卡", sysUser.getTimeClock(), rzAttendance.getWorkEndTime(),rzAttendance.getRemark());
rzAttendanceDetailService.addOrUpdateDetail("fill_in",rzAttendance, "下班卡", sysUser.getTimeClockList().get(0), rzAttendance.getWorkEndTime(),rzAttendance.getRemark());
}
return 1;
}

View File

@ -18,7 +18,7 @@ public class Constants
*/
public static final String EQ_DEVICE_CODE = "T71474"; //餐饮打卡机设备号
/***
* 公共打卡机
* 公共打卡机 2025-9-06, 公共打卡机装备到南区, 取消公共打卡机
*/
public static final String EQ_DEVICE_PUBLIC_CODE = "ET74333"; //公共打卡机
public static final String STAFF_IMAGE_URL_OVER_TIME = "http://192.168.5.12:8088/image/";//打卡人员图片存服务器获取地址

View File

@ -114,7 +114,7 @@ public class EqImagesServiceImpl implements IEqImagesService
//定义公共打卡机
List<String> dkj_list = new ArrayList<String>();
dkj_list.add(Constants.EQ_DEVICE_CODE); //食堂
dkj_list.add(Constants.EQ_DEVICE_PUBLIC_CODE); //公共
// dkj_list.add(Constants.EQ_DEVICE_PUBLIC_CODE); //公共
dkj_list.add(eqImages.getTimeClock());
for (String s : dkj_list) {
@ -266,7 +266,7 @@ public class EqImagesServiceImpl implements IEqImagesService
if(StringUtils.isNotNull(row)){
dkj_list = new ArrayList<String>();
dkj_list.add(Constants.EQ_DEVICE_CODE); //食堂
dkj_list.add(Constants.EQ_DEVICE_PUBLIC_CODE); //公共
// dkj_list.add(Constants.EQ_DEVICE_PUBLIC_CODE); //公共
dkj_list.add(row.getCell(4).getStringCellValue());
cau = new StaffDto();
caud = new StaffData();

View File

@ -115,8 +115,8 @@ public class EqSnDetailServiceImpl extends ServiceImpl<EqSnDetailMapper, EqSnDet
public EqSnDetail selectEqSnDetailBySn(String sn){
return getBaseMapper().selectEqSnDetailBySn(sn);
}
static List<String> tsSn = Collections.asList(com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE,com.evo.equipment.constant.Constants.EQ_DEVICE_CODE,com.evo.equipment.constant.Constants.EQ_DEVICE_OVER_TIME_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);
private List<Map<String, String>> getPhoto(List<SysStaff> userList){
List<Map<String, String>> userPhotoList = Collections.emptyList();
@ -141,7 +141,8 @@ public class EqSnDetailServiceImpl extends ServiceImpl<EqSnDetailMapper, EqSnDet
if(tsSn.contains(deviceSn)) {
List<Map<String, String>> userPhotoList = Collections.emptyList();
List<SysStaff> userList = Collections.emptyList();
if (deviceSn.equals(com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE) || deviceSn.equals(com.evo.equipment.constant.Constants.EQ_DEVICE_CODE)) {
//deviceSn.equals(com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE) ||
if (deviceSn.equals(com.evo.equipment.constant.Constants.EQ_DEVICE_CODE)) {
//获取所有未删除的, 没有离职的员工信息
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));
}
@ -174,14 +175,14 @@ public class EqSnDetailServiceImpl extends ServiceImpl<EqSnDetailMapper, EqSnDet
//公共打卡机不需要检查
if(!WebSocketUsers.getUsers().containsKey(device.getSessionId())){
//如果不是公共打开机, 返回信息
if(!com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE.equals(device.getSn())){
// if(!com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE.equals(device.getSn())){
errorMsg.append("设备"+device.getSn()+"已经失去连接;");
device.setType("连接已断开");
loseDeviceList.add(device);
}else{
//如果是公共打开机, snList清除公共打开机的数据
snList.remove(com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE);
}
// }else{
// //如果是公共打开机, snList清除公共打开机的数据
// snList.remove(com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE);
// }
}
sessionMap.put(device.getSn(), WebSocketUsers.getUsers().get(device.getSessionId()));
}
@ -209,7 +210,7 @@ public class EqSnDetailServiceImpl extends ServiceImpl<EqSnDetailMapper, EqSnDet
snList.remove(tsDeviceSn);
snList.stream().filter(sn-> !tsSn.contains(sn)).forEach(sn ->{
//获取所有未删除的, 没有离职的员工信息
List<SysStaff> userList = sysStaffMapper.selectList((new LambdaQueryWrapper<SysStaff>().eq(SysStaff::getTimeClock, sn).eq(SysStaff::getDelFlag, Constants.DELETE_FLAG_0).ne(SysStaff::getStatus,Constants.JOB_STATIS_11).select(SysStaff::getUserId, SysStaff::getDeptId, SysStaff::getName)));
List<SysStaff> userList = sysStaffMapper.selectList((new LambdaQueryWrapper<SysStaff>().like(SysStaff::getTimeClock, sn).eq(SysStaff::getDelFlag, Constants.DELETE_FLAG_0).ne(SysStaff::getStatus,Constants.JOB_STATIS_11).select(SysStaff::getUserId, SysStaff::getDeptId, SysStaff::getName)));
snUserPhotoList.put(sn, getPhoto(userList));
});
//装载特殊的打卡机

View File

@ -77,7 +77,7 @@ public class RzOverTimeDetailServiceImpl implements IRzOverTimeDetailService
jbk.setDateTime(rzOverTimeDetail.getOverTimeStart());
jbk.setDelFlag(Constants.DELETE_FLAG_0);
jbk.setStaffId(rzOverTime.getUserId());
jbk.setEquipmentCode(sysStaff.getTimeClock());
jbk.setEquipmentCode(sysStaff.getTimeClockList().get(0));
jbk.setCreateTime(new Date());
jbk.setRemark("加班补卡生成");
rzAttendanceDetailMapper.insert(jbk);
@ -97,7 +97,7 @@ public class RzOverTimeDetailServiceImpl implements IRzOverTimeDetailService
jbk.setDateTime(rzOverTimeDetail.getOverTimeEnd());
jbk.setDelFlag(Constants.DELETE_FLAG_0);
jbk.setStaffId(rzOverTime.getUserId());
jbk.setEquipmentCode(sysStaff.getTimeClock());
jbk.setEquipmentCode(sysStaff.getTimeClockList().get(0));
jbk.setCreateTime(new Date());
jbk.setRemark("加班补卡生成");
rzAttendanceDetailMapper.insert(jbk);
@ -180,7 +180,7 @@ public class RzOverTimeDetailServiceImpl implements IRzOverTimeDetailService
rzOverTimeDetail.setUpdateTime(DateUtils.getNowDate());
rzOverTimeDetail.setUpdateBy(SecurityUtils.getUsername());
//计算加班时间
KqUtils.calculateOverTimeHours(rzOverTimeDetail, sysStaff.getUserId(), sysStaff.getTimeClock());
KqUtils.calculateOverTimeHours(rzOverTimeDetail, sysStaff.getUserId(), sysStaff.getTimeClockList().get(0));
int i = rzOverTimeDetailMapper.updateRzOverTimeDetail(rzOverTimeDetail);
if(i < 1){

View File

@ -198,6 +198,8 @@ public class SysStaff extends BaseEntity
* 打卡位置
*/
private String timeClock;
@TableField(exist = false)
private List<String> timeClockList;
/***
* 公众号的openId
@ -219,4 +221,11 @@ public class SysStaff extends BaseEntity
}
return subsidyList;
}
public List<String> getTimeClockList() {
if(Collections.isEmpty(timeClockList) && StringUtils.isNotEmpty(timeClock)){
timeClockList = Collections.asList(timeClock.split(",")).stream().collect(Collectors.toList());
}
return timeClockList;
}
}

View File

@ -93,6 +93,9 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
if(StringUtils.isNotEmpty(sysStaff.getSubsidys())){
sysStaff.setSubsidyList(Collections.asList(sysStaff.getSubsidys().split(",")).stream().map(Long::valueOf).collect(Collectors.toList()));
}
if(StringUtils.isNotEmpty(sysStaff.getTimeClock())){
sysStaff.setTimeClockList(Collections.asList(sysStaff.getTimeClock().split(",")).stream().collect(Collectors.toList()));
}
return sysStaff;
}
/**
@ -149,6 +152,10 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
if(CollectionUtils.isNotEmpty(sysStaff.getSubsidyList())){
sysStaff.setSubsidys(sysStaff.getSubsidyList().stream().map(String::valueOf).collect(Collectors.joining(",")));
}
//打卡位置改为多选
if(CollectionUtils.isNotEmpty(sysStaff.getTimeClockList())){
sysStaff.setTimeClock(sysStaff.getTimeClockList().stream().collect(Collectors.joining(",")));
}
int i = getBaseMapper().insertSysStaff(sysStaff);
if(i < 1){
@ -195,10 +202,12 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
if(upload != null){
List<String> dkj_list = new ArrayList<String>();
dkj_list.add(com.evo.equipment.constant.Constants.EQ_DEVICE_CODE); //食堂
dkj_list.add(com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE); //公共
dkj_list.add(sysStaff.getTimeClock());
// dkj_list.add(com.evo.equipment.constant.Constants.EQ_DEVICE_PUBLIC_CODE); //公共
dkj_list.addAll(sysStaff.getTimeClockList());
// dkj_list.add(sysStaff.getTimeClockList().get(1));
//下发照片
eqSnDetailService.sendPhoto(dkj_list, Collections.asList(Collections.asMap("userId", String.valueOf(sysStaff.getUserId()), "name", sysStaff.getName(), "photoUrl", ParamUtils.getGlobalStaticUrl()+upload.getFileName(), "deptName", sysStaff.getDeptName())));
SysDept sysDept = deptMapper.selectDeptById(sysStaff.getDeptId());
eqSnDetailService.sendPhoto(dkj_list, Collections.asList(Collections.asMap("userId", String.valueOf(sysStaff.getUserId()), "name", sysStaff.getName(), "photoUrl", ParamUtils.getGlobalStaticUrl()+upload.getFileName(), "deptName", sysDept.getDeptName())));
}
}
@ -233,6 +242,11 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
if(CollectionUtils.isNotEmpty(sysStaff.getSubsidyList())){
sysStaff.setSubsidys(sysStaff.getSubsidyList().stream().map(String::valueOf).collect(Collectors.joining(",")));
}
//打卡位置改为多选
if(CollectionUtils.isNotEmpty(sysStaff.getTimeClockList())){
sysStaff.setTimeClock(sysStaff.getTimeClockList().stream().collect(Collectors.joining(",")));
}
//判断是否有离职时间有则为离职
if(StringUtils.isNotNull(sysStaff.getQuitDate())){
//离职时间小于当前,说明离职了

View File

@ -50,7 +50,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
active: ${profiles.active:druid}
# 文件上传
servlet:
multipart: