新增打卡Demo模块
This commit is contained in:
parent
c65ee4d28d
commit
0f39654327
50
Cpop-ClockIn-Demo/pom.xml
Normal file
50
Cpop-ClockIn-Demo/pom.xml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.cpop</groupId>
|
||||||
|
<artifactId>Cpop-Union</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>Cpop-ClockIn-Demo</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>Cpop-ClockIn</name>
|
||||||
|
<description>打卡Demo模块</description>
|
||||||
|
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!--核心包-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cpop</groupId>
|
||||||
|
<artifactId>Cpop-Core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!--系统包-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cpop</groupId>
|
||||||
|
<artifactId>Cpop-System</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.json</groupId>
|
||||||
|
<artifactId>json</artifactId>
|
||||||
|
<version>20210307</version> <!-- 请检查最新版本 -->
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@ -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;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -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<Void> save(@RequestBody @ApiParam("打卡班次表") Classes classes) {
|
||||||
|
classesService.save(classes);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据主键删除打卡班次表。
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return {@code true} 删除成功,{@code false} 删除失败
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/remove/{id}")
|
||||||
|
@ApiOperation("根据主键删除打卡班次表")
|
||||||
|
public R<Void> remove(@PathVariable @ApiParam("打卡班次表主键") Serializable id) {
|
||||||
|
classesService.removeById(id);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据主键更新打卡班次表。
|
||||||
|
*
|
||||||
|
* @param classes 打卡班次表
|
||||||
|
* @return {@code true} 更新成功,{@code false} 更新失败
|
||||||
|
*/
|
||||||
|
@PutMapping("/update")
|
||||||
|
@ApiOperation("根据主键更新打卡班次表")
|
||||||
|
public R<Void> update(@RequestBody @ApiParam("打卡班次表主键") Classes classes) {
|
||||||
|
classesService.updateById(classes);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有打卡班次表。
|
||||||
|
*
|
||||||
|
* @return 所有数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
@ApiOperation("查询所有打卡班次表")
|
||||||
|
public R<List<Classes>> list() {
|
||||||
|
return R.ok(classesService.list());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据打卡班次表主键获取详细信息。
|
||||||
|
*
|
||||||
|
* @param id 打卡班次表主键
|
||||||
|
* @return 打卡班次表详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/getInfo/{id}")
|
||||||
|
@ApiOperation("根据主键获取打卡班次表")
|
||||||
|
public R<Classes> getInfo(@PathVariable @ApiParam("打卡班次表主键") Serializable id) {
|
||||||
|
return R.ok(classesService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询打卡班次表。
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @return 分页对象
|
||||||
|
*/
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiOperation("分页查询打卡班次表")
|
||||||
|
public R<Page<Classes>> page(@ApiParam("分页信息") Page<Classes> page) {
|
||||||
|
return R.ok(classesService.page(page));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -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<String> uploadRecord(@RequestParam("file") MultipartFile file) throws IOException, ParseException {
|
||||||
|
/* List<ClockInRecordBo> 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<ClockInRecordBo> clockInRecordBoList = ;
|
||||||
|
// // 将对象数据返回给前端*/
|
||||||
|
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
List<EmployeeAttendanceBo> 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);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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<java.lang.Void>
|
||||||
|
**/
|
||||||
|
@PostMapping("/save")
|
||||||
|
@ApiOperation("保存员工-班次关联表")
|
||||||
|
public R<Void> 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<java.lang.Void>
|
||||||
|
**/
|
||||||
|
@PutMapping("/update")
|
||||||
|
@ApiOperation("更新员工-班次关联表")
|
||||||
|
public R<Void> update(@RequestBody @ApiParam("员工-班次修改Dto") StaffClassesDto staffClassesDto) {
|
||||||
|
staffClassesService.updateAll(staffClassesDto);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有员工-班次关联表。
|
||||||
|
*
|
||||||
|
* @return 所有数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
@ApiOperation("查询员工班次信息")
|
||||||
|
public R<List<StaffClassesVo>> list() {
|
||||||
|
return R.ok(staffClassesService.getStaffClassesVolist());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据员工-班次关联表主键获取详细信息。
|
||||||
|
*
|
||||||
|
* @param id 员工-班次关联表主键
|
||||||
|
* @return 员工-班次关联表详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/getInfo/{id}")
|
||||||
|
@ApiOperation("根据主键获取员工-班次关联表")
|
||||||
|
public R<StaffClasses> 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<com.mybatisflex.core.paginate.Page<com.cpop.clockin.business.vo.StaffClassesVo>>
|
||||||
|
**/
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiOperation("分页查询员工-班次信息")
|
||||||
|
public R<Page<StaffClassesVo>> page( @ApiParam("员工名称") @RequestParam(value = "staffName", required = false)String staffName) {
|
||||||
|
|
||||||
|
return R.ok(staffClassesService.selectPage(staffName));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
@ -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<Classes> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -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<ClockInDept> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -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<ClockInStaff> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -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<ClockInStaffMidDept> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -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<StaffClasses> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -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<Classes> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -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<ClockInDept> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -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<com.cpop.clockin.business.bo.ClockInRecordBo>
|
||||||
|
**/
|
||||||
|
String uploadRecord(MultipartFile file) throws IOException, ParseException;
|
||||||
|
}
|
||||||
@ -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<ClockInStaffMidDept> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -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<ClockInStaff> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -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<StaffClasses> {
|
||||||
|
/**
|
||||||
|
* 保存员工班次信息
|
||||||
|
*
|
||||||
|
* @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<com.cpop.clockin.business.vo.StaffClassesVo>
|
||||||
|
**/
|
||||||
|
public List<StaffClassesVo> 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<com.cpop.clockin.business.vo.StaffClassesVo>
|
||||||
|
**/
|
||||||
|
Page<StaffClassesVo> selectPage(String staffName);
|
||||||
|
}
|
||||||
@ -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<ClassesMapper, Classes> implements ClassesService {
|
||||||
|
|
||||||
|
}
|
||||||
@ -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<ClockInDeptMapper, ClockInDept> implements ClockInDeptService {
|
||||||
|
|
||||||
|
}
|
||||||
@ -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<Map<Integer, String>>() {
|
||||||
|
List<Map<Integer, String>> dataList = new ArrayList<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invoke(Map<Integer, String> data, AnalysisContext context) {
|
||||||
|
|
||||||
|
// 遍历每一列
|
||||||
|
for (Map.Entry<Integer, String> 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<Map> mergedJsonList = new ArrayList<>();
|
||||||
|
|
||||||
|
// 依据键从小到大排序
|
||||||
|
JSONObject titleObject = jsonArray.getJSONObject(1);
|
||||||
|
Map<String, String> 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<String, String> 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> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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<ClockInStaffMidDeptMapper, ClockInStaffMidDept> implements ClockInStaffMidDeptService {
|
||||||
|
|
||||||
|
}
|
||||||
@ -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<ClockInStaffMapper, ClockInStaff> implements ClockInStaffService {
|
||||||
|
|
||||||
|
}
|
||||||
@ -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<StaffClassesMapper, StaffClasses> 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<com.cpop.clockin.business.vo.StaffClassesVo>
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public List<StaffClassesVo> getStaffClassesVolist() {
|
||||||
|
|
||||||
|
List<StaffClassesVo> 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<ClassesVo> 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<com.cpop.clockin.business.vo.StaffClassesVo>
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public Page<StaffClassesVo> 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<StaffClassesVo> 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<ClockInStaff> clockInStaffPage = clockInStaffMapper.paginate(pageDomain.getPageNum(), pageDomain.getPageSize(), QueryWrapper.create().like("name",staffName));
|
||||||
|
List<StaffClassesVo> 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<ClassesVo> 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<StaffClassesVo> staffClassesVoPage = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||||
|
staffClassesVoPage.setRecords(staffClassesVoList);
|
||||||
|
staffClassesVoPage.setTotalRow(clockInStaffPage.getTotalRow());
|
||||||
|
staffClassesVoPage.setTotalPage(clockInStaffPage.getTotalPage());
|
||||||
|
|
||||||
|
return staffClassesVoPage;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
}
|
||||||
@ -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<ClassesVo> classesVoList;
|
||||||
|
}
|
||||||
@ -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";
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.cpop.clockin.business.mapper.ClassesMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.cpop.clockin.business.mapper.ClockInDeptMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.cpop.clockin.business.mapper.ClockInStaffMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.cpop.clockin.business.mapper.ClockInStaffMidDeptMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.cpop.clockin.business.mapper.StaffClassesMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -45,6 +45,11 @@
|
|||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-test</artifactId>
|
<artifactId>spring-test</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- 打卡Demo包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cpop</groupId>
|
||||||
|
<artifactId>Cpop-ClockIn-Demo</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
7
pom.xml
7
pom.xml
@ -29,6 +29,7 @@
|
|||||||
<module>Cpop-System</module>
|
<module>Cpop-System</module>
|
||||||
<module>Cpop-Mini</module>
|
<module>Cpop-Mini</module>
|
||||||
<module>Cpop-Pay</module>
|
<module>Cpop-Pay</module>
|
||||||
|
<module>Cpop-ClockIn-Demo</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@ -111,6 +112,12 @@
|
|||||||
<artifactId>Cpop-Jambox</artifactId>
|
<artifactId>Cpop-Jambox</artifactId>
|
||||||
<version>${cpop.version}</version>
|
<version>${cpop.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- 打卡Demo包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cpop</groupId>
|
||||||
|
<artifactId>Cpop-ClockIn-Demo</artifactId>
|
||||||
|
<version>${cpop.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cpop</groupId>
|
<groupId>com.cpop</groupId>
|
||||||
<artifactId>Cpop-Mall</artifactId>
|
<artifactId>Cpop-Mall</artifactId>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user