From 61e0beab24cefa6172779708dd0c8dd09fb61b3b Mon Sep 17 00:00:00 2001
From: 赵士淞 <zhaoss@yhzhg.cn>
Date: Thu, 16 Feb 2023 06:26:02 +0000
Subject: [PATCH] Merge branch 'weicd' of http://192.168.1.110:5678/r/pms-upgrade into master
---
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/AttendanceMonthTalkServiceImpl.java | 242 ++++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceMonthLeaveRepository.java | 47 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/AttendanceMonthLeaveServiceImpl.java | 110 ++
eladmin-web-master/src/api/attendance/attendanceMonth.js | 51 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/rest/AttendanceMonthController.java | 112 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceLeaveRepository.java | 4
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthLeaveQueryCriteria.java | 29
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/mapstruct/AttendanceMonthMapper.java | 32
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceMonthRepository.java | 56 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/rest/AttendanceMonthLeaveController.java | 87 ++
eladmin-web-master/src/api/system/dept.js | 10
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthQueryCriteria.java | 40 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceRepository.java | 8
eladmin-web-master/src/views/attendance/attendanceCardReplacement/index.vue | 28
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/AttendanceMonth.java | 137 +++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/AttendanceMonthLeaveService.java | 83 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthDto.java | 121 +++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/AttendanceMonthService.java | 95 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java | 2
eladmin-web-master/src/views/attendance/attendanceMonth/index.vue | 584 ++++++++++++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/AttendanceMonthLeave.java | 86 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/AttendanceMonthlyMethod.java | 26
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/mapstruct/AttendanceMonthLeaveMapper.java | 32
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthLeaveDto.java | 57 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/AttendanceMonthServiceImpl.java | 265 ++++++
25 files changed, 2,327 insertions(+), 17 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/AttendanceMonth.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/AttendanceMonth.java
new file mode 100644
index 0000000..4789670
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/AttendanceMonth.java
@@ -0,0 +1,137 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.attendance.domain;
+
+import lombok.Data;
+import cn.hutool.core.bean.BeanUtil;
+import io.swagger.annotations.ApiModelProperty;
+import cn.hutool.core.bean.copier.CopyOptions;
+import me.zhengjie.base.BaseEntity;
+
+import javax.persistence.*;
+import javax.validation.constraints.*;
+import java.sql.Timestamp;
+import java.io.Serializable;
+
+/**
+* @website https://eladmin.vip
+* @description /
+* @author wcd
+* @date 2023-02-10
+**/
+@Entity
+@Data
+@Table(name="attendance_month")
+public class AttendanceMonth extends BaseEntity implements Serializable {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "`id`")
+ @ApiModelProperty(value = "id")
+ private Long id;
+
+ @Column(name = "`attendance_date`")
+ @ApiModelProperty(value = "统计年月")
+ private Timestamp attendanceDate;
+
+ @Column(name = "`user_id`")
+ @ApiModelProperty(value = "用户id")
+ private Long userId;
+
+ @Column(name = "`company_id`")
+ @ApiModelProperty(value = "公司id")
+ private Long companyId;
+
+ @Column(name = "`dept_id`")
+ @ApiModelProperty(value = "部门id")
+ private Long deptId;
+
+ @Column(name = "`job_id`")
+ @ApiModelProperty(value = "岗位id")
+ private Long jobId;
+
+ @Column(name = "`required_attendance_days`")
+ @ApiModelProperty(value = "应出勤天数")
+ private Long requiredAttendanceDays;
+
+ @Column(name = "`required_attendance_time`")
+ @ApiModelProperty(value = "应出勤时长")
+ private Double requiredAttendanceTime;
+
+ @Column(name = "`actual_attendance_days`")
+ @ApiModelProperty(value = "实际出勤天数")
+ private Long actualAttendanceDays;
+
+ @Column(name = "`actual_attendance_time`")
+ @ApiModelProperty(value = "实际出勤时长")
+ private Double actualAttendanceTime;
+
+ @Column(name = "`count_of_being_late`")
+ @ApiModelProperty(value = "迟到次数")
+ private Long countOfBeingLate;
+
+ @Column(name = "`time_of_being_late`")
+ @ApiModelProperty(value = "迟到时长")
+ private Double timeOfBeingLate;
+
+ @Column(name = "`count_of_being_early`")
+ @ApiModelProperty(value = "早退次数")
+ private Long countOfBeingEarly;
+
+ @Column(name = "`time_of_being_early`")
+ @ApiModelProperty(value = "早退时长")
+ private Double timeOfBeingEarly;
+
+ @Column(name = "`go_out_number`")
+ @ApiModelProperty(value = "外出次数")
+ private Long goOutNumber;
+
+ @Column(name = "`go_out_time`")
+ @ApiModelProperty(value = "外出时长")
+ private Double goOutTime;
+
+ @Column(name = "`buss_number`")
+ @ApiModelProperty(value = "出差次数")
+ private Long bussNumber;
+
+ @Column(name = "`buss_time`")
+ @ApiModelProperty(value = "出差时长")
+ private Double bussTime;
+
+ @Column(name = "`on_card_number`")
+ @ApiModelProperty(value = "上班缺卡次数")
+ private Long onCardNumber;
+
+ @Column(name = "`off_card_number`")
+ @ApiModelProperty(value = "下班缺卡次数")
+ private Long offCardNumber;
+
+ @Column(name = "`is_publicity`")
+ @ApiModelProperty(value = "公示状态")
+ private String isPublicity;
+
+ @Column(name = "`is_admit`")
+ @ApiModelProperty(value = "承认状态")
+ private String isAdmit;
+
+ @Column(name = "`remarks`")
+ @ApiModelProperty(value = "备注")
+ private String remarks;
+
+ public void copy(AttendanceMonth source){
+ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
+ }
+}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/AttendanceMonthLeave.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/AttendanceMonthLeave.java
new file mode 100644
index 0000000..bbcd85f
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/AttendanceMonthLeave.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2019-2020 Zheng Jie
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package me.zhengjie.modules.attendance.domain;
+
+import lombok.Data;
+import cn.hutool.core.bean.BeanUtil;
+import io.swagger.annotations.ApiModelProperty;
+import cn.hutool.core.bean.copier.CopyOptions;
+import me.zhengjie.base.BaseEntity;
+
+import javax.persistence.*;
+import javax.validation.constraints.*;
+import java.sql.Timestamp;
+import java.io.Serializable;
+
+/**
+ * @website https://eladmin.vip
+ * @description /
+ * @author wcd
+ * @date 2023-02-10
+ **/
+@Entity
+@Data
+@Table(name="attendance_month_leave")
+public class AttendanceMonthLeave extends BaseEntity implements Serializable {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "`id`")
+ @ApiModelProperty(value = "id")
+ private Long id;
+
+ @Column(name = "`attendance_month_id`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "月报id")
+ private Long attendanceMonthId;
+
+ @Column(name = "`attendance_date`")
+ @ApiModelProperty(value = "统计年月")
+ private Timestamp attendanceDate;
+
+ @Column(name = "`user_id`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "用户id")
+ private Long userId;
+
+ @Column(name = "`leave_type`",nullable = false)
+ @NotBlank
+ @ApiModelProperty(value = "请假类型")
+ private String leaveType;
+
+ @Column(name = "`leave_count`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "请假次数")
+ private Long leaveCount;
+
+ @Column(name = "`leave_time`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "请假时长")
+ private Double leaveTime;
+
+ @Column(name = "`surplus_duration`")
+ @ApiModelProperty(value = "剩余时长")
+ private Double surplusDuration;
+
+ @Column(name = "`remarks`")
+ @ApiModelProperty(value = "备注")
+ private String remarks;
+
+ public void copy(AttendanceMonthLeave source){
+ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
+ }
+}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceLeaveRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceLeaveRepository.java
index 680247f..1cdac24 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceLeaveRepository.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceLeaveRepository.java
@@ -49,4 +49,8 @@
//查询请假记录
@Query(value = "SELECT * from attendance_leave where user_id = ?1 and leave_start_time < ?3 and leave_end_time > ?2 and approval_status IN ('approval_status_passed')", nativeQuery = true)
List<AttendanceLeave> findByUserIdAndDate(Long userId, LocalDateTime startDate, LocalDateTime endDate);
+
+ //查询请假记录(根据请假类型)
+ @Query(value = "SELECT * from attendance_leave where user_id = ?1 and leave_start_time < ?3 and leave_end_time > ?2 and approval_status IN ('approval_status_passed') and leave_type = ?4", nativeQuery = true)
+ List<AttendanceLeave> findByUserIdAndDateAndLeaveType(Long userId, LocalDateTime startDate, LocalDateTime endDate,String LeaveType);
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceMonthLeaveRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceMonthLeaveRepository.java
new file mode 100644
index 0000000..c900d29
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceMonthLeaveRepository.java
@@ -0,0 +1,47 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.attendance.repository;
+
+import me.zhengjie.modules.attendance.domain.AttendanceMonthLeave;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.List;
+
+/**
+* @website https://eladmin.vip
+* @author wcd
+* @date 2023-02-13
+**/
+public interface AttendanceMonthLeaveRepository extends JpaRepository<AttendanceMonthLeave, Long>, JpaSpecificationExecutor<AttendanceMonthLeave> {
+
+ /**
+ * 根据月报id查询
+ * @param mouthId
+ * @return
+ */
+ @Query(value = "SELECT * from attendance_month_leave where attendance_month_id = ?1", nativeQuery = true)
+ List<AttendanceMonthLeave> findByAttendanceMonthId(Long mouthId);
+
+ /**
+ * 根据日期查询
+ * @param date
+ * @return
+ */
+ @Query(value = "SELECT * from attendance_month_leave where attendance_date = ?1", nativeQuery = true)
+ List<AttendanceMonthLeave> findByAttendanceDate(String date);
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceMonthRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceMonthRepository.java
new file mode 100644
index 0000000..affe8f0
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceMonthRepository.java
@@ -0,0 +1,56 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.attendance.repository;
+
+import me.zhengjie.modules.attendance.domain.AttendanceMonth;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+* @website https://eladmin.vip
+* @author wcd
+* @date 2023-02-10
+**/
+public interface AttendanceMonthRepository extends JpaRepository<AttendanceMonth, Long>, JpaSpecificationExecutor<AttendanceMonth> {
+
+ // 根据日期删除
+ @Modifying
+ @Query(value = "delete from attendance_month where attendance_date = ?1",nativeQuery = true)
+ void deleteByActualAttendanceDays(String attendanceDate);
+
+ /**
+ * 根据日期查询考勤月报
+ * @param attendanceDate
+ * @return
+ */
+ @Query
+ List<AttendanceMonth> findByAttendanceDate(Date attendanceDate);
+
+ /**
+ * 根据日期时间查询
+ * @param attendanceDate
+ * @param userId
+ * @return
+ */
+ @Query(value = "select * from attendance_month where attendance_date = ?1 and user_id = ?2",nativeQuery = true)
+ AttendanceMonth findByAttendanceDateAndUserId(String attendanceDate, Long userId);
+
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceRepository.java
index 9632db8..e5bfe10 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceRepository.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceRepository.java
@@ -30,15 +30,19 @@
**/
public interface AttendanceRepository extends JpaRepository<Attendance, Long>, JpaSpecificationExecutor<Attendance> {
- /** 根据用户和日期查询考勤记录对象 */
+ /** 根据用户和日期查询考勤记录对象 **/
@Query(value = "SELECT * from attendance WHERE user_id = ? and attendance_date = ? " , nativeQuery = true)
Attendance findAllByUserIdAndAttendanceDate(Long userId, String baseDate);
- /** 根据员工姓名模糊查询 */
+ /** 根据员工姓名模糊查询 **/
@Query(value = "SELECT * from attendance WHERE " , nativeQuery = true)
List<AttendanceDto> findByUserNameLike(String userName);
/** 根据时间范围查询考勤记录 **/
@Query(value = "SELECT * from attendance where user_id = ?1 and attendance_date <= ?3 and attendance_date >= ?2", nativeQuery = true)
List<Attendance> findAllByUserAndDate(Long userId, String startDate, String endDate);
+
+ /** 根据日期查询考勤表 **/
+ @Query(value = "SELECT * FROM attendance a left join sys_user u on u.user_id = a.user_id WHERE a.attendance_date LIKE ? and u.enabled != 0", nativeQuery = true)
+ List<Attendance> findAllLikeDate(String baseDate);
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/rest/AttendanceMonthController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/rest/AttendanceMonthController.java
new file mode 100644
index 0000000..6f5a4c7
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/rest/AttendanceMonthController.java
@@ -0,0 +1,112 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.attendance.rest;
+
+import me.zhengjie.annotation.Log;
+import me.zhengjie.modules.attendance.domain.AttendanceMonth;
+import me.zhengjie.modules.attendance.service.AttendanceMonthService;
+import me.zhengjie.modules.attendance.service.dto.AttendanceMonthQueryCriteria;
+import org.springframework.data.domain.Pageable;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import io.swagger.annotations.*;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+* @website https://eladmin.vip
+* @author wcd
+* @date 2023-02-10
+**/
+@RestController
+@RequiredArgsConstructor
+@Api(tags = "考勤月报管理")
+@RequestMapping("/api/attendanceMonth")
+public class AttendanceMonthController {
+
+ private final AttendanceMonthService attendanceMonthService;
+
+ @Log("导出数据")
+ @ApiOperation("导出数据")
+ @GetMapping(value = "/download")
+ @PreAuthorize("@el.check('attendanceMonth:download')")
+ public void exportAttendanceMonth(HttpServletResponse response, AttendanceMonthQueryCriteria criteria) throws IOException {
+ attendanceMonthService.download(attendanceMonthService.queryAll(criteria), response);
+ }
+
+ @GetMapping
+ @Log("查询考勤月报")
+ @ApiOperation("查询考勤月报")
+ @PreAuthorize("@el.check('attendanceMonth:list')")
+ public ResponseEntity<Object> queryAttendanceMonth(AttendanceMonthQueryCriteria criteria, Pageable pageable){
+ return new ResponseEntity<>(attendanceMonthService.queryAll(criteria,pageable),HttpStatus.OK);
+ }
+
+ @GetMapping(value = "/all")
+ @Log("查询考勤月报")
+ @ApiOperation("查询考勤月报")
+ @PreAuthorize("@el.check('attendanceMonth:list')")
+ public ResponseEntity<Object> queryAttendanceMonth(AttendanceMonthQueryCriteria criteria){
+ return new ResponseEntity<>(attendanceMonthService.queryAll(criteria),HttpStatus.OK);
+ }
+
+ @PostMapping
+ @Log("新增考勤月报")
+ @ApiOperation("新增考勤月报")
+ @PreAuthorize("@el.check('attendanceMonth:add')")
+ public ResponseEntity<Object> createAttendanceMonth(@Validated @RequestBody AttendanceMonth resources){
+ return new ResponseEntity<>(attendanceMonthService.create(resources),HttpStatus.CREATED);
+ }
+
+ @PutMapping
+ @Log("修改考勤月报")
+ @ApiOperation("修改考勤月报")
+ @PreAuthorize("@el.check('attendanceMonth:edit')")
+ public ResponseEntity<Object> updateAttendanceMonth(@Validated @RequestBody AttendanceMonth resources){
+ attendanceMonthService.update(resources);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ @DeleteMapping
+ @Log("删除考勤月报")
+ @ApiOperation("删除考勤月报")
+ @PreAuthorize("@el.check('attendanceMonth:del')")
+ public ResponseEntity<Object> deleteAttendanceMonth(@RequestBody Long[] ids) {
+ attendanceMonthService.deleteAll(ids);
+ return new ResponseEntity<>(HttpStatus.OK);
+ }
+
+ @PutMapping(value = "/updateIsConfirm")
+ @Log("月报个人确认")
+ @ApiOperation("月报个人确认")
+ public ResponseEntity<Object> editIsConfirm(@Validated @RequestBody AttendanceMonth resources){
+ attendanceMonthService.updateConfirm(resources);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ @PutMapping(value = "/publicity")
+ @Log("公示月报记录")
+ @ApiOperation("公示月报记录")
+ @PreAuthorize("@el.check('attendanceMonth:publicity')")
+ public ResponseEntity<Object> publicityAttendanceMonth(@RequestBody Long[] ids){
+ attendanceMonthService.publicity(ids);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/rest/AttendanceMonthLeaveController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/rest/AttendanceMonthLeaveController.java
new file mode 100644
index 0000000..64ebdc2
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/rest/AttendanceMonthLeaveController.java
@@ -0,0 +1,87 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.attendance.rest;
+
+import me.zhengjie.annotation.Log;
+import me.zhengjie.modules.attendance.domain.AttendanceMonthLeave;
+import me.zhengjie.modules.attendance.service.AttendanceMonthLeaveService;
+import me.zhengjie.modules.attendance.service.dto.AttendanceMonthLeaveQueryCriteria;
+import org.springframework.data.domain.Pageable;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import io.swagger.annotations.*;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+* @website https://eladmin.vip
+* @author wcd
+* @date 2023-02-13
+**/
+@RestController
+@RequiredArgsConstructor
+@Api(tags = "月报请假类型管理")
+@RequestMapping("/api/attendanceMonthLeave")
+public class AttendanceMonthLeaveController {
+
+ private final AttendanceMonthLeaveService attendanceMonthLeaveService;
+
+ @Log("导出数据")
+ @ApiOperation("导出数据")
+ @GetMapping(value = "/download")
+ @PreAuthorize("@el.check('attendanceMonthLeave:list')")
+ public void exportAttendanceMonthLeave(HttpServletResponse response, AttendanceMonthLeaveQueryCriteria criteria) throws IOException {
+ attendanceMonthLeaveService.download(attendanceMonthLeaveService.queryAll(criteria), response);
+ }
+
+ @GetMapping
+ @Log("查询月报请假类型")
+ @ApiOperation("查询月报请假类型")
+ @PreAuthorize("@el.check('attendanceMonthLeave:list')")
+ public ResponseEntity<Object> queryAttendanceMonthLeave(AttendanceMonthLeaveQueryCriteria criteria, Pageable pageable){
+ return new ResponseEntity<>(attendanceMonthLeaveService.queryAll(criteria,pageable),HttpStatus.OK);
+ }
+
+ @PostMapping
+ @Log("新增月报请假类型")
+ @ApiOperation("新增月报请假类型")
+ @PreAuthorize("@el.check('attendanceMonthLeave:add')")
+ public ResponseEntity<Object> createAttendanceMonthLeave(@Validated @RequestBody AttendanceMonthLeave resources){
+ return new ResponseEntity<>(attendanceMonthLeaveService.create(resources),HttpStatus.CREATED);
+ }
+
+ @PutMapping
+ @Log("修改月报请假类型")
+ @ApiOperation("修改月报请假类型")
+ @PreAuthorize("@el.check('attendanceMonthLeave:edit')")
+ public ResponseEntity<Object> updateAttendanceMonthLeave(@Validated @RequestBody AttendanceMonthLeave resources){
+ attendanceMonthLeaveService.update(resources);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ @DeleteMapping
+ @Log("删除月报请假类型")
+ @ApiOperation("删除月报请假类型")
+ @PreAuthorize("@el.check('attendanceMonthLeave:del')")
+ public ResponseEntity<Object> deleteAttendanceMonthLeave(@RequestBody Long[] ids) {
+ attendanceMonthLeaveService.deleteAll(ids);
+ return new ResponseEntity<>(HttpStatus.OK);
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/AttendanceMonthLeaveService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/AttendanceMonthLeaveService.java
new file mode 100644
index 0000000..b22d9ae
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/AttendanceMonthLeaveService.java
@@ -0,0 +1,83 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.attendance.service;
+
+import me.zhengjie.modules.attendance.domain.AttendanceMonthLeave;
+import me.zhengjie.modules.attendance.service.dto.AttendanceMonthLeaveDto;
+import me.zhengjie.modules.attendance.service.dto.AttendanceMonthLeaveQueryCriteria;
+import org.springframework.data.domain.Pageable;
+import java.util.Map;
+import java.util.List;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+* @website https://eladmin.vip
+* @description 服务接口
+* @author wcd
+* @date 2023-02-13
+**/
+public interface AttendanceMonthLeaveService {
+
+ /**
+ * 查询数据分页
+ * @param criteria 条件
+ * @param pageable 分页参数
+ * @return Map<String,Object>
+ */
+ Map<String,Object> queryAll(AttendanceMonthLeaveQueryCriteria criteria, Pageable pageable);
+
+ /**
+ * 查询所有数据不分页
+ * @param criteria 条件参数
+ * @return List<AttendanceMonthLeaveDto>
+ */
+ List<AttendanceMonthLeaveDto> queryAll(AttendanceMonthLeaveQueryCriteria criteria);
+
+ /**
+ * 根据ID查询
+ * @param id ID
+ * @return AttendanceMonthLeaveDto
+ */
+ AttendanceMonthLeaveDto findById(Long id);
+
+ /**
+ * 创建
+ * @param resources /
+ * @return AttendanceMonthLeaveDto
+ */
+ AttendanceMonthLeaveDto create(AttendanceMonthLeave resources);
+
+ /**
+ * 编辑
+ * @param resources /
+ */
+ void update(AttendanceMonthLeave resources);
+
+ /**
+ * 多选删除
+ * @param ids /
+ */
+ void deleteAll(Long[] ids);
+
+ /**
+ * 导出数据
+ * @param all 待导出的数据
+ * @param response /
+ * @throws IOException /
+ */
+ void download(List<AttendanceMonthLeaveDto> all, HttpServletResponse response) throws IOException;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/AttendanceMonthService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/AttendanceMonthService.java
new file mode 100644
index 0000000..9e030a0
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/AttendanceMonthService.java
@@ -0,0 +1,95 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.attendance.service;
+
+import me.zhengjie.modules.attendance.domain.AttendanceMonth;
+import me.zhengjie.modules.attendance.service.dto.AttendanceMonthDto;
+import me.zhengjie.modules.attendance.service.dto.AttendanceMonthQueryCriteria;
+import org.springframework.data.domain.Pageable;
+import java.util.Map;
+import java.util.List;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+* @website https://eladmin.vip
+* @description 服务接口
+* @author wcd
+* @date 2023-02-10
+**/
+public interface AttendanceMonthService {
+
+ /**
+ * 查询数据分页
+ * @param criteria 条件
+ * @param pageable 分页参数
+ * @return Map<String,Object>
+ */
+ Map<String,Object> queryAll(AttendanceMonthQueryCriteria criteria, Pageable pageable);
+
+ /**
+ * 查询所有数据不分页
+ * @param criteria 条件参数
+ * @return List<AttendanceMonthDto>
+ */
+ List<AttendanceMonthDto> queryAll(AttendanceMonthQueryCriteria criteria);
+
+ /**
+ * 根据ID查询
+ * @param id ID
+ * @return AttendanceMonthDto
+ */
+ AttendanceMonthDto findById(Long id);
+
+ /**
+ * 创建
+ * @param resources /
+ * @return AttendanceMonthDto
+ */
+ AttendanceMonthDto create(AttendanceMonth resources);
+
+ /**
+ * 编辑
+ * @param resources /
+ */
+ void update(AttendanceMonth resources);
+
+ /**
+ * 多选删除
+ * @param ids /
+ */
+ void deleteAll(Long[] ids);
+
+ /**
+ * 导出数据
+ * @param all 待导出的数据
+ * @param response /
+ * @throws IOException /
+ */
+ void download(List<AttendanceMonthDto> all, HttpServletResponse response) throws IOException;
+
+ /**
+ * 月报个人确认
+ * @param resources
+ */
+ void updateConfirm(AttendanceMonth resources);
+
+ /**
+ * 公示月报记录
+ * @param ids /
+ */
+ void publicity(Long[] ids);
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthDto.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthDto.java
new file mode 100644
index 0000000..2b80a82
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthDto.java
@@ -0,0 +1,121 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.attendance.service.dto;
+
+import lombok.Data;
+import me.zhengjie.base.BaseDTO;
+
+import java.sql.Timestamp;
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+/**
+* @website https://eladmin.vip
+* @description /
+* @author wcd
+* @date 2023-02-10
+**/
+@Data
+public class AttendanceMonthDto extends BaseDTO implements Serializable {
+
+ private Long id;
+
+ /** 统计年月 */
+ private Timestamp attendanceDate;
+
+ /** 用户id */
+ private Long userId;
+
+ /** 公司id */
+ private Long companyId;
+
+ /** 部门id */
+ private Long deptId;
+
+ /** 岗位id */
+ private Long jobId;
+
+ /** 应出勤天数 */
+ private Long requiredAttendanceDays;
+
+ /** 应出勤时长 */
+ private Double requiredAttendanceTime;
+
+ /** 实际出勤天数 */
+ private Long actualAttendanceDays;
+
+ /** 实际出勤时长 */
+ private Double actualAttendanceTime;
+
+ /** 迟到次数 */
+ private Long countOfBeingLate;
+
+ /** 迟到时长 */
+ private Double timeOfBeingLate;
+
+ /** 早退次数 */
+ private Long countOfBeingEarly;
+
+ /** 早退时长 */
+ private Double timeOfBeingEarly;
+
+ /** 外出次数 */
+ private Long goOutNumber;
+
+ /** 外出时长 */
+ private Double goOutTime;
+
+ /** 出差次数 */
+ private Long bussNumber;
+
+ /** 出差时长 */
+ private Double bussTime;
+
+ /** 上班缺卡次数 */
+ private Long onCardNumber;
+
+ /** 下班缺卡次数 */
+ private Long offCardNumber;
+
+ /** 公示状态 */
+ private String isPublicity;
+
+ /** 承认状态 */
+ private String isAdmit;
+
+ /** 备注 */
+ private String remarks;
+
+ /** 用户名 */
+ private String nickName;
+
+ /** 部门名 */
+ private String deptName;
+
+ /** 公司名 */
+ private String companyName;
+
+ /** 岗位名 */
+ private String jobName;
+
+ /** 请假相关数据 */
+ private List<Map> leaveTypeList;
+
+ /** 年假剩余 */
+ private Double yearTime;
+
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthLeaveDto.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthLeaveDto.java
new file mode 100644
index 0000000..eec4cab
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthLeaveDto.java
@@ -0,0 +1,57 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.attendance.service.dto;
+
+import lombok.Data;
+import java.sql.Timestamp;
+import java.io.Serializable;
+
+/**
+* @website https://eladmin.vip
+* @description /
+* @author wcd
+* @date 2023-02-13
+**/
+@Data
+public class AttendanceMonthLeaveDto implements Serializable {
+
+ private Long id;
+
+ /** 月报id */
+ private Long attendanceMonthId;
+
+ /** 统计年月 */
+ private Timestamp attendanceDate;
+
+ /** 用户id */
+ private Long userId;
+
+ /** 请假类型 */
+ private String leaveType;
+
+ /** 请假次数 */
+ private Long leaveCount;
+
+ /** 请假时长 */
+ private Double leaveTime;
+
+ /** 剩余时长 */
+ private Double surplusDuration;
+
+ /** 备注 */
+ private String remarks;
+
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthLeaveQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthLeaveQueryCriteria.java
new file mode 100644
index 0000000..4a676d4
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthLeaveQueryCriteria.java
@@ -0,0 +1,29 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.attendance.service.dto;
+
+import lombok.Data;
+import java.util.List;
+import me.zhengjie.annotation.Query;
+
+/**
+* @website https://eladmin.vip
+* @author wcd
+* @date 2023-02-13
+**/
+@Data
+public class AttendanceMonthLeaveQueryCriteria{
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthQueryCriteria.java
new file mode 100644
index 0000000..83324a0
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceMonthQueryCriteria.java
@@ -0,0 +1,40 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.attendance.service.dto;
+
+import lombok.Data;
+
+import java.sql.Timestamp;
+import java.util.List;
+import me.zhengjie.annotation.Query;
+
+/**
+* @website https://eladmin.vip
+* @author wcd
+* @date 2023-02-10
+**/
+@Data
+public class AttendanceMonthQueryCriteria{
+
+ @Query
+ private Long userId;
+
+ @Query
+ private String attendanceDate;
+
+ @Query
+ private String isPublicity;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/AttendanceMonthLeaveServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/AttendanceMonthLeaveServiceImpl.java
new file mode 100644
index 0000000..22665ac
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/AttendanceMonthLeaveServiceImpl.java
@@ -0,0 +1,110 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.attendance.service.impl;
+
+import me.zhengjie.modules.attendance.domain.AttendanceMonthLeave;
+import me.zhengjie.modules.attendance.service.AttendanceMonthLeaveService;
+import me.zhengjie.modules.attendance.service.mapstruct.AttendanceMonthLeaveMapper;
+import me.zhengjie.utils.ValidationUtil;
+import me.zhengjie.utils.FileUtil;
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.modules.attendance.repository.AttendanceMonthLeaveRepository;
+import me.zhengjie.modules.attendance.service.dto.AttendanceMonthLeaveDto;
+import me.zhengjie.modules.attendance.service.dto.AttendanceMonthLeaveQueryCriteria;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import me.zhengjie.utils.PageUtil;
+import me.zhengjie.utils.QueryHelp;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+
+/**
+* @website https://eladmin.vip
+* @description 服务实现
+* @author wcd
+* @date 2023-02-13
+**/
+@Service
+@RequiredArgsConstructor
+public class AttendanceMonthLeaveServiceImpl implements AttendanceMonthLeaveService {
+
+ private final AttendanceMonthLeaveRepository attendanceMonthLeaveRepository;
+ private final AttendanceMonthLeaveMapper attendanceMonthLeaveMapper;
+
+ @Override
+ public Map<String,Object> queryAll(AttendanceMonthLeaveQueryCriteria criteria, Pageable pageable){
+ Page<AttendanceMonthLeave> page = attendanceMonthLeaveRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
+ return PageUtil.toPage(page.map(attendanceMonthLeaveMapper::toDto));
+ }
+
+ @Override
+ public List<AttendanceMonthLeaveDto> queryAll(AttendanceMonthLeaveQueryCriteria criteria){
+ return attendanceMonthLeaveMapper.toDto(attendanceMonthLeaveRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
+ }
+
+ @Override
+ @Transactional
+ public AttendanceMonthLeaveDto findById(Long id) {
+ AttendanceMonthLeave attendanceMonthLeave = attendanceMonthLeaveRepository.findById(id).orElseGet(AttendanceMonthLeave::new);
+ ValidationUtil.isNull(attendanceMonthLeave.getId(),"AttendanceMonthLeave","id",id);
+ return attendanceMonthLeaveMapper.toDto(attendanceMonthLeave);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public AttendanceMonthLeaveDto create(AttendanceMonthLeave resources) {
+ return attendanceMonthLeaveMapper.toDto(attendanceMonthLeaveRepository.save(resources));
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(AttendanceMonthLeave resources) {
+ AttendanceMonthLeave attendanceMonthLeave = attendanceMonthLeaveRepository.findById(resources.getId()).orElseGet(AttendanceMonthLeave::new);
+ ValidationUtil.isNull( attendanceMonthLeave.getId(),"AttendanceMonthLeave","id",resources.getId());
+ attendanceMonthLeave.copy(resources);
+ attendanceMonthLeaveRepository.save(attendanceMonthLeave);
+ }
+
+ @Override
+ public void deleteAll(Long[] ids) {
+ for (Long id : ids) {
+ attendanceMonthLeaveRepository.deleteById(id);
+ }
+ }
+
+ @Override
+ public void download(List<AttendanceMonthLeaveDto> all, HttpServletResponse response) throws IOException {
+ List<Map<String, Object>> list = new ArrayList<>();
+ for (AttendanceMonthLeaveDto attendanceMonthLeave : all) {
+ Map<String,Object> map = new LinkedHashMap<>();
+ map.put("月报id", attendanceMonthLeave.getAttendanceMonthId());
+ map.put("统计年月", attendanceMonthLeave.getAttendanceDate());
+ map.put("用户id", attendanceMonthLeave.getUserId());
+ map.put("请假类型", attendanceMonthLeave.getLeaveType());
+ map.put("请假次数", attendanceMonthLeave.getLeaveCount());
+ map.put("请假时长", attendanceMonthLeave.getLeaveTime());
+ map.put("剩余时长", attendanceMonthLeave.getSurplusDuration());
+ list.add(map);
+ }
+ FileUtil.downloadExcel(list, response);
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/AttendanceMonthServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/AttendanceMonthServiceImpl.java
new file mode 100644
index 0000000..9bc9549
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/AttendanceMonthServiceImpl.java
@@ -0,0 +1,265 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.attendance.service.impl;
+
+import lombok.SneakyThrows;
+import me.zhengjie.exception.BadRequestException;
+import me.zhengjie.modules.attendance.domain.AttendanceMonth;
+import me.zhengjie.modules.attendance.domain.AttendanceMonthLeave;
+import me.zhengjie.modules.attendance.repository.AttendanceMonthLeaveRepository;
+import me.zhengjie.modules.constant.Constant;
+import me.zhengjie.modules.salary.domain.Salary;
+import me.zhengjie.modules.salary.service.dto.SalaryDto;
+import me.zhengjie.modules.system.domain.Dept;
+import me.zhengjie.modules.system.domain.Job;
+import me.zhengjie.modules.system.domain.SysCompany;
+import me.zhengjie.modules.system.domain.User;
+import me.zhengjie.modules.system.repository.*;
+import me.zhengjie.modules.system.service.RoleService;
+import me.zhengjie.modules.system.service.dto.RoleSmallDto;
+import me.zhengjie.utils.*;
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.modules.attendance.repository.AttendanceMonthRepository;
+import me.zhengjie.modules.attendance.service.AttendanceMonthService;
+import me.zhengjie.modules.attendance.service.dto.AttendanceMonthDto;
+import me.zhengjie.modules.attendance.service.dto.AttendanceMonthQueryCriteria;
+import me.zhengjie.modules.attendance.service.mapstruct.AttendanceMonthMapper;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+
+import java.util.*;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+/**
+* @website https://eladmin.vip
+* @description 服务实现
+* @author wcd
+* @date 2023-02-10
+**/
+@Service
+@RequiredArgsConstructor
+public class AttendanceMonthServiceImpl implements AttendanceMonthService {
+
+ private final AttendanceMonthRepository attendanceMonthRepository;
+ private final AttendanceMonthMapper attendanceMonthMapper;
+ private final UserRepository userRepository;
+ private final SysCompanyRepository sysCompanyRepository;
+ private final DeptRepository deptRepository;
+ private final JobRepository jobRepository;
+ private final AttendanceMonthLeaveRepository attendanceMonthLeaveRepository;
+ private final AttendanceLeaveServiceImpl attendanceLeaveService;
+ private final RoleService roleService;
+ private final DictDetailRepository dictDetailRepository;
+
+ @Override
+ public Map<String,Object> queryAll(AttendanceMonthQueryCriteria criteria, Pageable pageable){
+ // 判断工资查询类年月是否为空
+ if (criteria.getAttendanceDate() != null && !"".equals(criteria.getAttendanceDate())) {
+ // 年月:国际时间转中国时间
+ criteria.setAttendanceDate(DateUtil.internationalTimeToChinaTime(criteria.getAttendanceDate()));
+ }
+ // 获取登录用户角色等级
+ List<Integer> levels = roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList());
+ // 登录用户最大角色等级
+ int min = Collections.min(levels);
+ // 判断角色等级
+ if (min == Constant.ROLE_LEVEL_MANAGER || min == Constant.ROLE_LEVEL_LEADER || min == Constant.ROLE_LEVEL_ORDINARY) {
+ criteria.setUserId(SecurityUtils.getCurrentUserId());
+ criteria.setIsPublicity(Constant.PUBLICITY_STATUS_YES);
+ }
+ Page<AttendanceMonth> page = attendanceMonthRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
+ // 将实体类转换为DTO(重写)
+ Function<AttendanceMonth, AttendanceMonthDto> func = new Function<AttendanceMonth, AttendanceMonthDto>(){
+ @SneakyThrows
+ @Override
+ public AttendanceMonthDto apply(AttendanceMonth t) {
+ // 将实体类转换成DTO
+ AttendanceMonthDto attendanceMonthDto = attendanceMonthMapper.toDto(t);
+ // 根据用户ID查询用户信息
+ User user = userRepository.findById(attendanceMonthDto.getUserId()).orElseGet(User::new);
+ // 用户昵称
+ attendanceMonthDto.setNickName(user.getNickName());
+ // 查询公司
+ SysCompany sysCompany = sysCompanyRepository.findById(attendanceMonthDto.getCompanyId()).orElseGet(SysCompany::new);
+ attendanceMonthDto.setCompanyName(sysCompany.getLabel());
+ // 查询部门
+ Dept dept = deptRepository.findById(attendanceMonthDto.getDeptId()).orElseGet(Dept::new);
+ attendanceMonthDto.setDeptName(dept.getName());
+ // 查询岗位
+ if(ObjectUtils.isNotEmpty(attendanceMonthDto.getJobId())){
+ Job job = jobRepository.findById(attendanceMonthDto.getJobId()).orElseGet(Job::new);
+ attendanceMonthDto.setJobName(job.getName());
+ }
+ List<Map> leaveTypeList = new ArrayList<>();
+ // 查询请假类型表
+ List<AttendanceMonthLeave> attendanceMonthLeaves = attendanceMonthLeaveRepository.findByAttendanceMonthId(attendanceMonthDto.getId());
+ if(attendanceMonthLeaves.size() != 0){
+ for(int i = 0; i < attendanceMonthLeaves.size(); i++){
+ Map attTypeInfo = new HashMap();
+ attTypeInfo.put("leaveType", attendanceMonthLeaves.get(i).getLeaveType());
+ attTypeInfo.put("leaveCount", attendanceMonthLeaves.get(i).getLeaveCount());
+ attTypeInfo.put("leaveTime", attendanceMonthLeaves.get(i).getLeaveTime());
+ if(attendanceMonthLeaves.get(i).getLeaveType().equals(Constant.LEAVE_TYPE_ANNUAL_LEAVE)){
+ attTypeInfo.put("leaveYearTime", attendanceMonthLeaves.get(i).getSurplusDuration() == null ? 0 : attendanceMonthLeaves.get(i).getSurplusDuration());
+ }
+ leaveTypeList.add(attTypeInfo);
+ }
+ }else{
+ Double yearTime = attendanceLeaveService.getYearTimeLength(attendanceMonthDto.getUserId());
+ attendanceMonthDto.setYearTime(yearTime);
+ }
+ attendanceMonthDto.setLeaveTypeList(leaveTypeList);
+ // 返回处理好的DTO
+ return attendanceMonthDto;
+ }
+ };
+ return PageUtil.toPage(page.map(func));
+ }
+
+ @Override
+ public List<AttendanceMonthDto> queryAll(AttendanceMonthQueryCriteria criteria){
+ return attendanceMonthMapper.toDto(attendanceMonthRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
+ }
+
+ @Override
+ @Transactional
+ public AttendanceMonthDto findById(Long id) {
+ AttendanceMonth attendanceMonth = attendanceMonthRepository.findById(id).orElseGet(AttendanceMonth::new);
+ ValidationUtil.isNull(attendanceMonth.getId(),"AttendanceMonth","id",id);
+ return attendanceMonthMapper.toDto(attendanceMonth);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public AttendanceMonthDto create(AttendanceMonth resources) {
+ // 根据用户ID和年月查询
+ AttendanceMonth attendanceMonth = attendanceMonthRepository.findByAttendanceDateAndUserId(resources.getAttendanceDate().toString().substring(0,19),resources.getUserId());
+ // 判断列表长度
+ if (ObjectUtils.isNotEmpty(attendanceMonth)) {
+ throw new BadRequestException("找到相同用户相同年月的月报记录!");
+ }
+ return attendanceMonthMapper.toDto(attendanceMonthRepository.save(resources));
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(AttendanceMonth resources) {
+ // 根据用户ID和年月查询
+ AttendanceMonth attendanceMonth = attendanceMonthRepository.findByAttendanceDateAndUserId(resources.getAttendanceDate().toString().substring(0,19),resources.getUserId());
+ // 判断列表长度
+ if (ObjectUtils.isNotEmpty(attendanceMonth) && attendanceMonth.getId() != resources.getId()) {
+ throw new BadRequestException("找到相同用户相同年月的月报记录!");
+ }
+ // 判断承认状态
+ if (ObjectUtils.isNotEmpty(attendanceMonth) && Constant.APPROVE_STATUS_ACKNOWLEDGED.equals(attendanceMonth.getIsAdmit())) {
+ throw new BadRequestException("已承认的月报记录无法进行修改!");
+ }
+ ValidationUtil.isNull( attendanceMonth.getId(),"AttendanceMonth","id",resources.getId());
+ attendanceMonth.copy(resources);
+ attendanceMonthRepository.save(attendanceMonth);
+ }
+
+ @Override
+ public void deleteAll(Long[] ids) {
+ for (Long id : ids) {
+ attendanceMonthRepository.deleteById(id);
+ }
+ }
+
+ /**
+ * 月报个人确认
+ * @param resources
+ */
+ @Override
+ public void updateConfirm(AttendanceMonth resources) {
+ AttendanceMonth attendanceMonth = attendanceMonthRepository.findById(resources.getId()).orElseGet(AttendanceMonth::new);
+ attendanceMonth.setIsAdmit(Constant.APPROVE_STATUS_ACKNOWLEDGED);
+ attendanceMonthRepository.save(attendanceMonth);
+ }
+
+ /**
+ * 公示月报信息
+ * @param ids /
+ */
+ @Override
+ public void publicity(Long[] ids) {
+ // 循环ID列表
+ for (Long id : ids) {
+ // 查询月报
+ AttendanceMonth attendanceMonth = attendanceMonthRepository.findById(id).orElseGet(AttendanceMonth::new);
+ ValidationUtil.isNull( attendanceMonth.getId(),"AttendanceMonth","id",id);
+ // 公示状态
+ attendanceMonth.setIsPublicity(Constant.PUBLICITY_STATUS_YES);
+ // 保存
+ attendanceMonthRepository.save(attendanceMonth);
+ }
+ }
+
+ @Override
+ public void download(List<AttendanceMonthDto> all, HttpServletResponse response) throws IOException {
+ List<Map<String, Object>> list = new ArrayList<>();
+ for (AttendanceMonthDto attendanceMonth : all) {
+ // 根据用户ID查询用户信息
+ User user = userRepository.findById(attendanceMonth.getUserId()).orElseGet(User::new);
+ // 查询公司
+ SysCompany sysCompany = sysCompanyRepository.findById(attendanceMonth.getCompanyId()).orElseGet(SysCompany::new);
+ // 查询部门
+ Dept dept = deptRepository.findById(attendanceMonth.getDeptId()).orElseGet(Dept::new);
+ Job job = new Job();
+ // 查询岗位
+ if(attendanceMonth.getJobId() != null){
+ job = jobRepository.findById(attendanceMonth.getJobId()).orElseGet(Job::new);
+ }
+ String isAdmit = attendanceMonth.getIsAdmit() != null ? dictDetailRepository.findByDictNameAndValue(Constant.APPROVE_STATUS_ACKNOWLEDGED, attendanceMonth.getIsAdmit()).getLabel() : "";
+ String isP = attendanceMonth.getIsPublicity() != null ? dictDetailRepository.findByDictNameAndValue(Constant.PUBLICITY_STATUS_YES, attendanceMonth.getIsPublicity()).getLabel() : "";
+ Map<String,Object> map = new LinkedHashMap<>();
+ map.put("统计年月", attendanceMonth.getAttendanceDate());
+ map.put("用户", user.getNickName());
+ map.put("公司", sysCompany.getLabel());
+ map.put("部门", dept.getName());
+ map.put("岗位", job == null ? null : job.getName());
+ map.put("应出勤天数", attendanceMonth.getRequiredAttendanceDays());
+ map.put("应出勤时长", attendanceMonth.getRequiredAttendanceTime());
+ map.put("实际出勤天数", attendanceMonth.getActualAttendanceDays());
+ map.put("实际出勤时长", attendanceMonth.getActualAttendanceTime());
+ map.put("迟到次数", attendanceMonth.getCountOfBeingLate());
+ map.put("迟到时长", attendanceMonth.getTimeOfBeingLate());
+ map.put("早退次数", attendanceMonth.getCountOfBeingEarly());
+ map.put("早退时长", attendanceMonth.getTimeOfBeingEarly());
+ map.put("外出次数", attendanceMonth.getGoOutNumber());
+ map.put("外出时长", attendanceMonth.getGoOutTime());
+ map.put("出差次数", attendanceMonth.getBussNumber());
+ map.put("出差时长", attendanceMonth.getBussTime());
+ map.put("上班缺卡次数", attendanceMonth.getOnCardNumber());
+ map.put("下班缺卡次数", attendanceMonth.getOffCardNumber());
+ map.put("公示状态", attendanceMonth.getIsPublicity());
+ map.put("承认状态", isAdmit);
+ map.put("备注", attendanceMonth.getRemarks());
+ map.put("创建者", attendanceMonth.getCreateBy());
+ map.put("创建时间", attendanceMonth.getCreateTime());
+ map.put("更新者", attendanceMonth.getUpdateBy());
+ map.put("更新时间", attendanceMonth.getUpdateTime());
+ list.add(map);
+ }
+ FileUtil.downloadExcel(list, response);
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/mapstruct/AttendanceMonthLeaveMapper.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/mapstruct/AttendanceMonthLeaveMapper.java
new file mode 100644
index 0000000..0e0f6df
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/mapstruct/AttendanceMonthLeaveMapper.java
@@ -0,0 +1,32 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.attendance.service.mapstruct;
+
+import me.zhengjie.base.BaseMapper;
+import me.zhengjie.modules.attendance.domain.AttendanceMonthLeave;
+import me.zhengjie.modules.attendance.service.dto.AttendanceMonthLeaveDto;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+
+/**
+* @website https://eladmin.vip
+* @author wcd
+* @date 2023-02-13
+**/
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
+public interface AttendanceMonthLeaveMapper extends BaseMapper<AttendanceMonthLeaveDto, AttendanceMonthLeave> {
+
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/mapstruct/AttendanceMonthMapper.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/mapstruct/AttendanceMonthMapper.java
new file mode 100644
index 0000000..8084e01
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/mapstruct/AttendanceMonthMapper.java
@@ -0,0 +1,32 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.attendance.service.mapstruct;
+
+import me.zhengjie.base.BaseMapper;
+import me.zhengjie.modules.attendance.domain.AttendanceMonth;
+import me.zhengjie.modules.attendance.service.dto.AttendanceMonthDto;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+
+/**
+* @website https://eladmin.vip
+* @author wcd
+* @date 2023-02-10
+**/
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
+public interface AttendanceMonthMapper extends BaseMapper<AttendanceMonthDto, AttendanceMonth> {
+
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/AttendanceMonthTalkServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/AttendanceMonthTalkServiceImpl.java
new file mode 100644
index 0000000..3d3c665
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/AttendanceMonthTalkServiceImpl.java
@@ -0,0 +1,242 @@
+package me.zhengjie.modules.quartz.service.impl;
+
+
+import cn.hutool.core.util.ObjectUtil;
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.modules.attendance.domain.*;
+import me.zhengjie.modules.attendance.repository.*;
+import me.zhengjie.modules.attendance.service.impl.AttendanceLeaveServiceImpl;
+import me.zhengjie.modules.attendance.service.impl.AttendanceServiceImpl;
+import me.zhengjie.modules.constant.Constant;
+import me.zhengjie.modules.system.domain.Job;
+import me.zhengjie.modules.system.domain.Role;
+import me.zhengjie.modules.system.domain.SysConfigHoliday;
+import me.zhengjie.modules.system.domain.User;
+import me.zhengjie.modules.system.repository.SysConfigHolidayRepository;
+import me.zhengjie.modules.system.repository.UserRepository;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.stereotype.Service;
+
+import javax.transaction.Transactional;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.DayOfWeek;
+import java.time.Duration;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.TemporalAdjusters;
+import java.util.*;
+
+@Service
+@Transactional
+@RequiredArgsConstructor
+public class AttendanceMonthTalkServiceImpl {
+
+ private final AttendanceRepository attendanceRepository;
+ private final UserRepository userRepository;
+ private final SysConfigHolidayRepository sysConfigHolidayRepository;
+ private final AttendanceGoOutRepository attendanceGoOutRepository;
+ private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository;
+ private final AttendanceLeaveRepository attendanceLeaveRepository;
+ private final AttendanceMonthRepository attendanceMonthRepository;
+ private final AttendanceMonthLeaveRepository attendanceMonthLeaveRepository;
+ private final AttendanceLeaveServiceImpl attendanceLeaveService;
+
+ /**
+ * 月报set
+ */
+ public void getMonthlyInfo() throws ParseException {
+ //节假日,工作日
+ List<Timestamp> holiday = new ArrayList<>(), isWork = new ArrayList<>();
+ // 查询节假日
+ List<SysConfigHoliday> sysConfigHolidayList = sysConfigHolidayRepository.findAll();
+ for(SysConfigHoliday sysConfigHoliday : sysConfigHolidayList){
+ if(sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_WEEKDAY)){
+ //工作日
+ isWork.add(sysConfigHoliday.getHolidayDate());
+ }else{
+ holiday.add(sysConfigHoliday.getHolidayDate());
+ }
+ }
+
+ Map<Long, AttendanceMonth> info = new HashMap<>();
+ DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM");
+ LocalDate localDate = LocalDate.now();
+ localDate = localDate.minusMonths(1);
+ //上月第一天
+ String baseDate = dateTimeFormatter.format(localDate);
+ // 查询上个月考勤表
+ List<Attendance> attendanceList = attendanceRepository.findAllLikeDate(baseDate + "%");
+ for(Attendance attendance : attendanceList){
+ // 查询用户
+ User user = userRepository.findById(attendance.getUserId()).orElseGet(User::new);
+ Long userId = attendance.getUserId();
+ if (!info.containsKey(userId)) {
+ info.put(userId, new AttendanceMonth());
+ info.get(userId).setAttendanceDate(Timestamp.valueOf(baseDate + "-01 00:00:00"));
+ info.get(userId).setUserId(userId);
+ info.get(userId).setCompanyId(user.getCompanyId());
+ info.get(userId).setDeptId(user.getDept().getId());
+ // 查询岗位
+ if(user.getJobs().size() != 0){
+ Job job = user.getJobs().iterator().next();
+ info.get(userId).setJobId(job.getId());
+ }
+ }
+ DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ Boolean isWeekend = LocalDate.parse(attendance.getAttendanceDate().toString().substring(0,10), dateTimeFormatter1).getDayOfWeek() == DayOfWeek.SATURDAY || LocalDate.parse(attendance.getAttendanceDate().toString().substring(0,10), dateTimeFormatter1).getDayOfWeek() == DayOfWeek.SUNDAY;
+ // 不是周末并且节假日表中不存在 或者 是周末并且工作日数组中存在
+ if((!isWeekend && !holiday.contains(attendance.getAttendanceDate())) || (isWeekend && isWork.contains(attendance.getAttendanceDate()))){
+ // 应出勤天数
+ info.get(userId).setRequiredAttendanceDays(info.get(userId).getRequiredAttendanceDays() == null ? 1 : info.get(userId).getRequiredAttendanceDays() + 1);
+ // 实际出勤天数
+ if(ObjectUtils.isNotEmpty(attendance.getActualWorkStartTime()) || ObjectUtils.isNotEmpty(attendance.getActualWorkEndTime())){
+ info.get(userId).setActualAttendanceDays(info.get(userId).getActualAttendanceDays() == null ? 1 : info.get(userId).getActualAttendanceDays() + 1);
+ }
+ if(ObjectUtils.isNotEmpty(attendance.getActualWorkStartTime()) && attendance.getStartClockResults().equals(Constant.ATTENDANCE_START_LATE)){
+ // 迟到次数
+ info.get(userId).setCountOfBeingLate(info.get(userId).getCountOfBeingLate() == null ? 1 : info.get(userId).getCountOfBeingLate() + 1);
+ Duration onDuration = Duration.between(attendance.getRosteringWorkStartTime().toLocalDateTime(), attendance.getActualWorkStartTime().toLocalDateTime());
+ // 迟到时长
+ info.get(userId).setTimeOfBeingLate(info.get(userId).getTimeOfBeingLate() == null ? Double.valueOf(new BigDecimal((float) onDuration.getSeconds() / 3600).setScale(2, BigDecimal.ROUND_HALF_UP).toString()) : Double.valueOf(BigDecimal.valueOf(info.get(userId).getTimeOfBeingLate()).add(new BigDecimal((float) onDuration.getSeconds() / 3600).setScale(2, BigDecimal.ROUND_HALF_UP)).toString()));
+ }
+ if(ObjectUtils.isNotEmpty(attendance.getActualWorkEndTime()) && attendance.getEndClockResults().equals(Constant.ATTENDANCE_START_EARLY)){
+ // 早退次数
+ info.get(userId).setCountOfBeingEarly(info.get(userId).getCountOfBeingEarly() == null ? 1 : info.get(userId).getCountOfBeingEarly() + 1);
+ Duration offDuration = Duration.between(attendance.getActualWorkEndTime().toLocalDateTime(), attendance.getRosteringWorkEndTime().toLocalDateTime());
+ // 早退时长
+ info.get(userId).setTimeOfBeingEarly(info.get(userId).getTimeOfBeingEarly() == null ? Double.valueOf(new BigDecimal((float) offDuration.getSeconds() / 3600).setScale(2, BigDecimal.ROUND_HALF_UP).toString()) : Double.valueOf(BigDecimal.valueOf(info.get(userId).getTimeOfBeingEarly()).add(new BigDecimal((float) offDuration.getSeconds() / 3600).setScale(2, BigDecimal.ROUND_HALF_UP)).toString()));
+ }
+ if(attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_NOTSIGNED)){
+ // 上班缺卡次数
+ info.get(userId).setOnCardNumber(info.get(userId).getOnCardNumber() == null ? 1 : info.get(userId).getOnCardNumber() + 1);
+ }
+ if(attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_NOTSIGNED)){
+ // 下班缺卡次数
+ info.get(userId).setOffCardNumber(info.get(userId).getOffCardNumber() == null ? 1 : info.get(userId).getOffCardNumber() + 1);
+ }
+ }
+ }
+
+ LocalDateTime startTime = localDate.with(TemporalAdjusters.firstDayOfMonth()).atTime(0, 0, 0);
+ LocalDateTime endTime = localDate.with(TemporalAdjusters.lastDayOfMonth()).atTime(23, 59, 59);
+ List<AttendanceMonth> insertData = new ArrayList<>();
+ for (AttendanceMonth value : info.values()) {
+ // 查询当月外出
+ List<AttendanceGoOut> goOutList = attendanceGoOutRepository.findByUserAndDate(value.getUserId(), startTime, endTime);
+ int goOutNumber = goOutList.size();
+ // 外出次数
+ value.setGoOutNumber(Long.valueOf(goOutNumber));
+ Double goOutTimes = 0.0;
+ for(int i = 0; i < goOutList.size(); i++){
+ goOutTimes = goOutTimes + goOutList.get(i).getOutDuration();
+ }
+ // 外出时长
+ value.setGoOutTime(goOutTimes);
+ // 查询当月的出差
+ List<AttendanceBusinessTravel> businessTravelList = attendanceBusinessTravelRepository.findByUserAndSEDate(value.getUserId(), startTime, endTime);
+ int bussNumber = businessTravelList.size();
+ // 出差次数
+ value.setBussNumber(Long.valueOf(bussNumber));
+ // 出差时长
+ value.setBussTime(Double.valueOf(bussNumber * 8));
+ // 应出勤时长
+ value.setRequiredAttendanceTime(Double.valueOf(value.getRequiredAttendanceDays() * 8));
+ // 查询当月请假
+ List<AttendanceLeave> leaveList = attendanceLeaveRepository.findByUserIdAndDate(value.getUserId(), startTime, endTime);
+ // 当月请假时长
+ Double leaveTimes = 0.0;
+ for(int i = 0; i < leaveList.size(); i++){
+ // 时间单位为小时就直接加,否则就是天为单位需要乘8
+ leaveTimes = leaveList.get(i).getLeaveDurationUnit().equals(Constant.LEAVE_TIME_TYPE_HOUR) ? leaveTimes + leaveList.get(i).getLeaveDuration() : leaveTimes + leaveList.get(i).getLeaveDuration() * 8;
+ }
+ // 实际出勤时长
+ value.setActualAttendanceTime(Double.valueOf(value.getRequiredAttendanceTime() - leaveTimes));
+ //验证考勤月报的确认按钮
+ AttendanceMonth attendanceMonthly = attendanceMonthRepository.findByAttendanceDateAndUserId(baseDate + "-01 00:00:00", value.getUserId());
+ if(ObjectUtil.isNotEmpty(attendanceMonthly) && attendanceMonthly.getIsAdmit() != null && attendanceMonthly.getIsAdmit().equals(Constant.APPROVE_STATUS_ACKNOWLEDGED)){
+ value.setIsAdmit(attendanceMonthly.getIsAdmit());
+ }
+ if(ObjectUtil.isNotEmpty(attendanceMonthly) && attendanceMonthly.getIsPublicity() != null && attendanceMonthly.getIsPublicity().equals(Constant.PUBLICITY_STATUS_YES)){
+ value.setIsPublicity(attendanceMonthly.getIsPublicity());
+ }
+ insertData.add(value);
+ }
+ // 删除上个月信息
+ attendanceMonthRepository.deleteByActualAttendanceDays(baseDate + "-01 00:00:00");
+ // 保存当前添加的记录
+ attendanceMonthRepository.saveAll(insertData);
+
+ // 查询月报相关请假类型表
+ List<AttendanceMonthLeave> attendanceMonthLeaves = attendanceMonthLeaveRepository.findByAttendanceDate(baseDate + "-01 00:00:00");
+ if(attendanceMonthLeaves.size() != 0){
+ for(AttendanceMonthLeave attendanceMonthLeave : attendanceMonthLeaves){
+ // 删除数据
+ attendanceMonthLeaveRepository.deleteById(attendanceMonthLeave.getId());
+ }
+ }
+ // 月报相关的请假类型添加
+ for(int i = 0; i < insertData.size(); i++){
+ // 查询当月请假
+ List<AttendanceLeave> leaves = attendanceLeaveRepository.findByUserIdAndDate(insertData.get(i).getUserId(), startTime, endTime);
+ // 请假类型集合
+ List<String> leaveTpeList = new ArrayList<>();
+ for(int i1 = 0; i1 < leaves.size(); i1++){
+ // 当前循环人员的所有请假类型
+ leaveTpeList.add(leaves.get(i1).getLeaveType());
+ }
+
+ // 请假类型去重
+ HashSet h = new HashSet(leaveTpeList);
+ leaveTpeList.clear();
+ leaveTpeList.addAll(h);
+
+ // 遍历请假类型集合添加数据
+ for(int i2 = 0; i2 < leaveTpeList.size(); i2++){
+ AttendanceMonthLeave attendanceMonthLeave = new AttendanceMonthLeave();
+ attendanceMonthLeave.setAttendanceMonthId(insertData.get(i).getId());
+ attendanceMonthLeave.setAttendanceDate(insertData.get(i).getAttendanceDate());
+ attendanceMonthLeave.setUserId(insertData.get(i).getUserId());
+ // 请假类型
+ attendanceMonthLeave.setLeaveType(leaveTpeList.get(i2));
+ // 根据请假类型查询请假
+ List<AttendanceLeave> leaveList = attendanceLeaveRepository.findByUserIdAndDateAndLeaveType(insertData.get(i).getUserId(), startTime, endTime,leaveTpeList.get(i2));
+ // 请假次数
+ attendanceMonthLeave.setLeaveCount(Long.valueOf(leaveList.size()));
+ // 请假类型时长
+ attendanceMonthLeave.setLeaveTime(getLeaveDuration(leaves,leaveTpeList.get(i2)));
+ //年假剩余时长
+ if(leaveTpeList.get(i2).equals(Constant.LEAVE_TYPE_ANNUAL_LEAVE)){
+ Double yearTime = attendanceLeaveService.getYearTimeLength(insertData.get(i).getUserId());
+ attendanceMonthLeave.setSurplusDuration(yearTime);
+ }
+ attendanceMonthLeaveRepository.save(attendanceMonthLeave);
+ }
+ }
+ }
+
+ /**
+ * 获取请假时长
+ * @param leaveList
+ * @return
+ */
+ public Double getLeaveDuration(List<AttendanceLeave> leaveList, String type){
+ Double leaveTimes = 0.0;
+ for(int i = 0; i < leaveList.size(); i++){
+ //时间单位为小时就直接加
+ if(leaveList.get(i).getLeaveType().equals(type)){
+ if(leaveList.get(i).getLeaveDurationUnit().equals(Constant.LEAVE_TIME_TYPE_HOUR)){
+ leaveTimes = leaveList.get(i).getLeaveDuration() + leaveTimes;
+ }
+ }
+ //天为单位需要乘8
+ if(leaveList.get(i).getLeaveDurationUnit().equals(Constant.LEAVE_TIME_TYPE_DAY)){
+ leaveTimes = leaveList.get(i).getLeaveDuration() * 8 + leaveTimes;
+ }
+ }
+ return leaveTimes;
+ }
+}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/AttendanceMonthlyMethod.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/AttendanceMonthlyMethod.java
new file mode 100644
index 0000000..ae2b2e6
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/AttendanceMonthlyMethod.java
@@ -0,0 +1,26 @@
+package me.zhengjie.modules.quartz.task;
+
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import me.zhengjie.modules.quartz.service.impl.AttendanceMonthTalkServiceImpl;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.text.ParseException;
+
+/**
+ * 月报定时任务,每月初执行
+ */
+@Slf4j
+@Service
+@RequiredArgsConstructor
+@Async
+public class AttendanceMonthlyMethod {
+
+ private final AttendanceMonthTalkServiceImpl attendanceMonthService;
+
+ public void getMonthlyData() throws ParseException {
+ // 调用方法
+ attendanceMonthService.getMonthlyInfo();
+ }
+}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java
index 44f56e8..182de83 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java
@@ -62,6 +62,8 @@
return new ResponseEntity<>(PageUtil.toPage(deptDtos, deptDtos.size()),HttpStatus.OK);
}
+
+
@ApiOperation("查询部门:根据ID获取同级与上级数据")
@PostMapping("/superior")
@PreAuthorize("@el.check('user:list','dept:list')")
diff --git a/eladmin-web-master/src/api/attendance/attendanceMonth.js b/eladmin-web-master/src/api/attendance/attendanceMonth.js
new file mode 100644
index 0000000..c44f6da
--- /dev/null
+++ b/eladmin-web-master/src/api/attendance/attendanceMonth.js
@@ -0,0 +1,51 @@
+import request from '@/utils/request'
+
+export function getAll(params) {
+ return request({
+ url: 'api/attendanceMonth/all',
+ method: 'get',
+ params
+ })
+}
+
+export function add(data) {
+ return request({
+ url: 'api/attendanceMonth',
+ method: 'post',
+ data
+ })
+}
+
+export function del(ids) {
+ return request({
+ url: 'api/attendanceMonth/',
+ method: 'delete',
+ data: ids
+ })
+}
+
+export function edit(data) {
+ return request({
+ url: 'api/attendanceMonth',
+ method: 'put',
+ data
+ })
+}
+
+export function updateIsConfirm(data) {
+ return request({
+ url: 'api/attendanceMonth/updateIsConfirm',
+ method: 'put',
+ data
+ })
+}
+
+export function publicity(ids) {
+ return request({
+ url: 'api/attendanceMonth/publicity/',
+ method: 'put',
+ data: ids
+ })
+}
+
+export default { add, edit, del, getAll, updateIsConfirm, publicity }
diff --git a/eladmin-web-master/src/api/system/dept.js b/eladmin-web-master/src/api/system/dept.js
index ed4f944..0b0c1fc 100644
--- a/eladmin-web-master/src/api/system/dept.js
+++ b/eladmin-web-master/src/api/system/dept.js
@@ -41,4 +41,12 @@
})
}
-export default { add, edit, del, getDepts, getDeptSuperior }
+export function getAll(params) {
+ return request({
+ url: 'api/dept/all',
+ method: 'get',
+ params
+ })
+}
+
+export default { add, edit, del, getDepts, getDeptSuperior, getAll }
diff --git a/eladmin-web-master/src/views/attendance/attendanceCardReplacement/index.vue b/eladmin-web-master/src/views/attendance/attendanceCardReplacement/index.vue
index 36bb54e..dd3a9c4 100644
--- a/eladmin-web-master/src/views/attendance/attendanceCardReplacement/index.vue
+++ b/eladmin-web-master/src/views/attendance/attendanceCardReplacement/index.vue
@@ -289,20 +289,20 @@
'user'
])
},
- watch: {
- 'form.cardReplacementDistinguish'(value) {
- if (this.form.cardReplacementTime) {
- let time = null
- if (value === 'card_replacement_differentiation_goOn') {
- time = this.$store.state.user.user.sysRostering.workStartTime.split(':')
- } else {
- time = this.$store.state.user.user.sysRostering.workEndTime.split(':')
- }
- const date = new Date(this.form.cardReplacementTime).setHours(time[0], time[1], 0)
- this.form.cardReplacementTime = new Date(date)
- }
- }
- },
+ // watch: {
+ // 'form.cardReplacementDistinguish'(value) {
+ // if (this.form.cardReplacementTime) {
+ // let time = null
+ // if (value === 'card_replacement_differentiation_goOn') {
+ // time = this.$store.state.user.user.sysRostering.workStartTime.split(':')
+ // } else {
+ // time = this.$store.state.user.user.sysRostering.workEndTime.split(':')
+ // }
+ // const date = new Date(this.form.cardReplacementTime).setHours(time[0], time[1], 0)
+ // this.form.cardReplacementTime = new Date(date)
+ // }
+ // }
+ // },
methods: {
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
diff --git a/eladmin-web-master/src/views/attendance/attendanceMonth/index.vue b/eladmin-web-master/src/views/attendance/attendanceMonth/index.vue
new file mode 100644
index 0000000..2dfdc25
--- /dev/null
+++ b/eladmin-web-master/src/views/attendance/attendanceMonth/index.vue
@@ -0,0 +1,584 @@
+<template>
+ <div class="app-container">
+ <!--工具栏-->
+ <div class="head-container">
+ <div>
+ <el-date-picker v-model="query.attendanceDate" type="month" clearable placeholder="统计年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
+ <el-select v-model="query.userId" filterable clearable placeholder="所属员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
+ <el-option
+ v-for="item in users"
+ :key="item.id"
+ :label="item.nickName"
+ :value="item.id"
+ />
+ </el-select>
+ <rrOperation />
+ </div>
+ <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
+ <crudOperation :permission="permission">
+ <el-button
+ slot="right"
+ v-permission="permission.publicity"
+ class="filter-item"
+ size="mini"
+ type="primary"
+ icon="el-icon-s-check"
+ :disabled="crud.selections.length === 0"
+ style="margin-right: 6px;"
+ @click="multiplePublicity(crud.selections)"
+ >公示</el-button>
+ <el-button
+ slot="right"
+ v-permission="permission.admit"
+ class="filter-item"
+ size="mini"
+ type="primary"
+ icon="el-icon-share"
+ :disabled="crud.selections.length === 0 || crud.selections.length > 1"
+ @click="attendanceMAdmit(crud.selections[0])"
+ >承认</el-button>
+ </crudOperation>
+ <!--表单组件-->
+ <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
+ <el-form ref="form" :model="form" :rules="rules" size="small" label-width="100px">
+ <el-form-item label="统计年月" prop="attendanceDate">
+ <el-date-picker
+ v-model="form.attendanceDate"
+ type="month"
+ style="width: 350px;"
+ placeholder="请选择"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ />
+ </el-form-item>
+ <el-form-item label="所属员工" prop="userId">
+ <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 350px;">
+ <el-option
+ v-for="item in users"
+ :key="item.id"
+ :label="item.nickName"
+ :value="item.id"
+ :disabled="!item.enabled"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="所属公司" prop="companyId">
+ <el-select v-model="form.companyId" filterable clearable placeholder="请选择" style="width: 350px;">
+ <el-option
+ v-for="item in companys"
+ :key="item.id"
+ :label="item.label"
+ :value="item.id"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="所属部门" prop="deptId">
+ <treeselect
+ v-model="form.deptId"
+ :options="depts"
+ :load-options="loadDepts"
+ style="width: 350px"
+ placeholder="选择部门"
+ />
+ </el-form-item>
+ <el-form-item label="所属岗位" prop="jobId">
+ <el-select
+ v-model="form.jobId"
+ style="width: 350px"
+ :multiple-limit="1"
+ placeholder="请选择"
+ >
+ <el-option
+ v-for="item in jobs"
+ :key="item.name"
+ :label="item.name"
+ :value="item.id"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="应出勤天数" prop="requiredAttendanceDays">
+ <el-input v-model="form.requiredAttendanceDays" style="width: 350px;" />
+ </el-form-item>
+ <el-form-item label="应出勤时长" prop="requiredAttendanceTime">
+ <el-input v-model="form.requiredAttendanceTime" style="width: 350px;" />
+ </el-form-item>
+ <el-form-item label="实际出勤天数" prop="actualAttendanceDays">
+ <el-input v-model="form.actualAttendanceDays" style="width: 350px;" />
+ </el-form-item>
+ <el-form-item label="实际出勤时长" prop="actualAttendanceTime">
+ <el-input v-model="form.actualAttendanceTime" style="width: 350px;" />
+ </el-form-item>
+ <el-form-item label="迟到次数" prop="countOfBeingLate">
+ <el-input v-model="form.countOfBeingLate" style="width: 350px;" />
+ </el-form-item>
+ <el-form-item label="迟到时长" prop="timeOfBeingLate">
+ <el-input v-model="form.timeOfBeingLate" style="width: 350px;" />
+ </el-form-item>
+ <el-form-item label="早退次数" prop="countOfBeingEarly">
+ <el-input v-model="form.countOfBeingEarly" style="width: 350px;" />
+ </el-form-item>
+ <el-form-item label="早退时长" prop="timeOfBeingEarly">
+ <el-input v-model="form.timeOfBeingEarly" style="width: 350px;" />
+ </el-form-item>
+ <el-form-item label="外出次数" prop="goOutNumber">
+ <el-input v-model="form.goOutNumber" style="width: 350px;" />
+ </el-form-item>
+ <el-form-item label="外出时长" prop="goOutTime">
+ <el-input v-model="form.goOutTime" style="width: 350px;" />
+ </el-form-item>
+ <el-form-item label="出差次数" prop="bussNumber">
+ <el-input v-model="form.bussNumber" style="width: 350px;" />
+ </el-form-item>
+ <el-form-item label="出差时长" prop="bussTime">
+ <el-input v-model="form.bussTime" style="width: 350px;" />
+ </el-form-item>
+ <el-form-item label="上班缺卡次数" prop="onCardNumber">
+ <el-input v-model="form.onCardNumber" style="width: 350px;" />
+ </el-form-item>
+ <el-form-item label="下班缺卡次数" prop="offCardNumber">
+ <el-input v-model="form.offCardNumber" style="width: 350px;" />
+ </el-form-item>
+ <el-form-item label="备注">
+ <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 350px;" />
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button type="text" @click="crud.cancelCU">取消</el-button>
+ <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
+ </div>
+ </el-dialog>
+ <!--表格渲染-->
+ <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
+ <el-table-column type="selection" fixed="left" width="55" />
+ <el-table-column fixed="left" type="expand">
+ <template slot-scope="scope">
+ <el-form label-position="left" class="my-demo-table-expand" style="margin-left: 264px;">
+ <template v-if="scope.row.yearTime == undefined">
+ <el-form-item
+ v-for="(item,adIndex) in (scope.row.leaveTypeList)"
+ :key="adIndex"
+ :label="'请假类型:' + dict.label[dictLeaveType][item.leaveType] + '\u00a0\u00a0\u00a0' + '请假次数:'
+ + item.leaveCount + '\u00a0\u00a0\u00a0' +'请假时间:'
+ + item.leaveTime + '(时)' + '\u00a0\u00a0\u00a0' + (item.leaveYearTime == undefined ? '' : '年假剩余:'
+ + item.leaveYearTime + '(时)')"
+ />
+ </template>
+ <template v-if="scope.row.yearTime !== undefined">
+ <el-form-item label="年假剩余:">
+ <span>{{ scope.row.yearTime + '(时)' }}</span>
+ </el-form-item>
+ </template>
+ </el-form>
+ </template>
+ </el-table-column>
+ <el-table-column prop="attendanceDate" label="统计年月" fixed="left" width="125" align="center" show-overflow-tooltip>
+ <template slot-scope="scope">
+ {{ crud.toMonth(scope.row.attendanceDate) }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="userId" label="姓名" fixed="left" width="125" align="center" show-overflow-tooltip>
+ <template slot-scope="scope">
+ <el-tag>{{ scope.row.nickName }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column label="基本信息" align="center" show-overflow-tooltip>
+ <el-table-column prop="companyId" label="公司" width="150">
+ <template slot-scope="scope">
+ <el-tag>{{ scope.row.companyName }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column prop="deptId" label="部门" width="150" show-overflow-tooltip>
+ <template slot-scope="scope">
+ <el-tag>{{ scope.row.deptName }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column prop="jobId" label="岗位" width="150" show-overflow-tooltip>
+ <template slot-scope="scope">
+ <el-tag>{{ scope.row.jobName }}</el-tag>
+ </template>
+ </el-table-column>
+ </el-table-column>
+ <el-table-column prop="requiredAttendanceDays" label="应出勤天数 / 应出勤时长" width="160" align="center" show-overflow-tooltip>
+ <template slot-scope="scope">
+ {{ (scope.row.requiredAttendanceDays == null ? 0 : scope.row.requiredAttendanceDays) + ' / ' + (scope.row.requiredAttendanceTime == null ? 0 : scope.row.requiredAttendanceTime) }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="actualAttendanceDays" label="实际出勤天数 / 实际出勤时长" width="180" align="center" show-overflow-tooltip>
+ <template slot-scope="scope">
+ {{ (scope.row.actualAttendanceDays == null ? 0 : scope.row.actualAttendanceDays) + ' / ' + (scope.row.actualAttendanceTime == null ? 0 : scope.row.actualAttendanceTime) }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="countOfBeingLate" label="迟到次数 / 迟到时长" width="150" align="center" show-overflow-tooltip>
+ <template slot-scope="scope">
+ {{ (scope.row.countOfBeingLate == null ? 0 : scope.row.countOfBeingLate) + ' / ' + (scope.row.timeOfBeingLate == null ? 0 : scope.row.timeOfBeingLate) }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="countOfBeingEarly" label="早退次数 / 早退时长" width="150" align="center" show-overflow-tooltip>
+ <template slot-scope="scope">
+ {{ (scope.row.countOfBeingEarly == null ? 0 : scope.row.countOfBeingEarly) + ' / ' + (scope.row.timeOfBeingEarly == null ? 0 : scope.row.timeOfBeingEarly) }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="onCardNumber" label=" 上班缺卡次数" width="150" align="center" show-overflow-tooltip>
+ <template slot-scope="scope">
+ {{ (scope.row.onCardNumber == null ? 0 : scope.row.onCardNumber) }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="offCardNumber" label=" 下班缺卡次数" width="150" align="center" show-overflow-tooltip>
+ <template slot-scope="scope">
+ {{ (scope.row.offCardNumber == null ? 0 : scope.row.offCardNumber) }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="goOutNumber" label="外出次数 / 外出时长" width="150" align="center" show-overflow-tooltip>
+ <template slot-scope="scope">
+ {{ (scope.row.goOutNumber == null ? 0 : scope.row.goOutNumber) + ' / ' + (scope.row.goOutTime == null ? 0 : scope.row.goOutTime) }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="bussNumber" label="出差次数 / 出差时长" width="150" align="center" show-overflow-tooltip>
+ <template slot-scope="scope">
+ {{ (scope.row.bussNumber == null ? 0 : scope.row.bussNumber) + ' / ' + (scope.row.bussTime == null ? 0 : scope.row.bussTime) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="isPublicity" label="公示状态" width="80" fixed="right">
+ <template slot-scope="scope">
+ <el-tag v-if="scope.row.isPublicity != null">{{ dict.label[publicityStatus][scope.row.isPublicity] }}</el-tag>
+ <el-tag v-if="scope.row.isPublicity == null">{{ '未公示' }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="isAdmit" label="承认状态" width="80" fixed="right">
+ <template slot-scope="scope">
+ <el-tag v-if="scope.row.isAdmit != null">{{ dict.label[approveStatus][scope.row.isAdmit] }}</el-tag>
+ <el-tag v-if="scope.row.isAdmit == null">{{ '未承认' }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column v-if="checkPer(['admin','attendanceMonth:edit','attendanceMonth:del'])" label="操作" fixed="right" width="210px" align="center">
+ <template slot-scope="scope">
+ <udOperation
+ :data="scope.row"
+ :permission="permission"
+ >
+ <el-popover slot="left" :ref="`publicity_${scope.row.id}`" v-permission="permission.publicity" placement="top" width="180">
+ <p>确定公示本条数据吗?</p>
+ <div style="text-align: right; margin: 0">
+ <el-button size="mini" type="text" @click="publicityCancel(scope.row)">取消</el-button>
+ <el-button :loading="publicityLoading" type="primary" size="mini" @click="doPublicity(scope.row)">确定</el-button>
+ </div>
+ <el-button slot="reference" type="primary" icon="el-icon-s-check" size="mini" />
+ </el-popover>
+ <el-popover slot="left" :ref="`admit_${scope.row.id}`" v-permission="permission.admit" placement="top" width="180">
+ <p>确定承认本条数据吗?</p>
+ <div style="text-align: right; margin: 0">
+ <el-button size="mini" type="text" @click="approveCancel(scope.row)">取消</el-button>
+ <el-button :loading="approveLoading" type="primary" size="mini" @click="doApprove(scope.row)">确定</el-button>
+ </div>
+ <el-button slot="reference" type="primary" icon="el-icon-finished" size="mini" style="margin-left: 3px;" />
+ </el-popover>
+ </udOperation>
+ </template>
+ </el-table-column>
+ </el-table>
+ <!--分页组件-->
+ <pagination />
+ </div>
+ </div>
+</template>
+
+<script>
+import crudAttendanceMonth from '@/api/attendance/attendanceMonth'
+import crudSysCompany from '@/api/system/sysCompany'
+import crudDept from '@/api/system/dept'
+import crudJob from '@/api/system/job'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
+import Treeselect from '@riophae/vue-treeselect'
+import CRUD, { presenter, header, form, crud } from '@crud/crud'
+import crudUser from '@/api/system/user'
+import rrOperation from '@crud/RR.operation'
+import crudOperation from '@crud/CRUD.operation'
+import udOperation from '@crud/UD.operation'
+import pagination from '@crud/Pagination'
+import constant from '@/utils/constant'
+
+const defaultForm = { id: null, attendanceDate: null, userId: null, companyId: null, deptId: null, jobId: null, requiredAttendanceDays: null, requiredAttendanceTime: null, actualAttendanceDays: null, actualAttendanceTime: null, countOfBeingLate: null, timeOfBeingLate: null, countOfBeingEarly: null, timeOfBeingEarly: null, goOutNumber: null, goOutTime: null, bussNumber: null, bussTime: null, onCardNumber: null, offCardNumber: null, isPublicity: null, isAdmit: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
+export default {
+ name: 'AttendanceMonth',
+ components: { pagination, crudOperation, rrOperation, udOperation, Treeselect },
+ mixins: [presenter(), header(), form(defaultForm), crud()],
+ cruds() {
+ return CRUD({ title: '考勤月报', url: 'api/attendanceMonth', idField: 'id', sort: 'id,desc', crudMethod: { ...crudAttendanceMonth }})
+ },
+ // 数据字典
+ dicts: [constant.LEAVE_TYPE, constant.PUBLICITY_STATUS, constant.APPROVE_STATUS],
+ data() {
+ // 时长(千内)验证
+ var durationValidate = (rule, value, callback) => {
+ const reg = /^([0-9]|[1-9]\d{1,2})(\.\d{1,2})?$|1000$/
+ if (value != null && value !== '' && !reg.test(value)) {
+ callback(new Error('请输入 一千 以内的正整数或两位小数'))
+ } else {
+ callback()
+ }
+ }
+ return {
+ permission: {
+ add: ['admin', 'attendanceMonth:add'],
+ edit: ['admin', 'attendanceMonth:edit'],
+ del: ['admin', 'attendanceMonth:del'],
+ download: ['admin', 'attendanceMonth:download'],
+ admit: ['admin', 'attendanceMonth:admit'],
+ publicity: ['admin', 'attendanceMonth:publicity']
+ },
+ rules: {
+ attendanceDate: [
+ { required: true, message: '统计年月不能为空', trigger: 'blur' }
+ ],
+ userId: [
+ { required: true, message: '所属用户不能为空', trigger: 'change' }
+ ],
+ companyId: [
+ { required: true, message: '所属公司不能为空', trigger: 'change' }
+ ],
+ deptId: [
+ { required: true, message: '所属部门不能为空', trigger: 'change' }
+ ],
+ jobId: [
+ { required: true, message: '所属岗位不能为空', trigger: 'change' }
+ ],
+ requiredAttendanceDays: [
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ requiredAttendanceTime: [
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ actualAttendanceDays: [
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ actualAttendanceTime: [
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ countOfBeingLate: [
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ timeOfBeingLate: [
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ countOfBeingEarly: [
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ timeOfBeingEarly: [
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ goOutNumber: [
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ goOutTime: [
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ bussNumber: [
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ bussTime: [
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ onCardNumber: [
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ offCardNumber: [
+ { validator: durationValidate, trigger: 'blur' }
+ ]
+ },
+ users: [],
+ dictLeaveType: constant.LEAVE_TYPE,
+ // 字典:公示状态
+ publicityStatus: constant.PUBLICITY_STATUS,
+ // 字典:承认状态
+ approveStatus: constant.APPROVE_STATUS,
+ // 承认弹窗加载
+ approveLoading: false,
+ // 公示弹窗加载
+ publicityLoading: false,
+ // 公司
+ companys: [],
+ // 部门
+ depts: [],
+ // 岗位
+ jobs: [] }
+ },
+ methods: {
+ // 钩子:在获取表格数据之前执行,false 则代表不获取数据
+ [CRUD.HOOK.beforeRefresh]() {
+ crudUser.getAll().then(res => {
+ this.users = res
+ })
+ crudSysCompany.getAll().then(res => {
+ this.companys = res
+ })
+ return true
+ },
+ // 新增与编辑前做的操作
+ [CRUD.HOOK.afterToCU](crud, form) {
+ if (form.id == null) {
+ this.getDepts()
+ } else {
+ this.getSupDepts(form.deptId)
+ }
+ this.getJobs()
+ },
+ // 获取弹窗内部门数据
+ loadDepts({ action, parentNode, callback }) {
+ if (action === LOAD_CHILDREN_OPTIONS) {
+ crudDept.getDepts({ enabled: true, pid: parentNode.id }).then(res => {
+ parentNode.children = res.content.map(function(obj) {
+ if (obj.hasChildren) {
+ obj.children = null
+ }
+ return obj
+ })
+ setTimeout(() => {
+ callback()
+ }, 200)
+ })
+ }
+ },
+ getDepts() {
+ crudDept.getDepts({ enabled: true }).then(res => {
+ this.depts = res.content.map(function(obj) {
+ if (obj.hasChildren) {
+ obj.children = null
+ }
+ return obj
+ })
+ })
+ },
+ getSupDepts(deptId) {
+ crudDept.getDeptSuperior(deptId).then(res => {
+ const date = res.content
+ this.buildDepts(date)
+ this.depts = date
+ })
+ },
+ buildDepts(depts) {
+ depts.forEach(data => {
+ if (data.children) {
+ this.buildDepts(data.children)
+ }
+ if (data.hasChildren && !data.children) {
+ data.children = null
+ }
+ })
+ },
+ getJobs() {
+ crudJob.getAll().then(res => {
+ this.jobs = res
+ }).catch(() => { })
+ },
+ // 公示按钮
+ multiplePublicity(data) {
+ // 确认框
+ this.$confirm('此操作将公示 ' + data.length + ' 条月报, 是否继续?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'success'
+ }).then(() => {
+ // ID列表
+ const ids = []
+ // 循环数据
+ for (let i = 0; i < data.length; i++) {
+ // ID列表
+ ids.push(data[i].id)
+ // 判断循环是否结束
+ if (i === data.length - 1) {
+ // 公示月报
+ crudAttendanceMonth.publicity(ids).then(res => {
+ // 搜索:刷新表格
+ this.crud.toQuery()
+ // 消息提示
+ this.crud.notify('公示成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
+ })
+ }
+ }
+ })
+ },
+ // 个人承认(选择按钮)
+ attendanceMAdmit(value) {
+ // 确认框
+ this.$confirm('此操作将承认月报内容是否继续?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'success'
+ }).then(() => {
+ this.form.id = value.id
+ crudAttendanceMonth.updateIsConfirm(this.form).then(res => {
+ // 消息提示
+ this.$message({
+ type: 'success',
+ message: '月报已承认!'
+ })
+ // 刷新数据
+ this.crud.refresh()
+ })
+ })
+ },
+ // 公示弹窗确认
+ doPublicity(data) {
+ // 公示弹窗加载
+ this.publicityLoading = true
+ // 公示工资
+ crudAttendanceMonth.publicity([data.id]).then(res => {
+ // 搜索:刷新表格
+ this.crud.toQuery()
+ // 消息提示
+ this.crud.notify('公示成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
+ // 公示弹窗加载
+ this.publicityLoading = false
+ // 公示弹窗隐藏
+ this.$refs[`publicity_${data.id}`].showPopper = false
+ }).catch(() => {
+ // 公示弹窗加载
+ this.publicityLoading = false
+ })
+ },
+ // 个人承认(按钮)
+ doApprove(value) {
+ // 承认弹窗加载
+ this.approveLoading = true
+ this.form.id = value.id
+ crudAttendanceMonth.updateIsConfirm(this.form).then(res => {
+ // 搜索:刷新表格
+ this.crud.toQuery()
+ // 消息提示
+ this.crud.notify('承认成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
+ // 承认弹窗加载
+ this.approveLoading = false
+ // 承认弹窗隐藏
+ this.$refs[`admit_${value.id}`].showPopper = false
+ }).catch(() => {
+ // 承认弹窗加载
+ this.approveLoading = false
+ })
+ },
+ // 公示弹窗关闭
+ publicityCancel(data) {
+ // 公示弹窗隐藏
+ this.$refs[`publicity_${data.id}`].showPopper = false
+ },
+ // 承认弹窗关闭
+ approveCancel(data) {
+ // 承认弹窗隐藏
+ this.$refs[`admit_${data.id}`].showPopper = false
+ }
+ }
+}
+</script>
+
+<style scoped>
+.isConfirmCol{
+ color:red
+}
+
+.isConfirmSucc{
+ color: rgb(34, 207, 63);
+}
+::v-deep .vue-treeselect__control,::v-deep .vue-treeselect__placeholder,::v-deep .vue-treeselect__single-value {
+ height: 30px;
+ line-height: 30px;
+}
+</style>
--
Gitblit v1.9.3