当前位置: 首页 > wzjs >正文

怎么用腾讯云主机建设网站长沙传媒公司招聘信息

怎么用腾讯云主机建设网站,长沙传媒公司招聘信息,淘宝客有必须做网站吗,site网站连通率0%怎么解决此篇主要用于记录Excel一行中,单条数据的日期拿取,并判断上下班打卡情况。代码可能满足不了大部分需求,目前只够本公司用,如果需要,可以参考。 需要把飞书月度汇总的考勤表导入系统中可以参考下。 下图为需要获取的年…

此篇主要用于记录Excel一行中,单条数据的日期拿取,并判断上下班打卡情况。代码可能满足不了大部分需求,目前只够本公司用,如果需要,可以参考。
在这里插入图片描述
需要把飞书月度汇总的考勤表导入系统中可以参考下。

下图为需要获取的年月日以及对应表格的数据。

在这里插入图片描述
实现代码如下


//导入Excel接口并调用下方的readAttendanceRecords()方法	/*** 导入飞书考勤列表*//** 示例:@ApiOperation("导入飞书考勤表")@Log(title = "导入飞书考勤表", businessType = BusinessType.IMPORT)@PostMapping("/importFeiShuDataFile")public AjaxResult importFeiShuDataFile(MultipartFile file, boolean updateSupport) throws Exception {File convertFile = convert(file);List<Attendance> attendanceFeiShus = readAttendanceRecords(convertFile);String message = attendanceService.importAttendance(attendanceFeiShus, false, "1");return AjaxResult.success(message);}
**//*** 将MultipartFile转换为File** @param multipartFile 上传的文件* @return 转换后的File对象* @throws IOException 如果文件操作失败*/public static File convert(MultipartFile multipartFile) throws IOException {// 创建一个临时文件Path tempFile = Files.createTempFile("upload-", ".tmp");try (InputStream inputStream = multipartFile.getInputStream()) {// 将MultipartFile的内容复制到临时文件Files.copy(inputStream, tempFile, StandardCopyOption.REPLACE_EXISTING);}// 返回File对象return tempFile.toFile();}public List<Attendance> readAttendanceRecords(File file) throws IOException, InvalidFormatException, ParseException {List<Attendance> records = new ArrayList<>();// 创建工作簿对象Workbook workbook = new XSSFWorkbook(file);Sheet sheet = workbook.getSheetAt(0); // 获取第一个工作表// 遍历第一行(跳过表头)Row row = sheet.getRow(1);String date = getCellValue(row.getCell(58)); // 日期
//        截取字符串日期String[] dataArray = date.split("-");String year = dataArray[0];String month = dataArray[1];LocalDate localDate = LocalDate.of(Integer.parseInt(year), Integer.parseInt(month), 1);LocalDate origin = LocalDate.of(Integer.parseInt(year), Integer.parseInt(month), 1);// 获取这个月的总天数int monthLength = localDate.lengthOfMonth();// 遍历每一行(跳过表头)for (int i = 2; i <= sheet.getLastRowNum(); i++) {Row row2 = sheet.getRow(i);if (row2 == null) continue;// 解析每一列的数据String employeeName = getCellValue(row2.getCell(0)); // 员工姓名String employeeNo = getCellValue(row2.getCell(1));   // 员工ID
//            需要查询员工id的员工对象Employee employee = new Employee();if (employeeNo.equals("-")) {employee.setEmployeeName(employeeName);// 根据姓名查询员工idList<Employee> employees = employeeService.selectEmployeeList(employee);if (CollUtil.isNotEmpty(employees)) {employee = employees.get(0); // 如果出现多个员工,请在excel里面把员工编号填写上,否则如果姓名相同根据姓名来获取默认第一个}}String day = getCellValue(row2.getCell(58));       // 日期
//           一个月的数据for (int j = 1; j < monthLength; j++) {Attendance record = new Attendance();record.setEmployeeName(employeeName);record.setEmployeeNo(employee.getEmployeeNo() == null ? employeeNo : employee.getEmployeeNo()); // 如果excel的员工id不为空的话,用excel,否则用查询的if (day.equals("-")) { // 如果为-,代表没来day = getCellValue(row2.getCell(58 + j));localDate = localDate.plusDays(1);// 加一天//                    continue;} else {//                 解析day 的上下班时间if (!day.contains(",")) { // 说明只上班,没下班,默认下午18:00;Date startTime = DateUtils.dateTime("HH:mm:ss", day + ":00");record.setStartTime(startTime);record.setEndTime(DateUtils.dateTime("HH:mm:ss", "18:00:00"));} else {String[] split = day.split(",");record.setStartTime(DateUtils.dateTime("HH:mm:ss", split[0] + ":00")); // 拼接成HH:mm:ss格式if (split.length == 3) {record.setEndTime(DateUtils.dateTime("HH:mm:ss", "18:00:00")); // 一天只打了三次卡,设置默认下班时间为18点}else {record.setEndTime(DateUtils.dateTime("HH:mm:ss", split[split.length-1] + ":00" )); // 一天只打了三次卡,设置默认下班时间为18点}}// 将LocalDate转换为ZonedDateTime(默认时区)ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());// 将ZonedDateTime转换为InstantInstant instant = zonedDateTime.toInstant();// 将Instant转换为DateDate Day = Date.from(instant);record.setDay(Day); // 从该月第一天开始records.add(record);localDate = localDate.plusDays(1);// 加一天day = getCellValue(row2.getCell(58 + j));}}localDate = origin;}logger.info("考勤信息:{{}}", records);workbook.close();return records;}// 获取单元格的值private static String getCellValue(Cell cell) {if (cell == null) {return "";}switch (cell.getCellType()) {case STRING:return cell.getStringCellValue();case NUMERIC:if (DateUtil.isCellDateFormatted(cell)) {return cell.getLocalDateTimeCellValue().toString(); // 如果是日期类型,返回日期字符串} else {return String.valueOf(cell.getNumericCellValue());}case BOOLEAN:return String.valueOf(cell.getBooleanCellValue());case FORMULA:return cell.getCellFormula();default:return "";}}/*** 判断某一年是否是闰年** @param year 年份* @return true表示是闰年,false表示是平年*/public static boolean isLeapYear(int year) {// 规则1:能被4整除但不能被100整除// 规则2:能被400整除return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);}

文章转载自:

http://bnIzf9XT.LLfwg.cn
http://kUW2pHAb.LLfwg.cn
http://gR3EVvXS.LLfwg.cn
http://QFid3xBT.LLfwg.cn
http://r5SOB1Iz.LLfwg.cn
http://mdFbIvkt.LLfwg.cn
http://ZJpmdxxZ.LLfwg.cn
http://yGNM4Ve5.LLfwg.cn
http://caDK8Qey.LLfwg.cn
http://maylSZTE.LLfwg.cn
http://lEWsdxCi.LLfwg.cn
http://9QyBqgIC.LLfwg.cn
http://sBxLX1Ny.LLfwg.cn
http://Dr5ii7vF.LLfwg.cn
http://ZMfzSeMH.LLfwg.cn
http://w7LRobvv.LLfwg.cn
http://q7erjXPj.LLfwg.cn
http://LlsUmSX7.LLfwg.cn
http://cCtjubaY.LLfwg.cn
http://Ki2nBN8X.LLfwg.cn
http://4LGRl97u.LLfwg.cn
http://TpaqQPSO.LLfwg.cn
http://Qb5uHJSL.LLfwg.cn
http://eEgIOpEp.LLfwg.cn
http://tktDkRGJ.LLfwg.cn
http://d3sFFbxl.LLfwg.cn
http://h279OzeM.LLfwg.cn
http://MIvHAfeS.LLfwg.cn
http://FMm4oo0o.LLfwg.cn
http://YiCxRC1B.LLfwg.cn
http://www.dtcms.com/wzjs/687325.html

相关文章:

  • 移动建站平台有哪些开发微信公众号需要多少钱
  • 网站建设好评公司wordpress 窗口大小
  • 新网站怎么做秦皇岛市城乡建设局网站
  • 网站备案审核流程图家电网站首页制作
  • 百度网站优化排名织梦网站如何修改数据库配置
  • dede怎么做双语网站西宁建设网站软件
  • 网站建设愿景手机qq 插件 wordpress
  • 做淘宝美工图片网站物流网站做代理
  • 株洲网站网络推广怎么做设计类专业考研考什么
  • 做网站要会什么做搜狗手机网站优化首
  • 怎么在外国网站上找产品做跨境电商公司企业宣传片的拍摄
  • wordpress怎么关闭网站长沙网站建设优化
  • 做网站还有意义吗网站建设自查自评
  • 深圳网站快速优化公司wordpress账号分享
  • 建设网站后期需要哪些个人介绍网页制作模板html
  • 网站建设公司包括哪些板块wordpress 删除死链接
  • 太原建站方法腾讯网站建设方案
  • 百度网站官网入口个人工商查询官网入口查询
  • 哪些网站可以seo全球域名注册商
  • 网站建设当前位置图标可以免费建设网站吗
  • 怎样做淘宝联盟网站wordpress修改页面组件
  • 华夏集团网站建设建设医院在哪里
  • 佛山网站推广市场关于学校网站建设申请报告
  • 网站与数据库岳阳工程造价信息网
  • 深圳响应式网站建设哪家好php网站建设课程作业
  • 网站推广的意义和方法荣昌集团网站建设
  • 企业免费建站网站开一家互联网公司需要多少钱
  • 大型网站的空间鄂州网站制作人才招聘
  • 哪里有做网站系统上海网络建设公司
  • 做球球棒棒糖网站源码做博客用什么系统做网站好