| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.google.common.util.concurrent.AtomicDouble; |
| | | import com.ruoyi.common.core.domain.entity.SysDictData; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.enums.*; |
| | | import com.ruoyi.common.utils.api.icc.IccApiUtil; |
| | | import com.ruoyi.common.utils.api.icc.model.GetResultPageRequest; |
| | | import com.ruoyi.common.utils.api.icc.model.GetResultPageResponse; |
| | | |
| | | import com.ruoyi.performance.dto.PerformanceShiftMapDto; |
| | | import com.ruoyi.performance.dto.StaffAttendanceDTO; |
| | | import com.ruoyi.performance.excel.StaffAttendanceAnnotationTextExcelData; |
| | | import com.ruoyi.performance.excel.StaffAttendanceExcelData; |
| | | import com.ruoyi.performance.excel.handler.attendance.CommentWriteHandler; |
| | | import com.ruoyi.performance.mapper.StaffAttendanceTrackingRecordMapper; |
| | | import com.ruoyi.performance.pojo.StaffAttendanceTrackingRecord; |
| | | import com.ruoyi.performance.service.StaffAttendanceTrackingRecordService; |
| | | import com.ruoyi.performance.dto.PerformanceShiftMapDto; |
| | | import com.ruoyi.performance.mapper.PerformanceShiftMapper; |
| | | import com.ruoyi.performance.mapper.ShiftTimeMapper; |
| | | import com.ruoyi.performance.mapper.StaffAttendanceTrackingRecordMapper; |
| | | import com.ruoyi.performance.pojo.ShiftTime; |
| | | import com.ruoyi.performance.pojo.StaffAttendanceTrackingRecord; |
| | | import com.ruoyi.performance.service.StaffAttendanceTrackingRecordService; |
| | | import com.ruoyi.performance.utils.HourDiffCalculator; |
| | | import com.ruoyi.performance.utils.TimeDiffCalculator; |
| | | import com.ruoyi.performance.vo.StaffAttendanceVO; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | private IccApiUtil iccApiUtil; |
| | | |
| | | @Autowired |
| | | private ISysDictTypeService sysDictTypeService; |
| | | |
| | | @Autowired |
| | | private PerformanceShiftMapper performanceShiftMapper; |
| | | |
| | | @Autowired |
| | |
| | | private static final String maternityLeaveKeyword = "产";//产假班次关键字 |
| | | |
| | | /** |
| | | * 同步的门禁设备列表 |
| | | * channel_name device_code |
| | | * 10.100.22.2_门禁通道_1 1001538 |
| | | * 10.100.22.3_门禁通道_1 1001539 |
| | | * 10.100.22.4_门禁通道_1 1001540 |
| | | * 10.100.22.5_门禁通道_1 1001541 |
| | | * 10.100.22.12_门禁通道_1 1001626 |
| | | * 10.100.22.13_门禁通道_1 1001627 |
| | | * 10.100.22.14_门禁通道_1 1001628 |
| | | * 10.100.22.15_门禁通道_1 1001629 |
| | | */ |
| | | private final static List<String> syncDeviceCode = Arrays.asList("1001538", "1001539", "1001540", "1001541", |
| | | "1001626", "1001627", "1001628", "1001629"); |
| | | |
| | | /** |
| | | * 上班时间判定边界小时数 |
| | | */ |
| | | private final static long WORK_TIME_BOUNDARY = 2L; |
| | |
| | | if (ObjectUtil.isAllEmpty(startDate, endDate)) { |
| | | throw new RuntimeException("同步日期不能为空"); |
| | | } |
| | | |
| | | //查询门禁设备字典列表 |
| | | List<SysDictData> performanceIccDevice = sysDictTypeService.selectDictDataByType("performance_icc_device"); |
| | | Set<String> syncDeviceCode = performanceIccDevice.stream().map(SysDictData::getDictValue).collect(Collectors.toSet()); |
| | | // 查询已同步的记录 |
| | | List<Long> trackingRecordIccIdList = baseMapper.selectIccIdList(); |
| | | try { |
| | |
| | | public static String restorePersonCode(Object number) { |
| | | // 1. 空值校验 |
| | | if (number == null) { |
| | | throw new IllegalArgumentException("传入数字不能为空"); |
| | | return ""; |
| | | } |
| | | |
| | | String original = number.toString(); |
| | | try { |
| | | // 2. 统一转换为字符串并去除首尾空格 |
| | | String numStr = number.toString().trim(); |
| | | String numStr = original.trim(); |
| | | |
| | | // 3. 校验是否为纯数字(排除负数、非数字字符) |
| | | if (!numStr.matches("\\d+")) { |
| | | throw new IllegalArgumentException("传入的不是有效正整数:" + numStr); |
| | | } |
| | | String digitStr; |
| | | if (numStr.matches("\\d+")) { |
| | | digitStr = numStr; |
| | | } else if (numStr.matches("(?i)^ZT\\d+$")) { |
| | | digitStr = numStr.substring(2); |
| | | } else if (numStr.matches("(?i)^ZT-\\d+$")) { |
| | | digitStr = numStr.substring(3); |
| | | } else { |
| | | return original; |
| | | } |
| | | |
| | | // 4. 补前置0到指定长度(6位),超出则保留原数字 |
| | | String paddedNum = String.format("%0" + DIGIT_LENGTH + "d", Long.parseLong(numStr)); |
| | | String paddedNum = StringUtils.leftPad(digitStr, DIGIT_LENGTH, '0'); |
| | | |
| | | // 5. 拼接前缀返回 |
| | | return PREFIX + paddedNum; |
| | | return PREFIX + paddedNum; |
| | | } catch (Exception e) { |
| | | return original; |
| | | } |
| | | } |
| | | |
| | | } |