From 0f396543272f2571b0bd03a2344302e9899756ec Mon Sep 17 00:00:00 2001 From: yxz Date: Wed, 24 Jan 2024 20:55:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=89=93=E5=8D=A1Demo?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cpop-ClockIn-Demo/pom.xml | 50 ++++ .../clockin/business/bo/ClockInRecordBo.java | 83 +++++++ .../business/bo/EmployeeAttendanceBo.java | 158 +++++++++++++ .../controller/ClassesController.java | 110 +++++++++ .../controller/ClockInRecordController.java | 82 +++++++ .../controller/StaffClassesController.java | 101 +++++++++ .../clockin/business/dto/StaffClassesDto.java | 19 ++ .../cpop/clockin/business/entity/Classes.java | 67 ++++++ .../clockin/business/entity/ClockInDept.java | 110 +++++++++ .../clockin/business/entity/ClockInStaff.java | 86 +++++++ .../business/entity/ClockInStaffMidDept.java | 46 ++++ .../clockin/business/entity/StaffClasses.java | 58 +++++ .../business/mapper/ClassesMapper.java | 14 ++ .../business/mapper/ClockInDeptMapper.java | 14 ++ .../business/mapper/ClockInStaffMapper.java | 14 ++ .../mapper/ClockInStaffMidDeptMapper.java | 15 ++ .../business/mapper/StaffClassesMapper.java | 14 ++ .../business/service/ClassesService.java | 14 ++ .../business/service/ClockInDeptService.java | 14 ++ .../service/ClockInRecordService.java | 26 +++ .../service/ClockInStaffMidDeptService.java | 14 ++ .../business/service/ClockInStaffService.java | 14 ++ .../business/service/StaffClassesService.java | 48 ++++ .../service/impl/ClassesServiceImpl.java | 18 ++ .../service/impl/ClockInDeptServiceImpl.java | 18 ++ .../impl/ClockInRecordServiceImpl.java | 213 ++++++++++++++++++ .../impl/ClockInStaffMidDeptServiceImpl.java | 18 ++ .../service/impl/ClockInStaffServiceImpl.java | 18 ++ .../service/impl/StaffClassesServiceImpl.java | 193 ++++++++++++++++ .../cpop/clockin/business/vo/ClassesVo.java | 23 ++ .../clockin/business/vo/StaffClassesVo.java | 29 +++ .../framework/constant/ClockInConstant.java | 14 ++ .../main/resources/mapper/ClassesMapper.xml | 7 + .../resources/mapper/ClockInDeptMapper.xml | 7 + .../resources/mapper/ClockInStaffMapper.xml | 7 + .../mapper/ClockInStaffMidDeptMapper.xml | 7 + .../resources/mapper/StaffClassesMapper.xml | 7 + Cpop-Oam/pom.xml | 5 + pom.xml | 7 + 39 files changed, 1762 insertions(+) create mode 100644 Cpop-ClockIn-Demo/pom.xml create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/bo/ClockInRecordBo.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/bo/EmployeeAttendanceBo.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/ClassesController.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/ClockInRecordController.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/StaffClassesController.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/dto/StaffClassesDto.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/Classes.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInDept.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInStaff.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInStaffMidDept.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/StaffClasses.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/ClassesMapper.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/ClockInDeptMapper.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/ClockInStaffMapper.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/ClockInStaffMidDeptMapper.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/StaffClassesMapper.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClassesService.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClockInDeptService.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClockInRecordService.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClockInStaffMidDeptService.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClockInStaffService.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/StaffClassesService.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClassesServiceImpl.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClockInDeptServiceImpl.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClockInRecordServiceImpl.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClockInStaffMidDeptServiceImpl.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClockInStaffServiceImpl.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/StaffClassesServiceImpl.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/vo/ClassesVo.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/vo/StaffClassesVo.java create mode 100644 Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/framework/constant/ClockInConstant.java create mode 100644 Cpop-ClockIn-Demo/src/main/resources/mapper/ClassesMapper.xml create mode 100644 Cpop-ClockIn-Demo/src/main/resources/mapper/ClockInDeptMapper.xml create mode 100644 Cpop-ClockIn-Demo/src/main/resources/mapper/ClockInStaffMapper.xml create mode 100644 Cpop-ClockIn-Demo/src/main/resources/mapper/ClockInStaffMidDeptMapper.xml create mode 100644 Cpop-ClockIn-Demo/src/main/resources/mapper/StaffClassesMapper.xml diff --git a/Cpop-ClockIn-Demo/pom.xml b/Cpop-ClockIn-Demo/pom.xml new file mode 100644 index 0000000..3f5bf1c --- /dev/null +++ b/Cpop-ClockIn-Demo/pom.xml @@ -0,0 +1,50 @@ + + 4.0.0 + + com.cpop + Cpop-Union + 1.0.0 + + + Cpop-ClockIn-Demo + jar + + Cpop-ClockIn + 打卡Demo模块 + + + + UTF-8 + + + + + + com.cpop + Cpop-Core + + + + com.cpop + Cpop-System + + + org.json + json + 20210307 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + + diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/bo/ClockInRecordBo.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/bo/ClockInRecordBo.java new file mode 100644 index 0000000..50d1749 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/bo/ClockInRecordBo.java @@ -0,0 +1,83 @@ +package com.cpop.clockin.business.bo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + * @Author: Yxz + * @Date: 2024/1/23 21:39 + * @Version: 1.0 + */ +@Data +@ApiModel(value = "打卡记录VO") +public class ClockInRecordBo { + @ExcelProperty(value = "姓名") + private String staffName; + @ExcelProperty("考勤组") + private String clockInGroup; + @ExcelProperty("1") + private String day1; + @ExcelProperty("2") + private String day2; + @ExcelProperty("3") + private String day3; + @ExcelProperty("4") + private String day4; + @ExcelProperty("5") + private String day5; + @ExcelProperty("6") + private String day6; + @ExcelProperty("7") + private String day7; + @ExcelProperty("8") + private String day8; + @ExcelProperty("9") + private String day9; + @ExcelProperty("10") + private String day10; + @ExcelProperty("11") + private String day11; + @ExcelProperty("12") + private String day12; + @ExcelProperty("13") + private String day13; + @ExcelProperty("14") + private String day14; + @ExcelProperty("15") + private String day15; + @ExcelProperty("16") + private String day16; + @ExcelProperty("17") + private String day17; + @ExcelProperty("18") + private String day18; + @ExcelProperty("19") + private String day19; + @ExcelProperty("20") + private String day20; + @ExcelProperty("21") + private String day21; + @ExcelProperty("22") + private String day22; + @ExcelProperty("23") + private String day23; + @ExcelProperty("24") + private String day24; + @ExcelProperty("25") + private String day25; + @ExcelProperty("26") + private String day26; + @ExcelProperty("27") + private String day27; + @ExcelProperty("28") + private String day28; + @ExcelProperty("29") + private String day29; + @ExcelProperty("30") + private String day30; + @ExcelProperty("31") + private String day31; + + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/bo/EmployeeAttendanceBo.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/bo/EmployeeAttendanceBo.java new file mode 100644 index 0000000..9d609aa --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/bo/EmployeeAttendanceBo.java @@ -0,0 +1,158 @@ +package com.cpop.clockin.business.bo; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.ToString; + +@Data +@ToString +@JsonIgnoreProperties(ignoreUnknown = true) +public class EmployeeAttendanceBo { + @ExcelProperty("姓名") + @JsonProperty("姓名") + private String name; + + @ExcelProperty("考勤组") + @JsonProperty("考勤组") + private String attendanceGroup; + + @ExcelProperty("部门") + @JsonProperty("部门") + private String department; + @ExcelProperty("工号") + @JsonProperty("工号") + private String employeeId; + @ExcelProperty("职位") + @JsonProperty("职位") + private String position; + @ExcelProperty("UserId") + @JsonProperty("UserId") + private String userId; + @ExcelProperty("day1") + @JsonProperty("1") + private String day1; + + @ExcelProperty("day2") + @JsonProperty("2") + private String day2; + + @ExcelProperty("day3") + @JsonProperty("3") + private String day3; + + @ExcelProperty("day4") + @JsonProperty("4") + private String day4; + + @ExcelProperty("day5") + @JsonProperty("5") + private String day5; + + @ExcelProperty("day6") + @JsonProperty("6") + private String day6; + + @ExcelProperty("day7") + @JsonProperty("7") + private String day7; + + @ExcelProperty("day8") + @JsonProperty("8") + private String day8; + + @ExcelProperty("day9") + @JsonProperty("9") + private String day9; + + @ExcelProperty("day10") + @JsonProperty("10") + private String day10; + + @ExcelProperty("day11") + @JsonProperty("11") + private String day11; + + @ExcelProperty("day12") + @JsonProperty("12") + private String day12; + + @ExcelProperty("day13") + @JsonProperty("13") + private String day13; + + @ExcelProperty("day14") + @JsonProperty("14") + private String day14; + + @ExcelProperty("day15") + @JsonProperty("15") + private String day15; + + @ExcelProperty("day16") + @JsonProperty("16") + private String day16; + + @ExcelProperty("day17") + @JsonProperty("17") + private String day17; + + @ExcelProperty("day18") + @JsonProperty("18") + private String day18; + + @ExcelProperty("day19") + @JsonProperty("19") + private String day19; + + @ExcelProperty("day20") + @JsonProperty("20") + private String day20; + + @ExcelProperty("day21") + @JsonProperty("21") + private String day21; + + @ExcelProperty("day22") + @JsonProperty("22") + private String day22; + + @ExcelProperty("day23") + @JsonProperty("23") + private String day23; + + @ExcelProperty("day24") + @JsonProperty("24") + private String day24; + + @ExcelProperty("day25") + @JsonProperty("25") + private String day25; + + @ExcelProperty("day26") + @JsonProperty("26") + private String day26; + + @ExcelProperty("day27") + @JsonProperty("27") + private String day27; + + @ExcelProperty("day28") + @JsonProperty("28") + private String day28; + + @ExcelProperty("day29") + @JsonProperty("29") + private String day29; + + @ExcelProperty("day30") + @JsonProperty("30") + private String day30; + + @ExcelProperty("day31") + @JsonProperty("31") + private String day31; + + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/ClassesController.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/ClassesController.java new file mode 100644 index 0000000..1358e02 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/ClassesController.java @@ -0,0 +1,110 @@ +package com.cpop.clockin.business.controller; + +import com.cpop.core.base.R; +import com.mybatisflex.core.paginate.Page; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.beans.factory.annotation.Autowired; +import com.cpop.clockin.business.entity.Classes; +import com.cpop.clockin.business.service.ClassesService; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.io.Serializable; +import java.util.List; + +/** + * 打卡班次表 控制层。 + * + * @author Yxz + * @since 2024-01-23 + */ +@RestController +@Api(tags = "打卡班次表接口") +@RequestMapping("/backstage/classes") +public class ClassesController { + + @Autowired + private ClassesService classesService; + + /** + * 添加打卡班次表。 + * + * @param classes 打卡班次表 + * @return {@code true} 添加成功,{@code false} 添加失败 + */ + @PostMapping("/save") + @ApiOperation("保存打卡班次表") + public R save(@RequestBody @ApiParam("打卡班次表") Classes classes) { + classesService.save(classes); + return R.ok(); + } + + /** + * 根据主键删除打卡班次表。 + * + * @param id 主键 + * @return {@code true} 删除成功,{@code false} 删除失败 + */ + @DeleteMapping("/remove/{id}") + @ApiOperation("根据主键删除打卡班次表") + public R remove(@PathVariable @ApiParam("打卡班次表主键") Serializable id) { + classesService.removeById(id); + return R.ok(); + } + + /** + * 根据主键更新打卡班次表。 + * + * @param classes 打卡班次表 + * @return {@code true} 更新成功,{@code false} 更新失败 + */ + @PutMapping("/update") + @ApiOperation("根据主键更新打卡班次表") + public R update(@RequestBody @ApiParam("打卡班次表主键") Classes classes) { + classesService.updateById(classes); + return R.ok(); + } + + /** + * 查询所有打卡班次表。 + * + * @return 所有数据 + */ + @GetMapping("/list") + @ApiOperation("查询所有打卡班次表") + public R> list() { + return R.ok(classesService.list()); + } + + /** + * 根据打卡班次表主键获取详细信息。 + * + * @param id 打卡班次表主键 + * @return 打卡班次表详情 + */ + @GetMapping("/getInfo/{id}") + @ApiOperation("根据主键获取打卡班次表") + public R getInfo(@PathVariable @ApiParam("打卡班次表主键") Serializable id) { + return R.ok(classesService.getById(id)); + } + + /** + * 分页查询打卡班次表。 + * + * @param page 分页对象 + * @return 分页对象 + */ + @GetMapping("/page") + @ApiOperation("分页查询打卡班次表") + public R> page(@ApiParam("分页信息") Page page) { + return R.ok(classesService.page(page)); + } + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/ClockInRecordController.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/ClockInRecordController.java new file mode 100644 index 0000000..24a16b2 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/ClockInRecordController.java @@ -0,0 +1,82 @@ +package com.cpop.clockin.business.controller; + +import com.alibaba.excel.EasyExcel; +import com.cpop.clockin.business.bo.ClockInRecordBo; +import com.cpop.clockin.business.bo.EmployeeAttendanceBo; +import com.cpop.clockin.business.service.ClockInRecordService; +import com.cpop.clockin.framework.constant.ClockInConstant; +import com.cpop.core.base.R; +import com.cpop.core.service.RedisService; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.net.URLEncoder; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * @Author: Yxz + * @Date: 2024/1/23 21:26 + * @Version: 1.0 + */ +@RestController +@Api(tags = "打卡记录接口") +@RequestMapping("/backstage/clockInRecord") +public class ClockInRecordController { + @Autowired + private ClockInRecordService clockInRecordService; + @Autowired + private RedisService redisService; + @PostMapping("/upload") + @ApiOperation("上传钉钉Excel表") + public R uploadRecord(@RequestParam("file") MultipartFile file) throws IOException, ParseException { +/* List clockInRecordBoList = ; + // 将对象数据返回给前端*/ + return R.ok(clockInRecordService.uploadRecord(file)); + } + + @GetMapping("/output") + @ApiOperation("导出表格") + public void outPut(HttpServletResponse response) throws IOException { + String manTimeJson = redisService.getCacheObject(ClockInConstant.MAN_TIME_JSON); + /*byte[] bytes = manTimeJson.getBytes(); + OutputStream outputStream = new FileOutputStream("output.json"); + outputStream.write(bytes);*/ + +/* List clockInRecordBoList = ; +// // 将对象数据返回给前端*/ + + ObjectMapper objectMapper = new ObjectMapper(); + List employeeList = new ArrayList<>(); + try { + // 将JSON数组转化为Java对象的列表 + employeeList = Arrays.asList(objectMapper.readValue(manTimeJson, EmployeeAttendanceBo[].class)); + + // 打印列表中的每个对象 + for (EmployeeAttendanceBo employee : employeeList) { + System.out.println(employee); + } + } catch (IOException e) { + e.printStackTrace(); + } + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + // 这里URLEncoder.encode可以防止中文乱码 当然和easyExcel没有关系 + String fileName = URLEncoder.encode("事务分发模板", "UTF-8").replaceAll("\\+", "%20"); + response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); + EasyExcel.write(response.getOutputStream(), EmployeeAttendanceBo.class).sheet("模板").doWrite(employeeList); + + + } +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/StaffClassesController.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/StaffClassesController.java new file mode 100644 index 0000000..8023468 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/StaffClassesController.java @@ -0,0 +1,101 @@ +package com.cpop.clockin.business.controller; + +import com.cpop.clockin.business.dto.StaffClassesDto; +import com.cpop.clockin.business.service.StaffClassesService; +import com.cpop.clockin.business.vo.StaffClassesVo; +import com.cpop.core.base.R; +import com.mybatisflex.core.paginate.Page; +import org.springframework.web.bind.annotation.*; +import org.springframework.beans.factory.annotation.Autowired; +import com.cpop.clockin.business.entity.StaffClasses; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.io.Serializable; +import java.util.List; + +/** + * 员工-班次关联表 控制层。 + * + * @author Yxz + * @since 2024-01-23 + */ +@RestController +@Api(tags = "员工-班次关联表接口") +@RequestMapping("/backstage/staffClasses") +public class StaffClassesController { + + @Autowired + private StaffClassesService staffClassesService; + + /** + * 添加员工-班次关联表。 + * + * @author: Yxz + * @date: 2024/1/24 20:54 + * @param: [staffClassesDto] + * @return: com.cpop.core.base.R + **/ + @PostMapping("/save") + @ApiOperation("保存员工-班次关联表") + public R save(@RequestBody @ApiParam("员工-班次保存Dto") StaffClassesDto staffClassesDto) { + staffClassesService.saveAll(staffClassesDto); + return R.ok(); + } + + + /** + * 根据主键更新员工-班次关联表。 + * + * @author: Yxz + * @date: 2024/1/24 20:54 + * @param: [staffClassesDto] + * @return: com.cpop.core.base.R + **/ + @PutMapping("/update") + @ApiOperation("更新员工-班次关联表") + public R update(@RequestBody @ApiParam("员工-班次修改Dto") StaffClassesDto staffClassesDto) { + staffClassesService.updateAll(staffClassesDto); + return R.ok(); + } + + /** + * 查询所有员工-班次关联表。 + * + * @return 所有数据 + */ + @GetMapping("/list") + @ApiOperation("查询员工班次信息") + public R> list() { + return R.ok(staffClassesService.getStaffClassesVolist()); + } + + + /** + * 根据员工-班次关联表主键获取详细信息。 + * + * @param id 员工-班次关联表主键 + * @return 员工-班次关联表详情 + */ + @GetMapping("/getInfo/{id}") + @ApiOperation("根据主键获取员工-班次关联表") + public R getInfo(@PathVariable @ApiParam("员工-班次关联表主键") Serializable id) { + return R.ok(staffClassesService.getById(id)); + } + + /** + * 分页查询员工-班次关联表。 + * + * @author: Yxz + * @date: 2024/1/24 20:55 + * @param: [staffName] + * @return: com.cpop.core.base.R> + **/ + @GetMapping("/page") + @ApiOperation("分页查询员工-班次信息") + public R> page( @ApiParam("员工名称") @RequestParam(value = "staffName", required = false)String staffName) { + + return R.ok(staffClassesService.selectPage(staffName)); + } + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/dto/StaffClassesDto.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/dto/StaffClassesDto.java new file mode 100644 index 0000000..63ce41a --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/dto/StaffClassesDto.java @@ -0,0 +1,19 @@ +package com.cpop.clockin.business.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author: Yxz + * @Date: 2024/1/23 16:26 + * @Version: 1.0 + */ +@Data +@ApiModel(value = "员工班次DTO") +public class StaffClassesDto { + @ApiModelProperty(value = "员工id") + private String staffId; + @ApiModelProperty(value = "班次id数组") + private String[] classId; +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/Classes.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/Classes.java new file mode 100644 index 0000000..9e5a97b --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/Classes.java @@ -0,0 +1,67 @@ +package com.cpop.clockin.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * 打卡班次表 实体类。 + * + * @author Yxz + * @since 2024-01-23 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ApiModel(value = "打卡班次表对象") +@Table(value = "cp_oam_classes", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class Classes extends BaseEntity implements Serializable { + + @Id + private String id; + + /** + * 班次名称 + */ + @ApiModelProperty(value = "班次名称") + private String className; + + /** + * 开始时间 + */ + @ApiModelProperty(value = "开始时间") + @JsonFormat(pattern = "HH:mm:ss",timezone = "GMT+8") + private Date startTime; + + /** + * 结束时间 + */ + @ApiModelProperty(value = "结束时间") + @JsonFormat(pattern = "HH:mm:ss",timezone = "GMT+8") + private Date endTime; + + + + /** + * 逻辑删除(0否1是) + */ + @ApiModelProperty(value = "逻辑删除(0否1是)") + @Column(isLogicDelete = true) + private Integer isDelete; + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInDept.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInDept.java new file mode 100644 index 0000000..aaa9fb5 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInDept.java @@ -0,0 +1,110 @@ +package com.cpop.clockin.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * 部门表 实体类。 + * + * @author Yxz + * @since 2024-01-23 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ApiModel(value = "部门表对象") +@Table(value = "cp_oam_dept", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class ClockInDept extends BaseEntity implements Serializable { + + /** + * 部门id + */ + @ApiModelProperty(value = "部门id") + @Id + private String id; + + /** + * 父部门id + */ + @ApiModelProperty(value = "父部门id") + private String parentId; + + /** + * 企微id + */ + @ApiModelProperty(value = "企微id") + private Long wxCpId; + + /** + * 企微父id + */ + @ApiModelProperty(value = "企微父id") + private Long wxCpParentId; + + /** + * 部门名称 + */ + @ApiModelProperty(value = "部门名称") + private String name; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序") + private Integer orderNo; + + /** + * 负责人 + */ + @ApiModelProperty(value = "负责人") + private String leader; + + /** + * 电话 + */ + @ApiModelProperty(value = "电话") + private String phone; + + /** + * 邮箱 + */ + @ApiModelProperty(value = "邮箱") + private String email; + + /** + * 部门状态:1正常,0停用 + */ + @ApiModelProperty(value = "部门状态:1正常,0停用") + private Boolean status; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + + + + + /** + * 逻辑删除(0否1是) + */ + @ApiModelProperty(value = "逻辑删除(0否1是)") + @Column(isLogicDelete = true) + private Boolean isDelete; + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInStaff.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInStaff.java new file mode 100644 index 0000000..c1129b5 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInStaff.java @@ -0,0 +1,86 @@ +package com.cpop.clockin.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * 员工表 实体类。 + * + * @author Yxz + * @since 2024-01-23 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ApiModel(value = "员工表对象") +@Table(value = "cp_oam_staff", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class ClockInStaff extends BaseEntity implements Serializable { + + /** + * 主键 + */ + @ApiModelProperty(value = "主键") + @Id + private String id; + + /** + * 姓名 + */ + @ApiModelProperty(value = "姓名") + private String name; + + /** + * 用户id + */ + @ApiModelProperty(value = "用户id") + private String userId; + + /** + * 员工类型(0:技术人员;1:售后人员;2:管理人员) + */ + @ApiModelProperty(value = "员工类型(0:技术人员;1:售后人员;2:管理人员)") + private Integer staffType; + + /** + * 角色id + */ + @ApiModelProperty(value = "角色id") + private String roleId; + + /** + * 微信用userId + */ + @ApiModelProperty(value = "微信用userId") + private String wxCpUserId; + + /** + * 是否是运维账号 + */ + @ApiModelProperty(value = "是否是运维账号") + private Boolean isOperation; + + + + + + /** + * 逻辑删除(0否1是) + */ + @ApiModelProperty(value = "逻辑删除(0否1是)") + @Column(isLogicDelete = true) + private Boolean isDelete; + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInStaffMidDept.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInStaffMidDept.java new file mode 100644 index 0000000..97395fe --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInStaffMidDept.java @@ -0,0 +1,46 @@ +package com.cpop.clockin.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * Oam-员工-用户中间表 实体类。 + * + * @author Yxz + * @since 2024-01-23 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ApiModel(value = "Oam-员工-用户中间表对象") +@Table(value = "cp_oam_staff_mid_dept", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class ClockInStaffMidDept extends BaseEntity implements Serializable { + + /** + * 员工id + */ + @ApiModelProperty(value = "员工id") + private String staffId; + + /** + * 部门id + */ + @ApiModelProperty(value = "部门id") + private String deptId; + + + + + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/StaffClasses.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/StaffClasses.java new file mode 100644 index 0000000..a91a66a --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/StaffClasses.java @@ -0,0 +1,58 @@ +package com.cpop.clockin.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * 员工-班次关联表 实体类。 + * + * @author Yxz + * @since 2024-01-23 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ApiModel(value = "员工-班次关联表对象") +@Table(value = "cp_oam_staff_classes", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class StaffClasses extends BaseEntity implements Serializable { + + @Id + private String id; + + /** + * 员工id + */ + @ApiModelProperty(value = "员工id") + private String staffId; + + /** + * 班次id + */ + @ApiModelProperty(value = "班次id") + private String classId; + + + + + + /** + * 逻辑删除(0否1是) + */ + @ApiModelProperty(value = "逻辑删除(0否1是)") + @Column(isLogicDelete = true) + private Integer isDelete; + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/ClassesMapper.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/ClassesMapper.java new file mode 100644 index 0000000..34aecaa --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/ClassesMapper.java @@ -0,0 +1,14 @@ +package com.cpop.clockin.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.clockin.business.entity.Classes; + +/** + * 打卡班次表 映射层。 + * + * @author Yxz + * @since 2024-01-23 + */ +public interface ClassesMapper extends BaseMapper { + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/ClockInDeptMapper.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/ClockInDeptMapper.java new file mode 100644 index 0000000..558e327 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/ClockInDeptMapper.java @@ -0,0 +1,14 @@ +package com.cpop.clockin.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.clockin.business.entity.ClockInDept; + +/** + * 部门表 映射层。 + * + * @author Yxz + * @since 2024-01-23 + */ +public interface ClockInDeptMapper extends BaseMapper { + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/ClockInStaffMapper.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/ClockInStaffMapper.java new file mode 100644 index 0000000..06f98d3 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/ClockInStaffMapper.java @@ -0,0 +1,14 @@ +package com.cpop.clockin.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.clockin.business.entity.ClockInStaff; + +/** + * 员工表 映射层。 + * + * @author Yxz + * @since 2024-01-23 + */ +public interface ClockInStaffMapper extends BaseMapper { + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/ClockInStaffMidDeptMapper.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/ClockInStaffMidDeptMapper.java new file mode 100644 index 0000000..2df9110 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/ClockInStaffMidDeptMapper.java @@ -0,0 +1,15 @@ +package com.cpop.clockin.business.mapper; + +import com.cpop.clockin.business.entity.ClockInStaffMidDept; +import com.mybatisflex.core.BaseMapper; + + +/** + * Oam-员工-用户中间表 映射层。 + * + * @author Yxz + * @since 2024-01-23 + */ +public interface ClockInStaffMidDeptMapper extends BaseMapper { + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/StaffClassesMapper.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/StaffClassesMapper.java new file mode 100644 index 0000000..0d51337 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/mapper/StaffClassesMapper.java @@ -0,0 +1,14 @@ +package com.cpop.clockin.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.clockin.business.entity.StaffClasses; + +/** + * 员工-班次关联表 映射层。 + * + * @author Yxz + * @since 2024-01-23 + */ +public interface StaffClassesMapper extends BaseMapper { + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClassesService.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClassesService.java new file mode 100644 index 0000000..f0fab0d --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClassesService.java @@ -0,0 +1,14 @@ +package com.cpop.clockin.business.service; + +import com.mybatisflex.core.service.IService; +import com.cpop.clockin.business.entity.Classes; + +/** + * 打卡班次表 服务层。 + * + * @author Yxz + * @since 2024-01-23 + */ +public interface ClassesService extends IService { + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClockInDeptService.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClockInDeptService.java new file mode 100644 index 0000000..376ae62 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClockInDeptService.java @@ -0,0 +1,14 @@ +package com.cpop.clockin.business.service; + +import com.mybatisflex.core.service.IService; +import com.cpop.clockin.business.entity.ClockInDept; + +/** + * 部门表 服务层。 + * + * @author Yxz + * @since 2024-01-23 + */ +public interface ClockInDeptService extends IService { + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClockInRecordService.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClockInRecordService.java new file mode 100644 index 0000000..e1deced --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClockInRecordService.java @@ -0,0 +1,26 @@ +package com.cpop.clockin.business.service; + +import com.cpop.clockin.business.bo.ClockInRecordBo; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.text.ParseException; +import java.util.List; + +/** + * 打卡记录服务类 + * + * @Author: Yxz + * @Date: 2024/1/23 21:55 + */ +public interface ClockInRecordService { + /** + * 上传钉钉Excel表 + * + * @author: Yxz + * @date: 2024/1/24 9:33 + * @param: [file] + * @return: java.util.List + **/ + String uploadRecord(MultipartFile file) throws IOException, ParseException; +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClockInStaffMidDeptService.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClockInStaffMidDeptService.java new file mode 100644 index 0000000..aad8a22 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClockInStaffMidDeptService.java @@ -0,0 +1,14 @@ +package com.cpop.clockin.business.service; + +import com.mybatisflex.core.service.IService; +import com.cpop.clockin.business.entity.ClockInStaffMidDept; + +/** + * Oam-员工-用户中间表 服务层。 + * + * @author Yxz + * @since 2024-01-23 + */ +public interface ClockInStaffMidDeptService extends IService { + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClockInStaffService.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClockInStaffService.java new file mode 100644 index 0000000..9e7aa1b --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/ClockInStaffService.java @@ -0,0 +1,14 @@ +package com.cpop.clockin.business.service; + +import com.mybatisflex.core.service.IService; +import com.cpop.clockin.business.entity.ClockInStaff; + +/** + * 员工表 服务层。 + * + * @author Yxz + * @since 2024-01-23 + */ +public interface ClockInStaffService extends IService { + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/StaffClassesService.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/StaffClassesService.java new file mode 100644 index 0000000..f137b7b --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/StaffClassesService.java @@ -0,0 +1,48 @@ +package com.cpop.clockin.business.service; + +import com.cpop.clockin.business.dto.StaffClassesDto; +import com.cpop.clockin.business.entity.StaffClasses; +import com.cpop.clockin.business.vo.StaffClassesVo; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.service.IService; + +import java.util.List; + +public interface StaffClassesService extends IService { + /** + * 保存员工班次信息 + * + * @author: Yxz + * @date: 2024/1/23 20:43 + * @param: [staffClassesDto] + * @return: void + **/ + public void saveAll(StaffClassesDto staffClassesDto); + /** + * 查询所有员工班次信息 + * + * @author: Yxz + * @date: 2024/1/23 20:42 + * @param: [] + * @return: java.util.List + **/ + public List getStaffClassesVolist(); + /** + * 更新员工班次信息 + * + * @author: Yxz + * @date: 2024/1/23 20:42 + * @param: [staffClassesDto] + * @return: void + **/ + void updateAll(StaffClassesDto staffClassesDto); + /** + * 分页查询员工-班次信息 + * + * @author: Yxz + * @date: 2024/1/23 20:42 + * @param: [staffName] + * @return: com.mybatisflex.core.paginate.Page + **/ + Page selectPage(String staffName); +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClassesServiceImpl.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClassesServiceImpl.java new file mode 100644 index 0000000..3aa6651 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClassesServiceImpl.java @@ -0,0 +1,18 @@ +package com.cpop.clockin.business.service.impl; + +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.clockin.business.entity.Classes; +import com.cpop.clockin.business.mapper.ClassesMapper; +import com.cpop.clockin.business.service.ClassesService; +import org.springframework.stereotype.Service; + +/** + * 打卡班次表 服务层实现。 + * + * @author Yxz + * @since 2024-01-23 + */ +@Service("classesService") +public class ClassesServiceImpl extends ServiceImpl implements ClassesService { + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClockInDeptServiceImpl.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClockInDeptServiceImpl.java new file mode 100644 index 0000000..a776fa0 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClockInDeptServiceImpl.java @@ -0,0 +1,18 @@ +package com.cpop.clockin.business.service.impl; + +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.clockin.business.entity.ClockInDept; +import com.cpop.clockin.business.mapper.ClockInDeptMapper; +import com.cpop.clockin.business.service.ClockInDeptService; +import org.springframework.stereotype.Service; + +/** + * 部门表 服务层实现。 + * + * @author Yxz + * @since 2024-01-23 + */ +@Service("clockInDeptService") +public class ClockInDeptServiceImpl extends ServiceImpl implements ClockInDeptService { + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClockInRecordServiceImpl.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClockInRecordServiceImpl.java new file mode 100644 index 0000000..8539f64 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClockInRecordServiceImpl.java @@ -0,0 +1,213 @@ +package com.cpop.clockin.business.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; + + +import com.alibaba.fastjson2.JSON; +import com.cpop.clockin.business.bo.ClockInRecordBo; +import com.cpop.clockin.business.entity.Classes; +import com.cpop.clockin.business.entity.ClockInStaff; +import com.cpop.clockin.business.entity.StaffClasses; +import com.cpop.clockin.business.service.ClassesService; +import com.cpop.clockin.business.service.ClockInRecordService; +import com.cpop.clockin.business.service.ClockInStaffService; +import com.cpop.clockin.business.service.StaffClassesService; +import com.cpop.clockin.framework.constant.ClockInConstant; +import com.cpop.core.service.RedisService; +import com.mybatisflex.core.query.QueryWrapper; +import org.json.JSONArray; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * 打卡记录服务实现类 + * @Author: Yxz + * @Date: 2024/1/23 21:55 + * @Version: 1.0 + */ +@Service +public class ClockInRecordServiceImpl implements ClockInRecordService { + @Autowired + private RedisService redisService; + @Autowired + private ClockInStaffService clockInStaffService; + @Autowired + private StaffClassesService staffClassesService; + @Autowired + private ClassesService classesService; + + /** + * 上传钉钉Excel表 + * + * @author: Yxz + * @date: 2024/1/24 14:54 + * @param: [file] + * @return: java.lang.String + **/ + @Override + public String uploadRecord(MultipartFile file) throws IOException, ParseException { + + EasyExcel.read(file.getInputStream()) + .sheet() + .registerReadListener(new AnalysisEventListener>() { + List> dataList = new ArrayList<>(); + + @Override + public void invoke(Map data, AnalysisContext context) { + + // 遍历每一列 + for (Map.Entry entry : data.entrySet()) { + Integer columnIndex = entry.getKey(); + String columnValue = entry.getValue(); + + // 如果列的值为null,将其替换为空字符串 + if (columnValue == null) { + data.put(columnIndex, ""); // 使用空字符串代替null + } + } + + dataList.add(data); + } + + @Override + public void doAfterAllAnalysed(AnalysisContext context) { + // 处理数据完成后的操作 + String jsonData = JSON.toJSONString(dataList); + // 存入Redis中 + redisService.setCacheObject(ClockInConstant.CLOCKIN_EXCEL_JSON,jsonData,5, TimeUnit.MINUTES); + System.out.println(jsonData); + } + }) + .doRead(); + + String cacheObject = redisService.getCacheObject(ClockInConstant.CLOCKIN_EXCEL_JSON); + JSONArray jsonArray = new JSONArray(cacheObject); + + List mergedJsonList = new ArrayList<>(); + + // 依据键从小到大排序 + JSONObject titleObject = jsonArray.getJSONObject(1); + Map sortedJsonObject = new LinkedHashMap<>(); + + titleObject.keySet().stream() + .sorted(Comparator.comparingInt(Integer::parseInt)) + .forEach(key -> { + // 将排序后的键和对应的值加入新的JSONObject + System.out.println(key + ": " + titleObject.getString(key)); + sortedJsonObject.put(key, titleObject.getString(key)); + }); + + // 合并键值对 + for (int i = 2; i < jsonArray.length(); i++) { + Map mergedJson = new LinkedHashMap<>(); + + + for (String key : sortedJsonObject.keySet()) { + String newKey = titleObject.getString(key); + + // 获取当前元素 + JSONObject element = jsonArray.getJSONObject(i); + String value = element.getString(key); + // 时间列 + if (newKey.matches("-?\\d+(\\.\\d+)?") || newKey.equals("六") || newKey.equals("日")){ + // 工时 + double manHour = 0.0; + // 加班时间 + double overtime = 0.0; + + String name = element.getString("0"); + // 匹配员工 + ClockInStaff clockInStaff = clockInStaffService.getOne(QueryWrapper.create().eq("name", name)); + // 查找班次 + if (ObjectUtil.isNotNull( clockInStaff)) { + List staffClasses = staffClassesService.list(QueryWrapper.create().eq("staff_id", clockInStaff.getId())); + for (StaffClasses staffClass : staffClasses) { + Classes classes = classesService.getById(staffClass.getClassId()); + if (ObjectUtil.isNotNull(classes) && ObjectUtil.isNotEmpty(value)){ + // 计算工时 + String firstTime = value.substring(0, 5); + +// String lastTime = value.substring( value.length() - 5,value.length()); + String lastTime = value.substring(value.length() - 5).trim(); + + String pattern = "HH:mm"; + SimpleDateFormat dateFormat = new SimpleDateFormat(pattern); + + Date firstTimeDate = dateFormat.parse(firstTime); + Date lastTimeDate = dateFormat.parse(lastTime); + Date overTimeDate = dateFormat.parse("21:00"); + + if (firstTimeDate.before(classes.getStartTime())){ + // 正常上班卡 + if (lastTimeDate.before(classes.getEndTime())){ + // 早退 + long timeDifferenceInMillis = lastTimeDate.getTime() - classes.getStartTime().getTime(); + manHour = manHour + (double) timeDifferenceInMillis / (1000 * 60 * 60); + }else { + // 正常下班 + long timeDifferenceInMillis = classes.getEndTime().getTime() - classes.getStartTime().getTime(); + manHour = manHour + (double) timeDifferenceInMillis / (1000 * 60 * 60); + } + }else { + // 迟到 + if (lastTimeDate.before(classes.getEndTime())){ + // 早退 + long timeDifferenceInMillis = lastTimeDate.getTime() - firstTimeDate.getTime(); + manHour = manHour + (double) timeDifferenceInMillis / (1000 * 60 * 60); + }else { + // 正常下班 + long timeDifferenceInMillis = classes.getEndTime().getTime() - firstTimeDate.getTime(); + manHour = manHour + (double) timeDifferenceInMillis / (1000 * 60 * 60); + } + } + + + if (lastTimeDate.after(overTimeDate)){ + // 加班 + long timeDifferenceInMillis = lastTimeDate.getTime() - overTimeDate.getTime(); + overtime = (double) timeDifferenceInMillis / (1000 * 60 * 60); + } + + System.out.println("lastTime==========="+ lastTime); + } + } + } + + // 保留两位小数 + DecimalFormat decimalFormat = new DecimalFormat("#.##"); + + // 使用format方法进行格式化 + String formatManHour = decimalFormat.format(manHour + overtime); + String formatOverTime = decimalFormat.format(overtime); + + value = "工时:" + formatManHour; + if (overtime != 0.0){ + //加班 + value = value + " " + "加班工时:" +formatOverTime; + } + + } + mergedJson.put(newKey,value); + + } + mergedJsonList.add(mergedJson); + + } + String jsonString = JSON.toJSONString(mergedJsonList); + redisService.setCacheObject(ClockInConstant.MAN_TIME_JSON,jsonString,5,TimeUnit.MINUTES); + + return jsonString; + } +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClockInStaffMidDeptServiceImpl.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClockInStaffMidDeptServiceImpl.java new file mode 100644 index 0000000..2085407 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClockInStaffMidDeptServiceImpl.java @@ -0,0 +1,18 @@ +package com.cpop.clockin.business.service.impl; + +import com.cpop.clockin.business.entity.ClockInStaffMidDept; +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.clockin.business.mapper.ClockInStaffMidDeptMapper; +import com.cpop.clockin.business.service.ClockInStaffMidDeptService; +import org.springframework.stereotype.Service; + +/** + * Oam-员工-用户中间表 服务层实现。 + * + * @author Yxz + * @since 2024-01-23 + */ +@Service("clockInStaffMidDeptService") +public class ClockInStaffMidDeptServiceImpl extends ServiceImpl implements ClockInStaffMidDeptService { + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClockInStaffServiceImpl.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClockInStaffServiceImpl.java new file mode 100644 index 0000000..ded4a1e --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/ClockInStaffServiceImpl.java @@ -0,0 +1,18 @@ +package com.cpop.clockin.business.service.impl; + +import com.cpop.clockin.business.service.ClockInStaffService; +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.clockin.business.entity.ClockInStaff; +import com.cpop.clockin.business.mapper.ClockInStaffMapper; +import org.springframework.stereotype.Service; + +/** + * 员工表 服务层实现。 + * + * @author Yxz + * @since 2024-01-23 + */ +@Service("clockInStaffService") +public class ClockInStaffServiceImpl extends ServiceImpl implements ClockInStaffService { + +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/StaffClassesServiceImpl.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/StaffClassesServiceImpl.java new file mode 100644 index 0000000..fee6944 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/StaffClassesServiceImpl.java @@ -0,0 +1,193 @@ +package com.cpop.clockin.business.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.cpop.clockin.business.dto.StaffClassesDto; +import com.cpop.clockin.business.entity.*; +import com.cpop.clockin.business.mapper.ClockInStaffMapper; +import com.cpop.clockin.business.service.*; +import com.cpop.clockin.business.vo.ClassesVo; +import com.cpop.clockin.business.vo.StaffClassesVo; +import com.cpop.core.base.entity.PageDomain; +import com.cpop.core.utils.SpringUtils; +import com.cpop.core.utils.sql.SqlUtils; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.core.row.Db; +import com.mybatisflex.core.row.DbChain; +import com.mybatisflex.core.row.Row; +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.clockin.business.mapper.StaffClassesMapper; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import static com.mybatisflex.core.query.QueryMethods.groupConcat; + +/** + * 员工-班次关联表 服务层实现。 + * + * @author Yxz + * @since 2024-01-23 + */ +@Service("staffClassesService") +public class StaffClassesServiceImpl extends ServiceImpl implements StaffClassesService { + @Autowired + private ClockInStaffService clockInStaffService; + @Autowired + private ClockInDeptService clockInDeptService; + @Autowired + private ClockInStaffMidDeptService clockInStaffMidDeptService; + @Autowired + private ClassesService classesService; + @Autowired + private ClockInStaffMapper clockInStaffMapper; + + /** + * 保存员工班次 + * + * @author: Yxz + * @date: 2024/1/23 16:59 + * @param: [staffClassesDto] + * @return: void + **/ + @Override + public void saveAll(StaffClassesDto staffClassesDto) { + this.mapper.deleteByQuery(QueryWrapper.create().eq("staff_id",staffClassesDto.getStaffId())); + + for (String s : staffClassesDto.getClassId()) { + StaffClasses staffClasses = new StaffClasses(); + staffClasses.setStaffId(staffClassesDto.getStaffId()); + staffClasses.setClassId(s); + + this.save(staffClasses); + } + } + + /** + * 查询所有员工-班次关联表 + * + * @author: Yxz + * @date: 2024/1/23 17:50 + * @param: [] + * @return: java.util.List + **/ + @Override + public List getStaffClassesVolist() { + + List staffClassesVoList= clockInStaffService.list().stream().map(entity -> { + StaffClassesVo vo = new StaffClassesVo(); + vo.setStaffName(entity.getName()); + vo.setStaffId(entity.getId()); + + // 部门 + String duptName = ""; + for (ClockInStaffMidDept staffMidDept : clockInStaffMidDeptService.list(QueryWrapper.create().eq("staff_id", entity.getId()))) { + ClockInDept dept = clockInDeptService.getById(staffMidDept.getDeptId()); + duptName = duptName + dept.getName() + " "; + } + vo.setDeptName(duptName); + + // 考勤班次字段 + String className = ""; + List classesVos = new ArrayList<>(); + for (StaffClasses staffClasses : this.list(QueryWrapper.create().eq("staff_id", entity.getId()))) { + Classes classes = classesService.getById(staffClasses.getClassId()); + className = className + classes.getClassName() + ""; + + ClassesVo classesVO = new ClassesVo(); + BeanUtils.copyProperties(classes,classesVO); + + classesVos.add(classesVO); + } + vo.setClassName(className); + vo.setClassesVoList(classesVos); + + return vo; + }).collect(Collectors.toList()); + + return staffClassesVoList; + } + + @Override + public void updateAll(StaffClassesDto staffClassesDto) { + this.mapper.deleteByQuery(QueryWrapper.create().eq("staff_id",staffClassesDto.getStaffId())); + this.saveAll(staffClassesDto); + } + + /** + * 分页查询 + * + * @author: Yxz + * @date: 2024/1/24 11:20 + * @param: [staffName] + * @return: com.mybatisflex.core.paginate.Page + **/ + @Override + public Page selectPage(String staffName) { + PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); + + /*SpringUtils.getBean(ClockInStaffService.class).getMapper().paginateAs(Page.of(pageDomain.getPageSize(),pageDomain.getPageSize()), + QueryWrapper.create(), + StaffClassesVo.class, + deptName ->deptName.field(StaffClassesVo::getDeptName) + .queryWrapper(vo ->QueryWrapper.create().select(("group_concat(cod.name) as deptName") ).from("cp_oam_dept").as("cod") + .leftJoin("cp_oam_staff_mid_dept").as("cosmd").on("cosmd.dept_id = cos.id") + .leftJoin("cp_oam_staff").as("cos").on("cos.id = cosmd.staff_id") + .where("cos.id = ?",vo.getStaffId())));*/ + + /*Page clockInStaffPage1 = DbChain.table("cp_oam_staff") + .select("cos.id as staffId","cos.name as staffName").from("cp_oam_staff").as("cos") + .leftJoin("cp_oam_staff_mid_dept").as("cosmd").on("cosmd.staff_id = cos.id") + .leftJoin("cp_oam_dept").as("cod").on("cod.id = cosmd.dept_id") + .like("name", staffName) + .pageAs(StaffClassesVo.class); + + Db.paginate("cp_oam_staff",pageAs(pageDomain.getPageSize(),pageDomain.getPageSize()), + QueryWrapper.create(),)*/ + + Page clockInStaffPage = clockInStaffMapper.paginate(pageDomain.getPageNum(), pageDomain.getPageSize(), QueryWrapper.create().like("name",staffName)); + List staffClassesVoList = clockInStaffPage.getRecords().stream().map(entity -> { + StaffClassesVo vo = new StaffClassesVo(); + vo.setStaffName(entity.getName()); + vo.setStaffId(entity.getId()); + + // 部门 + String duptName = ""; + for (ClockInStaffMidDept staffMidDept : clockInStaffMidDeptService.list(QueryWrapper.create().eq("staff_id", entity.getId()))) { + ClockInDept dept = clockInDeptService.getById(staffMidDept.getDeptId()); + duptName = duptName + dept.getName() + " "; + } + vo.setDeptName(duptName); + + // 考勤班次字段 + String className = ""; + List classesVos = new ArrayList<>(); + for (StaffClasses staffClasses : this.list(QueryWrapper.create().eq("staff_id", entity.getId()))) { + Classes classes = classesService.getById(staffClasses.getClassId()); + if (ObjectUtil.isNotNull(classes)) { + className = className + classes.getClassName() + " "; + ClassesVo classesVO = new ClassesVo(); + BeanUtils.copyProperties(classes,classesVO); + + classesVos.add(classesVO); + } + } + vo.setClassName(className); + vo.setClassesVoList(classesVos); + + return vo; + }).collect(Collectors.toList()); + + + Page staffClassesVoPage = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize()); + staffClassesVoPage.setRecords(staffClassesVoList); + staffClassesVoPage.setTotalRow(clockInStaffPage.getTotalRow()); + staffClassesVoPage.setTotalPage(clockInStaffPage.getTotalPage()); + + return staffClassesVoPage; + } +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/vo/ClassesVo.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/vo/ClassesVo.java new file mode 100644 index 0000000..099000c --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/vo/ClassesVo.java @@ -0,0 +1,23 @@ +package com.cpop.clockin.business.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author: Yxz + * @Date: 2024/1/23 18:56 + * @Version: 1.0 + */ +@ApiModel(value = "班次VO") +@Data +public class ClassesVo { + @ApiModelProperty(value = "班次Id") + private String id; + + /** + * 班次名称 + */ + @ApiModelProperty(value = "班次名称") + private String className; +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/vo/StaffClassesVo.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/vo/StaffClassesVo.java new file mode 100644 index 0000000..328baa0 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/vo/StaffClassesVo.java @@ -0,0 +1,29 @@ +package com.cpop.clockin.business.vo; + +import com.mybatisflex.annotation.RelationOneToMany; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @Author: Yxz + * @Date: 2024/1/23 17:45 + * @Version: 1.0 + */ +@ApiModel(value = "员工班次关联VO") +@Data +public class StaffClassesVo { + @ApiModelProperty("员工Id") + private String staffId; + @ApiModelProperty("员工名称") + private String staffName; + @ApiModelProperty("部门名称") + private String deptName; + + @ApiModelProperty("考勤班次名称") + private String className; + @ApiModelProperty("考勤班次集合") + private List classesVoList; +} diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/framework/constant/ClockInConstant.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/framework/constant/ClockInConstant.java new file mode 100644 index 0000000..70f1591 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/framework/constant/ClockInConstant.java @@ -0,0 +1,14 @@ +package com.cpop.clockin.framework.constant; + +/** + * @Author: Yxz + * @Date: 2024/1/24 11:39 + * @Version: 1.0 + */ +public class ClockInConstant { + // 打卡表格数据 + public static final String CLOCKIN_EXCEL_JSON = "clockin_excel_json"; + // 工时数据 + public static final String MAN_TIME_JSON = "man_time_json"; + +} diff --git a/Cpop-ClockIn-Demo/src/main/resources/mapper/ClassesMapper.xml b/Cpop-ClockIn-Demo/src/main/resources/mapper/ClassesMapper.xml new file mode 100644 index 0000000..c3015d9 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/resources/mapper/ClassesMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-ClockIn-Demo/src/main/resources/mapper/ClockInDeptMapper.xml b/Cpop-ClockIn-Demo/src/main/resources/mapper/ClockInDeptMapper.xml new file mode 100644 index 0000000..2d2a010 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/resources/mapper/ClockInDeptMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-ClockIn-Demo/src/main/resources/mapper/ClockInStaffMapper.xml b/Cpop-ClockIn-Demo/src/main/resources/mapper/ClockInStaffMapper.xml new file mode 100644 index 0000000..3dab20e --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/resources/mapper/ClockInStaffMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-ClockIn-Demo/src/main/resources/mapper/ClockInStaffMidDeptMapper.xml b/Cpop-ClockIn-Demo/src/main/resources/mapper/ClockInStaffMidDeptMapper.xml new file mode 100644 index 0000000..275e4a6 --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/resources/mapper/ClockInStaffMidDeptMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-ClockIn-Demo/src/main/resources/mapper/StaffClassesMapper.xml b/Cpop-ClockIn-Demo/src/main/resources/mapper/StaffClassesMapper.xml new file mode 100644 index 0000000..256ac5b --- /dev/null +++ b/Cpop-ClockIn-Demo/src/main/resources/mapper/StaffClassesMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Oam/pom.xml b/Cpop-Oam/pom.xml index a701748..b863ae9 100644 --- a/Cpop-Oam/pom.xml +++ b/Cpop-Oam/pom.xml @@ -45,6 +45,11 @@ org.springframework spring-test + + + com.cpop + Cpop-ClockIn-Demo + diff --git a/pom.xml b/pom.xml index cd1ca7a..4ba3b2f 100644 --- a/pom.xml +++ b/pom.xml @@ -29,6 +29,7 @@ Cpop-System Cpop-Mini Cpop-Pay + Cpop-ClockIn-Demo @@ -111,6 +112,12 @@ Cpop-Jambox ${cpop.version} + + + com.cpop + Cpop-ClockIn-Demo + ${cpop.version} + com.cpop Cpop-Mall