weicd
2023-11-28 fd7ee4d47858ce5a392dfc203ca21fa0aca2fee7
工资任务加班相关修改
10 files added
25 files modified
1753 ■■■■■ changed files
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/AttendanceOvertime.java 88 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceBusinessTravelRepository.java 4 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceOvertimeRepository.java 34 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/rest/AttendanceOvertimeController.java 106 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/AttendanceOvertimeService.java 99 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceOvertimeDto.java 69 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceOvertimeQueryCriteria.java 50 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/AttendanceOvertimeServiceImpl.java 231 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/mapstruct/AttendanceOvertimeMapper.java 34 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/constant/Constant.java 9 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/domain/NewSalary.java 7 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/NewSalaryDto.java 5 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/impl/NewSalaryServiceImpl.java 45 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java 138 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskDaliyServiceImpl.java 8 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskServiceImpl.java 8 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskUserServiceImpl.java 47 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/repository/CmnLevelRankRepository.java 3 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/repository/CmnLevelRepository.java 7 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/repository/MeritLevelRepository.java 9 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/repository/UserInsuranceRepository.java 6 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/repository/UserLevelWageRepository.java 4 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/rest/UserLevelWageController.java 17 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/UserLevelWageService.java 15 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/impl/UserInsuranceServiceImpl.java 10 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/impl/UserLevelWageServiceImpl.java 62 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/api/attendance/attendanceOvertime.js 43 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/api/treatment/userLevelWage.js 20 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/utils/constant.js 15 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/attendance/attendanceLeave/index.vue 2 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/attendance/attendanceOvertime/index.vue 446 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/salary/newSalary/index.vue 71 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/task/task/index.vue 22 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/task/taskUser/index.vue 13 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/treatment/userInsurance/index.vue 6 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/AttendanceOvertime.java
New file
@@ -0,0 +1,88 @@
/*
*  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 cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import me.zhengjie.base.BaseEntity;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* @website https://eladmin.vip
* @description /
* @author weicd
* @date 2023-11-24
**/
@Entity
@Data
@Table(name="attendance_overtime")
public class AttendanceOvertime extends BaseEntity implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "ID")
    private Long id;
    @Column(name = "`user_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "用户ID")
    private Long userId;
    @Column(name = "`approval_user_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "审批用户ID")
    private Long approvalUserId;
    @Column(name = "`overtime_start_time`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "加班开始时间")
    private Timestamp overtimeStartTime;
    @Column(name = "`overtime_end_time`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "加班结束时间")
    private Timestamp overtimeEndTime;
    @Column(name = "`overtime_duration`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "加班时长")
    private Double overtimeDuration;
    @Column(name = "`approval_status`")
    @ApiModelProperty(value = "审批状态")
    private String approvalStatus;
    @Column(name = "`approval_description`")
    @ApiModelProperty(value = "审批说明")
    private String approvalDescription;
    @Column(name = "`remarks`")
    @ApiModelProperty(value = "备注")
    private String remarks;
    public void copy(AttendanceOvertime source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceBusinessTravelRepository.java
@@ -50,4 +50,8 @@
    // 查询出差记录
    @Query(value = "SELECT * from attendance_business_travel where user_id = ?1 and travel_start_time <= ?3 and travel_end_time >= ?2 and approval_status in ('business_approve_status_agree')", nativeQuery = true)
    List<AttendanceBusinessTravel> findByUserAndSEDate(Long userId, LocalDateTime startDate, LocalDateTime endDate);
    // 查询出差天数
    @Query(value = "SELECT SUM(travel_duration) from attendance_business_travel where user_id = ?1 and travel_start_time >= ?2 and travel_end_time < ?3 and approval_status in ('business_approve_status_agree')", nativeQuery = true)
    Integer findByUserIdAndYearMonth(Long userId, LocalDateTime startDate, LocalDateTime endDate);
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/AttendanceOvertimeRepository.java
New file
@@ -0,0 +1,34 @@
/*
*  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.AttendanceOvertime;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.time.LocalDateTime;
/**
* @website https://eladmin.vip
* @author weicd
* @date 2023-11-24
**/
public interface AttendanceOvertimeRepository extends JpaRepository<AttendanceOvertime, Long>, JpaSpecificationExecutor<AttendanceOvertime> {
    @Query(value = "SELECT SUM(overtime_duration) from attendance_overtime where user_id = ?1 and overtime_start_time >= ?2 and overtime_end_time < ?3 and approval_status in ('overtime_pass')", nativeQuery = true)
    Double findByUserIdAndYearMonth(Long userId, LocalDateTime startDate, LocalDateTime endDate);
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/rest/AttendanceOvertimeController.java
New file
@@ -0,0 +1,106 @@
/*
*  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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.attendance.domain.AttendanceLeave;
import me.zhengjie.modules.attendance.domain.AttendanceOvertime;
import me.zhengjie.modules.attendance.service.AttendanceOvertimeService;
import me.zhengjie.modules.attendance.service.dto.AttendanceOvertimeQueryCriteria;
import org.springframework.data.domain.Pageable;
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 javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @website https://eladmin.vip
* @author weicd
* @date 2023-11-24
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "考勤加班管理")
@RequestMapping("/api/attendanceOvertime")
public class AttendanceOvertimeController {
    private final AttendanceOvertimeService attendanceOvertimeService;
    @Log("导出数据")
    @ApiOperation("导出数据")
    @GetMapping(value = "/download")
    @PreAuthorize("@el.check('attendanceOvertime:list')")
    public void exportAttendanceOvertime(HttpServletResponse response, AttendanceOvertimeQueryCriteria criteria) throws IOException {
        attendanceOvertimeService.download(attendanceOvertimeService.queryAll(criteria), response);
    }
    @GetMapping
    @Log("查询考勤加班")
    @ApiOperation("查询考勤加班")
    @PreAuthorize("@el.check('attendanceOvertime:list')")
    public ResponseEntity<Object> queryAttendanceOvertime(AttendanceOvertimeQueryCriteria criteria, Pageable pageable){
        return new ResponseEntity<>(attendanceOvertimeService.queryAll(criteria,pageable),HttpStatus.OK);
    }
    @PostMapping
    @Log("新增考勤加班")
    @ApiOperation("新增考勤加班")
    @PreAuthorize("@el.check('attendanceOvertime:add')")
    public ResponseEntity<Object> createAttendanceOvertime(@Validated @RequestBody AttendanceOvertime resources) throws Exception {
        return new ResponseEntity<>(attendanceOvertimeService.create(resources),HttpStatus.CREATED);
    }
    @PutMapping
    @Log("修改考勤加班")
    @ApiOperation("修改考勤加班")
    @PreAuthorize("@el.check('attendanceOvertime:edit')")
    public ResponseEntity<Object> updateAttendanceOvertime(@Validated @RequestBody AttendanceOvertime resources){
        attendanceOvertimeService.update(resources);
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
    @DeleteMapping
    @Log("删除考勤加班")
    @ApiOperation("删除考勤加班")
    @PreAuthorize("@el.check('attendanceOvertime:del')")
    public ResponseEntity<Object> deleteAttendanceOvertime(@RequestBody Long[] ids) {
        attendanceOvertimeService.deleteAll(ids);
        return new ResponseEntity<>(HttpStatus.OK);
    }
    @PostMapping(value = "/calcTimeLength")
    @Log("计算加班时长")
    @ApiOperation("计算加班时长")
    public ResponseEntity<Object> calcTimeLength(@RequestBody AttendanceOvertime resources) throws Exception {
        return new ResponseEntity<>(attendanceOvertimeService.calcTimeLength(resources), HttpStatus.OK);
    }
    @PutMapping(value = "/approve")
    @Log("审核功能")
    @ApiOperation("审核功能")
    @PreAuthorize("@el.check('attendanceOvertime:approve')")
    public ResponseEntity<Object> checkApprove(@Validated @RequestBody AttendanceOvertime resources){
        attendanceOvertimeService.updateApprove(resources);
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/AttendanceOvertimeService.java
New file
@@ -0,0 +1,99 @@
/*
*  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.AttendanceLeave;
import me.zhengjie.modules.attendance.domain.AttendanceOvertime;
import me.zhengjie.modules.attendance.service.dto.AttendanceOvertimeDto;
import me.zhengjie.modules.attendance.service.dto.AttendanceOvertimeQueryCriteria;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* @website https://eladmin.vip
* @description 服务接口
* @author weicd
* @date 2023-11-24
**/
public interface AttendanceOvertimeService {
    /**
    * 查询数据分页
    * @param criteria 条件
    * @param pageable 分页参数
    * @return Map<String,Object>
    */
    Map<String,Object> queryAll(AttendanceOvertimeQueryCriteria criteria, Pageable pageable);
    /**
    * 查询所有数据不分页
    * @param criteria 条件参数
    * @return List<AttendanceOvertimeDto>
    */
    List<AttendanceOvertimeDto> queryAll(AttendanceOvertimeQueryCriteria criteria);
    /**
     * 根据ID查询
     * @param id ID
     * @return AttendanceOvertimeDto
     */
    AttendanceOvertimeDto findById(Long id);
    /**
    * 创建
    * @param resources /
    * @return AttendanceOvertimeDto
    */
    AttendanceOvertimeDto create(AttendanceOvertime resources) throws Exception;
    /**
    * 编辑
    * @param resources /
    */
    void update(AttendanceOvertime resources);
    /**
    * 多选删除
    * @param ids /
    */
    void deleteAll(Long[] ids);
    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    void download(List<AttendanceOvertimeDto> all, HttpServletResponse response) throws IOException;
    /**
     * 计算加班时长
     * @param resources
     * @return
     */
    AttendanceOvertimeDto calcTimeLength(AttendanceOvertime resources);
    /**
     * 审核功能
     * @param resources /
     */
    void updateApprove(AttendanceOvertime resources);
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceOvertimeDto.java
New file
@@ -0,0 +1,69 @@
/*
*  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.io.Serializable;
import java.sql.Timestamp;
/**
* @website https://eladmin.vip
* @description /
* @author weicd
* @date 2023-11-24
**/
@Data
public class AttendanceOvertimeDto extends BaseDTO implements Serializable {
    /** ID */
    private Long id;
    /** 用户ID */
    private Long userId;
    /** 审批用户ID */
    private Long approvalUserId;
    /** 加班开始时间 */
    private Timestamp overtimeStartTime;
    /** 加班结束时间 */
    private Timestamp overtimeEndTime;
    /** 加班时长 */
    private Double overtimeDuration;
    /** 加班时长单位 */
    private String overtimeDurationUnit;
    /** 审批状态 */
    private String approvalStatus;
    /** 审批说明 */
    private String approvalDescription;
    /** 备注 */
    private String remarks;
    /** 用户名 */
    private String userName;
    /** 审批用户名 */
    private String appUserName;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceOvertimeQueryCriteria.java
New file
@@ -0,0 +1,50 @@
/*
*  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.annotation.Query;
import java.sql.Timestamp;
import java.util.List;
/**
* @website https://eladmin.vip
* @author weicd
* @date 2023-11-24
**/
@Data
public class AttendanceOvertimeQueryCriteria{
    //申请人查询
    @Query
    private Long userId;
    //审批者查询
    @Query
    private Long approvalUserId;
    //审批查询
    @Query
    private String approvalStatus;
    @Query(type = Query.Type.BETWEEN, propName = "overtimeStartTime")
    private List<Timestamp> overtimeStartTime;
    @Query(type = Query.Type.BETWEEN, propName = "overtimeEndTime")
    private List<Timestamp> overtimeEndTime;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/AttendanceOvertimeServiceImpl.java
New file
@@ -0,0 +1,231 @@
/*
*  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.RequiredArgsConstructor;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.attendance.domain.*;
import me.zhengjie.modules.attendance.repository.AttendanceOvertimeRepository;
import me.zhengjie.modules.attendance.repository.AttendanceRepository;
import me.zhengjie.modules.attendance.service.AttendanceOvertimeService;
import me.zhengjie.modules.attendance.service.dto.AttendanceGoOutDto;
import me.zhengjie.modules.attendance.service.dto.AttendanceOvertimeDto;
import me.zhengjie.modules.attendance.service.dto.AttendanceOvertimeQueryCriteria;
import me.zhengjie.modules.attendance.service.mapstruct.AttendanceOvertimeMapper;
import me.zhengjie.modules.constant.Constant;
import me.zhengjie.modules.quartz.service.OpaiDingTalkService;
import me.zhengjie.modules.system.domain.Role;
import me.zhengjie.modules.system.domain.SysRostering;
import me.zhengjie.modules.system.domain.User;
import me.zhengjie.modules.system.repository.UserRepository;
import me.zhengjie.utils.*;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author weicd
* @date 2023-11-24
**/
@Service
@RequiredArgsConstructor
public class AttendanceOvertimeServiceImpl implements AttendanceOvertimeService {
    private final AttendanceOvertimeRepository attendanceOvertimeRepository;
    private final AttendanceOvertimeMapper attendanceOvertimeMapper;
    private final AttendanceRepository attendanceRepository;
    private final UserRepository userRepository;
    private final OpaiDingTalkService opaiDingTalkService;
    @Override
    public Map<String,Object> queryAll(AttendanceOvertimeQueryCriteria criteria, Pageable pageable){
        Page<AttendanceOvertime> page = attendanceOvertimeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
        //将实体转换为Dto(重写)
        Function<AttendanceOvertime, AttendanceOvertimeDto> func = new Function<AttendanceOvertime, AttendanceOvertimeDto>(){
            @Override
            public AttendanceOvertimeDto apply(AttendanceOvertime attendanceOvertime) {
                // 将实体类转换成DTO
                AttendanceOvertimeDto attendanceOvertimeDto = attendanceOvertimeMapper.toDto(attendanceOvertime);
                //查询用户信息
                User user = userRepository.findById(attendanceOvertimeDto.getUserId()).orElseGet(User::new);
                attendanceOvertimeDto.setUserName(user.getNickName());
                //查询审批用户名
                User appUser = userRepository.findById(attendanceOvertimeDto.getApprovalUserId()).orElseGet(User::new);
                attendanceOvertimeDto.setAppUserName(appUser.getNickName());
                return attendanceOvertimeDto;
            }
        };
        return PageUtil.toPage(page.map(func));
    }
    @Override
    public List<AttendanceOvertimeDto> queryAll(AttendanceOvertimeQueryCriteria criteria){
        return attendanceOvertimeMapper.toDto(attendanceOvertimeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
    }
    @Override
    @Transactional
    public AttendanceOvertimeDto findById(Long id) {
        AttendanceOvertime attendanceOvertime = attendanceOvertimeRepository.findById(id).orElseGet(AttendanceOvertime::new);
        ValidationUtil.isNull(attendanceOvertime.getId(),"AttendanceOvertime","id",id);
        return attendanceOvertimeMapper.toDto(attendanceOvertime);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public AttendanceOvertimeDto create(AttendanceOvertime resources) throws Exception {
        //查询考勤表是否有记录
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String attDate = sdf.format(resources.getOvertimeStartTime());
//        Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(resources.getUserId(),attDate.substring(0,10));
//        if(ObjectUtils.isEmpty(attendance)){
//            throw new BadRequestException("考勤记录不存在");
//        }
        resources.setApprovalStatus(Constant.OVERTIME_APPROVAL);
        //发送给审批者
        List<String> sendList = new ArrayList<>();
        //查询申请人信息
        User user = userRepository.getOne(resources.getUserId());
        //查询审批者信息
        User appUser = userRepository.getOne(resources.getApprovalUserId());
        sendList.add(appUser.getDingding());
        opaiDingTalkService.sendNotice(sendList, "审批提醒", "### 审批提示 \n  >" + user.getNickName() + " 提交了加班审批,请登录PMS系统处理", "card");
        return attendanceOvertimeMapper.toDto(attendanceOvertimeRepository.save(resources));
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void update(AttendanceOvertime resources) {
        AttendanceOvertime attendanceOvertime = attendanceOvertimeRepository.findById(resources.getId()).orElseGet(AttendanceOvertime::new);
        ValidationUtil.isNull( attendanceOvertime.getId(),"AttendanceOvertime","id",resources.getId());
        attendanceOvertime.copy(resources);
        //审核通过或者退回不能修改
        if(attendanceOvertime.getApprovalStatus().equals(Constant.OVERTIME_PASS) || attendanceOvertime.getApprovalStatus().equals(Constant.OVERTIME_RETURN)){
            throw new BadRequestException("审核通过或退回的不能进行修改");
        }
        //获取当前登入人信息
        User user1 = userRepository.getOne(SecurityUtils.getCurrentUserId());
        Role role = user1.getRoles().iterator().next();
        //除超管、总经理只能修改自己信息
        if(role.getId() != Constant.ROLE_LEVEL_SUPER && role.getId() != Constant.ROLE_LEVEL_GENERAL){
            if (!Long.valueOf(resources.getUserId()).equals(SecurityUtils.getCurrentUserId())){
                throw new BadRequestException("只能修改自己的记录");
            }
        }
        //查询考勤表是否有记录
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        String attDate = sdf.format(resources.getOvertimeStartTime());
//        Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(resources.getUserId(),attDate.substring(0,10));
//        if(ObjectUtils.isEmpty(attendance)){
//            throw new BadRequestException("考勤记录不存在");
//        }
        attendanceOvertimeRepository.save(attendanceOvertime);
    }
    @Override
    public void deleteAll(Long[] ids) {
        for (Long id : ids) {
            attendanceOvertimeRepository.deleteById(id);
        }
    }
    @Override
    public void download(List<AttendanceOvertimeDto> all, HttpServletResponse response) throws IOException {
        List<Map<String, Object>> list = new ArrayList<>();
        for (AttendanceOvertimeDto attendanceOvertime : all) {
            Map<String,Object> map = new LinkedHashMap<>();
            map.put("用户ID", attendanceOvertime.getUserId());
            map.put("审批用户ID", attendanceOvertime.getApprovalUserId());
            map.put("加班开始时间", attendanceOvertime.getOvertimeStartTime());
            map.put("加班结束时间", attendanceOvertime.getOvertimeEndTime());
            map.put("加班时长", attendanceOvertime.getOvertimeDuration());
            map.put("加班时长单位", attendanceOvertime.getOvertimeDurationUnit());
            map.put("审批状态", attendanceOvertime.getApprovalStatus());
            map.put("审批说明", attendanceOvertime.getApprovalDescription());
            map.put("备注", attendanceOvertime.getRemarks());
            list.add(map);
        }
        FileUtil.downloadExcel(list, response);
    }
    /**
     * 计算加班时长
     * @param resources
     * @return
     */
    @Override
    public AttendanceOvertimeDto calcTimeLength(AttendanceOvertime resources) {
        AttendanceOvertimeDto attendanceOvertimeDto = new AttendanceOvertimeDto();
        User userInfo = userRepository.getOne(resources.getUserId());
        SysRostering sysRostering = userInfo.getSysRostering();
        long minutes = 0;
        if ((resources.getOvertimeStartTime().toLocalDateTime().toLocalTime().isBefore(sysRostering.getLunchStartTime()) || resources.getOvertimeStartTime().toLocalDateTime().toLocalTime().equals(sysRostering.getLunchStartTime()))
                && (resources.getOvertimeEndTime().toLocalDateTime().toLocalTime().isAfter(sysRostering.getLunchEndTime()) || resources.getOvertimeEndTime().toLocalDateTime().toLocalTime().equals(sysRostering.getLunchEndTime()) )) {
            minutes = Duration.between(resources.getOvertimeStartTime().toLocalDateTime(), resources.getOvertimeEndTime().toLocalDateTime()).toMinutes() - 60;
        } else if (resources.getOvertimeEndTime().toLocalDateTime().toLocalTime().isBefore(sysRostering.getLunchStartTime()) || resources.getOvertimeEndTime().toLocalDateTime().toLocalTime().equals(sysRostering.getLunchStartTime()) ||
                resources.getOvertimeStartTime().toLocalDateTime().toLocalTime().isAfter(sysRostering.getLunchEndTime()) || resources.getOvertimeStartTime().toLocalDateTime().toLocalTime().equals(sysRostering.getLunchEndTime())) {
            minutes = Duration.between(resources.getOvertimeStartTime().toLocalDateTime(), resources.getOvertimeEndTime().toLocalDateTime()).toMinutes();
        } else if (resources.getOvertimeStartTime().toLocalDateTime().toLocalTime().isBefore(sysRostering.getLunchStartTime()) && resources.getOvertimeEndTime().toLocalDateTime().toLocalTime().isAfter(sysRostering.getLunchStartTime()) &&
                (resources.getOvertimeEndTime().toLocalDateTime().toLocalTime().equals(sysRostering.getLunchEndTime()) || resources.getOvertimeEndTime().toLocalDateTime().toLocalTime().isBefore(sysRostering.getLunchEndTime()))){
            minutes = Duration.between(resources.getOvertimeStartTime().toLocalDateTime().toLocalTime(), sysRostering.getLunchStartTime()).toMinutes();
        } else if ((resources.getOvertimeStartTime().toLocalDateTime().toLocalTime().isBefore(sysRostering.getLunchStartTime()) || resources.getOvertimeStartTime().toLocalDateTime().toLocalTime().equals(sysRostering.getLunchStartTime())) && resources.getOvertimeEndTime().toLocalDateTime().toLocalTime().isAfter(sysRostering.getLunchEndTime())) {
            minutes = Duration.between(sysRostering.getLunchEndTime(), resources.getOvertimeEndTime().toLocalDateTime()).toMinutes();
        }
        double hours = new BigDecimal((double) minutes / 60).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
        attendanceOvertimeDto.setOvertimeDuration(hours);
        return attendanceOvertimeDto;
    }
    /**
     * 审核
     * @param resources /
     */
    @Override
    public void updateApprove(AttendanceOvertime resources) {
        AttendanceOvertime attendanceOvertime = attendanceOvertimeRepository.findById(resources.getId()).orElseGet(AttendanceOvertime::new);
        ValidationUtil.isNull( attendanceOvertime.getId(),"AttendanceOvertime","id",resources.getId());
        attendanceOvertime.copy(resources);
        attendanceOvertimeRepository.save(attendanceOvertime);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/mapstruct/AttendanceOvertimeMapper.java
New file
@@ -0,0 +1,34 @@
/*
*  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.AttendanceLeave;
import me.zhengjie.modules.attendance.domain.AttendanceOvertime;
import me.zhengjie.modules.attendance.service.dto.AttendanceLeaveDto;
import me.zhengjie.modules.attendance.service.dto.AttendanceOvertimeDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @website https://eladmin.vip
* @author weicd
* @date 2023-11-24
**/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface AttendanceOvertimeMapper extends BaseMapper<AttendanceOvertimeDto, AttendanceOvertime> {
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/constant/Constant.java
@@ -80,6 +80,15 @@
    // 审批状态:已拒绝
    public static final String CARD_APPROVE_STATUS_REFUSE = "card_approve_status_refuse";
    // 加班审批状态
    public static final String OVERTIME_STATUS = "overtime_status";
    // 加班状态:待审核
    public static final String OVERTIME_APPROVAL = "overtime_approval";
    // 加班状态:已同意
    public static final String OVERTIME_PASS = "overtime_pass";
    // 加班状态:已退回
    public static final String OVERTIME_RETURN = "overtime_return";
    // 批准状态
    public static final String APPROVE_STATUS = "approve_status";
    // 批准状态:已承认
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/domain/NewSalary.java
@@ -138,11 +138,14 @@
    @ApiModelProperty(value = "计件工资")
    private BigDecimal pieceRate;
    @Column(name = "`travel_allowance`",nullable = false)
    @NotNull
    @Column(name = "`travel_allowance`")
    @ApiModelProperty(value = "出差补助工资")
    private BigDecimal travelAllowance;
    @Column(name = "`overtime_allowance`")
    @ApiModelProperty(value = "加班工资")
    private BigDecimal overtimeAllowance;
    @Column(name = "`accumulation_fund`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "公积金基数")
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/dto/NewSalaryDto.java
@@ -53,6 +53,11 @@
    private BigDecimal basicWage;
    /**
     * 加班工资
     */
    private BigDecimal overtimeAllowance;
    /**
     * 全勤小时数
     */
    private Double fullDays;
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/salary/service/impl/NewSalaryServiceImpl.java
@@ -63,6 +63,7 @@
import java.io.IOException;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Function;
@@ -269,10 +270,13 @@
    @Override
    public Integer queryWorkDays(NewSalaryQueryCriteria criteria) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if (criteria.getUserId() == null) {
            return 0;
        }
        List<User> user = userRepository.findByUserId(criteria.getUserId());
        String stTime = sdf.format(user.get(0).getCreateTime()).substring(0,7);
        if (stTime.equals(criteria.getTargetYearMonth().substring(0,7))) {
            criteria.setTargetYearMonth(sdf.format(user.get(0).getCreateTime()).substring(0,10));
        String stTime = sdf.format(user.get(0).getCreateTime()).substring(0, 7);
        if (stTime.equals(criteria.getTargetYearMonth().substring(0, 7))) {
            criteria.setTargetYearMonth(sdf.format(user.get(0).getCreateTime()).substring(0, 10));
        }
        // 国际时间转中国时间
        String targetYearMonth = DateUtil.internationalTimeToChinaTime(criteria.getTargetYearMonth());
@@ -329,6 +333,8 @@
    public void generate(NewSalaryQueryCriteria criteria) {
        List<String> errors = new ArrayList<>();
        for (Long id : criteria.getSelectedValue1()) {
            // 用户工资结算
//            userSalarySettlement(id, DateUtil.internationalTimeToChinaTime(criteria.getTargetYearMonth()), errors);
            try {
                // 用户工资结算
                userSalarySettlement(id, DateUtil.internationalTimeToChinaTime(criteria.getTargetYearMonth()), errors);
@@ -416,6 +422,10 @@
        newSalary.setPublicityStatus(Constant.PUBLICITY_STATUS_NOT);
        newSalary.setApproveStatus(Constant.APPROVE_STATUS_UNRECOGNIZED);
        try {
            // 获取出差补助
            newSalary = getUserBussSubsidy(userId, targetYearMonth, newSalary);
            // 获取加班补助工资
            newSalary = getUserOverTimeSubsidy(userId, targetYearMonth, newSalary);
            // 获取用户级别工资
            newSalary = getUserLevelWage(userId, targetYearMonth, newSalary, errors);
            // 获取用户级别保险
@@ -430,7 +440,7 @@
            newSalary = getComplianceWork(userId, targetYearMonth, newSalary);
            // 获取已完成工时
            newSalary = getCompletedWork(userId, targetYearMonth, newSalary);
        } catch (BadRequestException e) {
        } catch (BadRequestException | ParseException e) {
            errors.add(e.getMessage());
            return;
        }
@@ -471,6 +481,32 @@
            return null;
        }
        // 返回
        return newSalary;
    }
    // 获取出差补助
    private NewSalary getUserBussSubsidy(Long userId, String targetYearMonth, NewSalary newSalary) throws ParseException {
        // 用户级别工资检索类
        UserLevelWageQueryCriteria userLevelWageQueryCriteria = new UserLevelWageQueryCriteria();
        userLevelWageQueryCriteria.setUserId(userId);
        userLevelWageQueryCriteria.setTargetYearMonth(targetYearMonth + " 00:00:00");
        // 获取出差补助金额
        Double bussMoney = userLevelWageService.queryTravelAllowance(userLevelWageQueryCriteria);
        // 设置出差补助的金额
        newSalary.setTravelAllowance(new BigDecimal(bussMoney));
        return newSalary;
    }
    // 获取加班补助工资
    private NewSalary getUserOverTimeSubsidy(Long userId, String targetYearMonth, NewSalary newSalary) throws ParseException {
        // 用户级别工资检索类
        UserLevelWageQueryCriteria userLevelWageQueryCriteria = new UserLevelWageQueryCriteria();
        userLevelWageQueryCriteria.setUserId(userId);
        userLevelWageQueryCriteria.setTargetYearMonth(targetYearMonth + " 00:00:00");
        // 获取加班补助金额
        Double overTimeMoney = userLevelWageService.queryOverTimeAllowance(userLevelWageQueryCriteria);
        // 设置加班补助的金额
        newSalary.setOvertimeAllowance(new BigDecimal(overTimeMoney));
        return newSalary;
    }
@@ -564,6 +600,7 @@
    private NewSalary getWorkDays(String targetYearMonth, NewSalary newSalary) {
        // 工资查询类
        NewSalaryQueryCriteria newSalaryQueryCriteria = new NewSalaryQueryCriteria();
        newSalaryQueryCriteria.setUserId(newSalary.getUserId());
        newSalaryQueryCriteria.setTargetYearMonth(targetYearMonth);
        // 查询某月工作天数
        Integer workDays = queryWorkDays(newSalaryQueryCriteria);
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java
@@ -46,6 +46,8 @@
import me.zhengjie.modules.task.repository.TaskDaliyRepository;
import me.zhengjie.modules.task.service.TaskDaliyService;
import me.zhengjie.modules.task.service.dto.TaskDaliyQueryCriteria;
import me.zhengjie.modules.treatment.domain.*;
import me.zhengjie.modules.treatment.repository.*;
import me.zhengjie.utils.*;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.cache.annotation.CacheConfig;
@@ -110,8 +112,14 @@
    private final SysCompanyRepository sysCompanyRepository;
    private final TaskDaliyService taskDaliyService;
    private final DeptRepository deptRepository;
    private final MeritLevelRepository meritLevelRepository;
    private final CmnLevelRepository cmnLevelRepository;
    private final MeritWageRepository meritWageRepository;
    private final CmnLevelRankRepository cmnLevelRankRepository;
    private final MongoTemplate mongoTemplate;
    private final UserLevelWageRepository userLevelWageRepository;
    private final UserInsuranceRepository userInsuranceRepository;
    @Override
    public Object queryAll(UserQueryCriteria criteria, Pageable pageable) {
@@ -467,6 +475,7 @@
    @Override
    @Cacheable(key = "'total'")
//    @CacheEvict(value = "total", allEntries = true)
    @Transactional(rollbackFor = Exception.class)
    public List<UserDto> queryAll(UserQueryCriteria criteria) {
        criteria.setEnabled(true);
@@ -522,6 +531,8 @@
        userRepository.save(resources);
        // 判断用户级别变更
        checkUserLevel(resources.getId(), null, resources.getLevelId());
        // 判断用户级别变更(新)
        checkUserLevelNew(resources.getId(), null, resources.getLevelId());
    }
    @Override
@@ -578,6 +589,8 @@
        userRepository.save(user);
        // 判断用户级别变更
        checkUserLevel(user.getId(), tempOldLevelId, tempNewLevelId);
        // 判断用户级别变更(新)
        checkUserLevelNew(user.getId(), tempOldLevelId, tempNewLevelId);
        // 清除缓存
        delCaches(user.getId(), user.getUsername());
    }
@@ -1075,12 +1088,13 @@
    private void checkUserLevel(Long userId, Long oldLevelId, Long newLevelId) {
        // 判断新旧用户级别ID是否相等
        if (oldLevelId == null) {
            // 创建用户级别工资
            // 创建用户级别工资(旧)
            createSysUserLevelWage(userId, newLevelId);
            // 创建用户级别保险
            // 创建用户级别保险(旧)
            createSysUserLevelInsurance(userId, newLevelId);
            // 创建用户级别其他
            createSysUserLevelOther(userId, newLevelId);
        } else if (oldLevelId != newLevelId) {
            // 旧用户级别工资
            SysUserLevelWage oldSysUserLevelWage = sysUserLevelWageRepository.findLastByUserId(userId);
@@ -1107,7 +1121,7 @@
                // 保存
                sysUserLevelWageRepository.save(oldSysUserLevelWage);
            }
            // 创建用户级别工资
            // 创建用户级别工资(旧)
            createSysUserLevelWage(userId, newLevelId);
            // 旧用户级别保险
            SysUserLevelInsurance oldSysUserLevelInsurance = sysUserLevelInsuranceRepository.findLastByUserId(userId);
@@ -1134,7 +1148,7 @@
                // 保存
                sysUserLevelInsuranceRepository.save(oldSysUserLevelInsurance);
            }
            // 创建用户级别保险
            // 创建用户级别保险(旧)
            createSysUserLevelInsurance(userId, newLevelId);
            // 旧用户级别其他
            SysUserLevelOther oldSysUserLevelOther = sysUserLevelOtherRepository.findLastByUserId(userId);
@@ -1169,6 +1183,56 @@
    }
    /**
     * 判断用户级别变更
     * @param userId
     * @param oldLevelId
     * @param newLevelId
     */
    private void checkUserLevelNew(Long userId, Long oldLevelId, Long newLevelId) {
        // 创建用户级别工资(新)
        createNewSysUserLevelWage(userId, newLevelId);
        // 创建用户级别保险 (新)
        createNewSysUserLevelInsurance(userId, newLevelId);
        // 判断新旧用户级别ID是否相等
        if (oldLevelId == null) {
            // 创建用户级别其他
            createSysUserLevelOther(userId, newLevelId);
        } else if (oldLevelId != newLevelId) {
//            // 旧用户级别其他
//            SysUserLevelOther oldSysUserLevelOther = sysUserLevelOtherRepository.findLastByUserId(userId);
//            // 判断旧用户级别其他是否为空
//            if (oldSysUserLevelOther != null && oldSysUserLevelOther.getId() != null) {
//                // 旧日期字符串
//                String oldDateString = oldSysUserLevelOther.getStartDate().toString().substring(0, 10);
//                // 获取当前日期
//                Date nowDate = new Date();
//                // 创建Calendar实例
//                Calendar nowCalendar = Calendar.getInstance();
//                // 设置当前时间
//                nowCalendar.setTime(nowDate);
//                // 新日期字符串
//                String nowDateString = new Timestamp(nowCalendar.getTime().getTime()).toString().substring(0, 10);
//                // 判断新、旧日期字符串
//                if (oldDateString.equals(nowDateString)) {
//                    throw new BadRequestException("每天只能调整一次级别,请明日再试!");
//                }
//                // 设置前一天时间
//                nowCalendar.add(Calendar.DATE, -1);
//                // 旧用户级别保险
//                oldSysUserLevelOther.setEndDate(new Timestamp(nowCalendar.getTime().getTime()));
//                // 保存
//                sysUserLevelOtherRepository.save(oldSysUserLevelOther);
//            }
//            // 创建用户级别其他
//            createSysUserLevelOther(userId, newLevelId);
        } else {
        }
    }
    /**
     * 创建用户级别工资
     *
     * @param userId
@@ -1191,6 +1255,72 @@
        sysUserLevelWageRepository.save(sysUserLevelWage);
    }
    /**
     * 创建用户界别工资(新)
     * @param userId
     * @param levelId
     */
    private void createNewSysUserLevelWage(Long userId, Long levelId) {
        // 级别
        SysLevel sysLevel = sysLevelRepository.findById(levelId).orElseGet(SysLevel::new);
        // 用户级别工资
        UserLevelWage userLevelWage = new UserLevelWage();
        userLevelWage.setUserId(userId);
        userLevelWage.setLevel(levelId);
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        userLevelWage.setYearMonth(sdf.format(date).substring(0,7));
        // 查询最小的等级
        MeritLevel meritLevel = meritLevelRepository.findMinMeritStandardByLevelId(levelId).get(0);
        userLevelWage.setRank(meritLevel.getId());
        // 查询级别基本工资
        CmnLevel cmnLevel = cmnLevelRepository.findByJobId(sysLevel.getJobId()).get(0);
        userLevelWage.setBasicWage(cmnLevel.getBasicWage());
        userLevelWage.setRankWage(cmnLevel.getRankWage());
        userLevelWage.setPerformanceWage(cmnLevel.getPerformanceWage());
        // 查询绩效系数
        CmnLevelRank cmnLevelRank = cmnLevelRankRepository.findbylevelSm(levelId).get(0);
        userLevelWage.setPerformanceCoefficient(new BigDecimal(cmnLevelRank.getPerformanceCoefficient()));
        // 保存
        userLevelWageRepository.save(userLevelWage);
    }
    /**
     * 创建用户级别保险 (新)
     * @param userId
     * @param levelId
     */
    public void createNewSysUserLevelInsurance(Long userId, Long levelId) {
        // 级别
        SysLevel sysLevel = sysLevelRepository.findById(levelId).orElseGet(SysLevel::new);
        // 用户级别工资
        UserInsurance userInsurance = new UserInsurance();
        userInsurance.setUserId(userId);
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        userInsurance.setYearMonth(sdf.format(date).substring(0,7));
        userInsurance.setAccumulationFund(sysLevel.getAccumulationRadix());
        userInsurance.setAccumulationFundPersonal(sysLevel.getAccumulationPersonalProportion());
        userInsurance.setAccumulationFundCompany(sysLevel.getAccumulationCompanyProportion());
        userInsurance.setRetirementInsurance(sysLevel.getPensionRadix());
        userInsurance.setRetirementInsurancePersonal(sysLevel.getPensionPersonalProportion());
        userInsurance.setRetirementInsuranceCompany(sysLevel.getPensionCompanyProportion());
        userInsurance.setMedicalInsurance(sysLevel.getMedicalRadix());
        userInsurance.setMedicalInsurancePersonal(sysLevel.getMedicalPersonalProportion());
        userInsurance.setMedicalInsuranceCompany(sysLevel.getMedicalCompanyProportion());
        userInsurance.setUnemploymentInsurance(sysLevel.getUnemploymentRadix());
        userInsurance.setUnemploymentInsurancePersonal(sysLevel.getUnemploymentPersonalProportion());
        userInsurance.setUnemploymentInsuranceCompany(sysLevel.getUnemploymentCompanyProportion());
        userInsurance.setBirthInsurance(sysLevel.getMaternityRadix());
        userInsurance.setBirthInsurancePersonal(sysLevel.getMaternityPersonalProportion());
        userInsurance.setBirthInsuranceCompany(sysLevel.getMaternityCompanyProportion());
        userInsurance.setEmploymentInsurance(sysLevel.getIndustrialInjuryRadix());
        userInsurance.setEmploymentInsurancePersonal(sysLevel.getIndustrialInjuryPersonalProportion());
        userInsurance.setEmploymentInsuranceCompany(sysLevel.getIndustrialInjuryCompanyProportion());
        // 保存
        userInsuranceRepository.save(userInsurance);
    }
    // 创建用户级别保险
    private void createSysUserLevelInsurance(Long userId, Long levelId) {
        // 级别
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskDaliyServiceImpl.java
@@ -450,8 +450,10 @@
                            throw new BadRequestException("任务日报进度计算存在异常!");
                        }
                        // 判断进度是否正常
                        if (taskDaliyDay.getConsumedWorkload() < taskDaliyHistory.getConsumedWorkload()) {
                            throw new BadRequestException("任务日报进度计算存在异常!");
                        if (taskDaliyDay.getConsumedWorkload() != null && taskDaliyHistory.getConsumedWorkload() != null) {
                            if (taskDaliyDay.getConsumedWorkload() < taskDaliyHistory.getConsumedWorkload()) {
                                throw new BadRequestException("任务日报进度计算存在异常!");
                            }
                        }
                        // 本日任务日报进度
                        //completedWork += task.getPieceRate() * (taskDaliyDay.getConsumedWorkload() - taskDaliyHistory.getConsumedWorkload());
@@ -482,7 +484,7 @@
            Date dt = sdf.parse(criteria.getTargetYearMonth());
            Calendar cal = Calendar.getInstance();
            cal.setTime(dt);
            cal.add(Calendar.MONTH,1);
            cal.add(Calendar.MONTH, 1);
            Date nextMonth = cal.getTime();
//            daliyMongoList = mongoTemplate.find(Query.query(new Criteria("userId").is(criteria.getUserId()).and("fillDate").gte(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(criteria.getTargetYearMonth())).lte(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(nextMonth)))), TaskDaliyMongo.class);
            daliyMongoList = mongoTemplate.find(Query.query(new Criteria("userId").is(criteria.getUserId()).and("fillDate").gte(dt).lte(nextMonth)), TaskDaliyMongo.class);
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskServiceImpl.java
@@ -173,7 +173,8 @@
        List<TaskMongo> taskMongoList2 = new ArrayList<>();
        if (projectId != null) {
            for (TaskDaliyMongo taskDaliyMongo : daliyMongoList) {
                if (taskDaliyMongo.getTaskUserMongo().getTask().getProjectId().equals(projectId)) {
//                if (taskDaliyMongo.getTaskUserMongo().getTask().getProjectId().equals(projectId)) {
                if (taskDaliyMongo.getTaskUserMongo().getTask().getProjectId().equals(projectId) && !taskDaliyMongo.getTaskUserMongo().getTask().getTaskStatus().equals(Constant.TASK_STATUS_COMPLETED)) {
                    taskMongoList1.add(taskDaliyMongo.getTaskUserMongo().getTask());
                }
            }
@@ -181,7 +182,8 @@
        List<TaskUserMongo> taskUserMongos = mongoTemplate.find(Query.query(new Criteria("userId").is(SecurityUtils.getCurrentUserId())), TaskUserMongo.class);
        for (TaskUserMongo taskUserMongo : taskUserMongos) {
            if (taskUserMongo.getTask().getProjectId().equals(projectId)) {
//            if (taskUserMongo.getTask().getProjectId().equals(projectId)) {
            if (taskUserMongo.getTask().getProjectId().equals(projectId) && !taskUserMongo.getTask().getTaskStatus().equals(Constant.TASK_STATUS_COMPLETED)) {
                taskMongoList2.add(taskUserMongo.getTask());
            }
        }
@@ -193,6 +195,7 @@
        Criteria criteriaMongo = new Criteria();
        //查找出这个任务中所有的分配任务
        criteriaMongo.and("task.id").is(taskId);
        criteriaMongo.and("taskStatus").ne("task_status_completed");
        List<TaskUserMongo> taskUserMongos = mongoTemplate.find(Query.query(criteriaMongo), TaskUserMongo.class);
        //将所有有负责人Id的人筛出来
        taskUserMongos = taskUserMongos.stream().filter(item -> item.getUserId() != null).collect(Collectors.toList());
@@ -986,6 +989,7 @@
    //删除已有的任务缓存
    @CacheEvict(cacheNames = "ChildrenTask",allEntries = true)
    public TaskMongo create(Long userId,TaskMongo resources) {
        resources.setTaskStatus(Constant.TASK_STATUS_NOT_STARTED);
        // 查询最大的old_id值
        Query query = new Query();
        query.with(Sort.by(Sort.Direction.DESC, "old_id"));
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskUserServiceImpl.java
@@ -644,8 +644,8 @@
        DataValidationConstraint dvConstraintStatus = dvHelper.createFormulaListConstraint("状态详细信息!$A$1:$A$" + statuses.length);
        DataValidationConstraint dvConstraintStatus1 = dvHelper.createFormulaListConstraint("优先度详细信息!$A$1:$A$" + priorities.length);
        CellRangeAddressList addressListUser = new CellRangeAddressList(1, 100, 4, 4); // 所属员工列
        CellRangeAddressList addressListStatus = new CellRangeAddressList(1, 100, 6, 6); // 任务状态列
        CellRangeAddressList addressListStatus1 = new CellRangeAddressList(1, 100, 8, 8); // 优先度状态列
        CellRangeAddressList addressListStatus = new CellRangeAddressList(1, 100, 5, 5); // 任务状态列
        CellRangeAddressList addressListStatus1 = new CellRangeAddressList(1, 100, 6, 6); // 优先度状态列
        DataValidation validationUser = dvHelper.createValidation(dvConstraintUser, addressListUser);
        DataValidation validationStatus = dvHelper.createValidation(dvConstraintStatus, addressListStatus);
        DataValidation validationStatus1 = dvHelper.createValidation(dvConstraintStatus1, addressListStatus1);
@@ -663,27 +663,46 @@
        headerRow1.createCell(2).setCellValue("任务结束时间");
        headerRow1.createCell(3).setCellValue("任务工时");
        headerRow1.createCell(4).setCellValue("所属员工");
        headerRow1.createCell(5).setCellValue("所属员工ID");
        headerRow1.createCell(6).setCellValue("任务状态");
        headerRow1.createCell(7).setCellValue("任务状态ID");
//        headerRow1.createCell(8).setCellValue("消耗工时");
        headerRow1.createCell(8).setCellValue("优先度");
        headerRow1.createCell(9).setCellValue("优先度ID");
//        headerRow1.createCell(5).setCellValue("所属员工ID");
        headerRow1.createCell(5).setCellValue("任务状态");
//        headerRow1.createCell(7).setCellValue("任务状态ID");
        headerRow1.createCell(6).setCellValue("优先度");
//        headerRow1.createCell(9).setCellValue("优先度ID");
        headerRow1.createCell(7).setCellValue("隔绝列1");
        headerRow1.createCell(8).setCellValue("隔绝列2");
        headerRow1.createCell(9).setCellValue("隔绝列3");
        headerRow1.createCell(10).setCellValue("隔绝列4");
        headerRow1.createCell(11).setCellValue("隔绝列5");
        headerRow1.createCell(12).setCellValue("隔绝列6");
        headerRow1.createCell(13).setCellValue("隔绝列7");
        headerRow1.createCell(14).setCellValue("隔绝列8");
        headerRow1.createCell(15).setCellValue("所属员工ID");
        headerRow1.createCell(16).setCellValue("任务状态ID");
        headerRow1.createCell(17).setCellValue("优先度ID");
        // 使用VLOOKUP函数来显示对应的ID
        for (int i = 1; i <= 100; i++) {
            Row row = mainSheet.createRow(i);
            Cell cellUser = row.createCell(5);
            Cell cellUser = row.createCell(15);
            cellUser.setCellFormula("VLOOKUP(E" + (i + 1) + ", '员工详细信息'!$A$1:$B$" + userList.size() + ", 2, FALSE)");
            Cell cellStatus = row.createCell(7);
            cellStatus.setCellFormula("VLOOKUP(G" + (i + 1) + ", '状态详细信息'!$A$1:$B$" + statuses.length + ", 2, FALSE)");
            Cell cellYstatus = row.createCell(9);
            cellYstatus.setCellFormula("VLOOKUP(I" + (i + 1) + ", '优先度详细信息'!$A$1:$B$" + priorities.length + ", 2, FALSE)");
            Cell cellStatus = row.createCell(16);
            cellStatus.setCellFormula("VLOOKUP(F" + (i + 1) + ", '状态详细信息'!$A$1:$B$" + statuses.length + ", 2, FALSE)");
            Cell cellYstatus = row.createCell(17);
            cellYstatus.setCellFormula("VLOOKUP(G" + (i + 1) + ", '优先度详细信息'!$A$1:$B$" + priorities.length + ", 2, FALSE)");
        }
        mainSheet.setColumnWidth(5, 0);
        mainSheet.setColumnWidth(7, 0);
        mainSheet.setColumnWidth(8, 0);
        mainSheet.setColumnWidth(9, 0);
        mainSheet.setColumnWidth(10, 0);
        mainSheet.setColumnWidth(11, 0);
        mainSheet.setColumnWidth(12, 0);
        mainSheet.setColumnWidth(13, 0);
        mainSheet.setColumnWidth(14, 0);
        mainSheet.setColumnWidth(15, 0);
        mainSheet.setColumnWidth(16, 0);
        mainSheet.setColumnWidth(17, 0);
//        response.setHeader("Content-Disposition", "attachment;filename=测试.xlsx");
//        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.mainSheet;charset=utf-8");
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/repository/CmnLevelRankRepository.java
@@ -33,4 +33,7 @@
    @Query(value = "select * from new_cmn_level_rank where level_id = ?1",nativeQuery = true)
    List<CmnLevelRank> findByLevelId(Long levelId);
    @Query(value = "select * from new_cmn_level_rank where level_id = ?1 ORDER BY min_rank_wage ASC",nativeQuery = true)
    List<CmnLevelRank> findbylevelSm(Long levelId);
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/repository/CmnLevelRepository.java
@@ -16,8 +16,12 @@
package me.zhengjie.modules.treatment.repository;
import me.zhengjie.modules.treatment.domain.CmnLevel;
import me.zhengjie.modules.treatment.domain.MeritLevel;
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
@@ -25,4 +29,7 @@
* @date 2023-05-07
**/
public interface CmnLevelRepository extends JpaRepository<CmnLevel, Long>, JpaSpecificationExecutor<CmnLevel> {
    @Query(value = "SELECT * FROM `new_cmn_level` WHERE job_id = ? ORDER BY basic_wage ASC", nativeQuery = true)
    List<CmnLevel> findByJobId(Long jobId);
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/repository/MeritLevelRepository.java
@@ -1,5 +1,6 @@
package me.zhengjie.modules.treatment.repository;
import me.zhengjie.modules.system.domain.SysUserLevelOther;
import me.zhengjie.modules.treatment.domain.MeritLevel;
import me.zhengjie.modules.treatment.domain.MeritWage;
import org.springframework.data.jpa.repository.JpaRepository;
@@ -19,4 +20,12 @@
    List<MeritLevel> findByMeritWageId(Long meritWageId);
    /**
     * 查询等级
     * @param levelId
     * @return
     */
    @Query(value = "SELECT * FROM merit_level WHERE merit_wage_id = (SELECT id FROM merit_wage WHERE level_id = ?1) ORDER BY merit_standard ASC", nativeQuery = true)
    List<MeritLevel> findMinMeritStandardByLevelId(Long levelId);
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/repository/UserInsuranceRepository.java
@@ -15,12 +15,15 @@
*/
package me.zhengjie.modules.treatment.repository;
import me.zhengjie.modules.treatment.domain.CmnLevelRank;
import me.zhengjie.modules.treatment.domain.UserInsurance;
import java.util.List;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
/**
* @website https://eladmin.vip
@@ -30,4 +33,7 @@
public interface UserInsuranceRepository extends JpaRepository<UserInsurance, Long>, JpaSpecificationExecutor<UserInsurance> {
    Optional<UserInsurance> findByUserIdAndYearMonth(Long userId, String monthYear);
    @Query(value = "SELECT * from new_user_insurance WHERE user_id = ?1 AND `year_month` = ?2 ORDER BY create_time DESC LIMIT 1",nativeQuery = true)
    UserInsurance findbyUserIdAndDate(Long userId, String yearMonth);
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/repository/UserLevelWageRepository.java
@@ -16,6 +16,7 @@
package me.zhengjie.modules.treatment.repository;
import me.zhengjie.modules.system.domain.SysUserLevelWage;
import me.zhengjie.modules.treatment.domain.UserInsurance;
import me.zhengjie.modules.treatment.domain.UserLevelWage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
@@ -38,4 +39,7 @@
    @Query(value = "(select * from new_user_level_wage where user_id = ?1) order by `year_month` DESC",nativeQuery = true)
    List<UserLevelWage> findUserLevelWageByUserId(Long userId);
    @Query(value = "SELECT * from new_user_level_wage WHERE user_id = ?1 AND `year_month` = ?2 ORDER BY create_time DESC LIMIT 1",nativeQuery = true)
    UserLevelWage findbyUserIdAndDate(Long userId, String yearMonth);
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/rest/UserLevelWageController.java
@@ -31,6 +31,7 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.ParseException;
import java.util.List;
/**
@@ -104,4 +105,20 @@
        userLevelWageService.deleteAll(ids);
        return new ResponseEntity<>(HttpStatus.OK);
    }
    @GetMapping(value = "/getTravelAllowance")
    @Log("查询指定员工的出差补助")
    @ApiOperation("查询指定员工的出差补助")
    @PreAuthorize("@el.check('userLevelWage:list')")
    public ResponseEntity<Object> queryTravelAllowance(UserLevelWageQueryCriteria criteria) throws ParseException {
        return new ResponseEntity<>(userLevelWageService.queryTravelAllowance(criteria), HttpStatus.OK);
    }
    @GetMapping(value = "/getOvertimeAllowance")
    @Log("查询指定员工的加班工资")
    @ApiOperation("查询指定员工的加班工资")
    @PreAuthorize("@el.check('userLevelWage:list')")
    public ResponseEntity<Object> queryOverTimeAllowance(UserLevelWageQueryCriteria criteria) throws ParseException {
        return new ResponseEntity<>(userLevelWageService.queryOverTimeAllowance(criteria), HttpStatus.OK);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/UserLevelWageService.java
@@ -21,6 +21,8 @@
import me.zhengjie.modules.treatment.service.dto.UserLevelWageDto;
import me.zhengjie.modules.treatment.service.dto.UserLevelWageQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.text.ParseException;
import java.util.Map;
import java.util.List;
import java.io.IOException;
@@ -57,6 +59,19 @@
    UserLevelWageDto queryTargetYearMonth(UserLevelWageQueryCriteria criteria);
    /**
     * 查询指定用户的出差补助工资
     * @param criteria
     * @return
     */
    Double queryTravelAllowance(UserLevelWageQueryCriteria criteria) throws ParseException;
    /**
     * 查询指定员工的加班工资
     * @return
     */
    Double queryOverTimeAllowance(UserLevelWageQueryCriteria criteria) throws ParseException;
    /**
     * 根据ID查询
     * @param id ID
     * @return UserLevelWageDto
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/impl/UserInsuranceServiceImpl.java
@@ -103,12 +103,14 @@
        // 获取某年某月最后一天
        String yearMonth = targetYearMonth.substring(0,7);
        // 根据用户ID、指定年月查询
        Optional<UserInsurance> userInsuranceOpt = userInsuranceRepository.findByUserIdAndYearMonth(criteria.getUserId(), yearMonth);
//        Optional<UserInsurance> userInsuranceOpt = userInsuranceRepository.findByUserIdAndYearMonth(criteria.getUserId(), yearMonth);
        UserInsurance userInsuranceOpt = userInsuranceRepository.findbyUserIdAndDate(criteria.getUserId(), yearMonth);
        // 判断查询结果
        if (userInsuranceOpt.isPresent()) {
            UserInsurance userInsurance = userInsuranceOpt.get();
//        if (userInsuranceOpt.isPresent()) {
        if (userInsuranceOpt != null) {
//            UserInsurance userInsurance = userInsuranceOpt.get();
            // 返回
            return userInsuranceMapper.toDto(userInsurance);
            return userInsuranceMapper.toDto(userInsuranceOpt);
        } else {
//            throw new BadRequestException("没有获取到当前员工的级别信息!");
            throw new RuntimeException("没有获取到当前员工的级别信息!");
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/treatment/service/impl/UserLevelWageServiceImpl.java
@@ -17,7 +17,13 @@
import lombok.RequiredArgsConstructor;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.attendance.domain.AttendanceBusinessTravel;
import me.zhengjie.modules.attendance.domain.AttendanceOvertime;
import me.zhengjie.modules.attendance.repository.AttendanceBusinessTravelRepository;
import me.zhengjie.modules.attendance.repository.AttendanceOvertimeRepository;
import me.zhengjie.modules.system.domain.SysConfigProportion;
import me.zhengjie.modules.system.domain.User;
import me.zhengjie.modules.system.repository.SysConfigProportionRepository;
import me.zhengjie.modules.system.repository.UserRepository;
import me.zhengjie.modules.treatment.domain.UserInsurance;
import me.zhengjie.modules.treatment.domain.UserLevelWage;
@@ -38,6 +44,11 @@
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.function.Function;
@@ -57,6 +68,9 @@
    private final UserInsuranceRepository userInsuranceRepository;
    private final CmnInsuranceRepository cmnInsuranceRepository;
    private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository;
    private final SysConfigProportionRepository sysConfigProportionRepository;
    private final AttendanceOvertimeRepository attendanceOvertimeRepository;
    @Override
    public Map<String, Object> queryAll(UserLevelWageQueryCriteria criteria, Pageable pageable) {
@@ -88,7 +102,8 @@
        // 获取某年某月最后一天
        String yearMonth = targetYearMonth.substring(0,7);
        // 根据用户ID、指定年月查询
        UserLevelWage userLevelWage = userLevelWageRepository.findByUserIdAndYearMonth(criteria.getUserId(), yearMonth);
//        UserLevelWage userLevelWage = userLevelWageRepository.findByUserIdAndYearMonth(criteria.getUserId(), yearMonth);
        UserLevelWage userLevelWage = userLevelWageRepository.findbyUserIdAndDate(criteria.getUserId(), yearMonth);
        // 判断查询结果
        if (userLevelWage == null) {
//            throw new BadRequestException("没有获取到当前员工的级别信息!");
@@ -99,6 +114,51 @@
    }
    @Override
    public Double queryOverTimeAllowance(UserLevelWageQueryCriteria criteria) throws ParseException {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime dateTime = LocalDateTime.parse(criteria.getTargetYearMonth(), formatter);
        // 获取月初日期
        LocalDateTime firstDayOfMonth = dateTime.withDayOfMonth(1);
        // 获取下月初日期
        LocalDateTime firstDayOfNextMonth = firstDayOfMonth.plusMonths(1);
        // 查询指定员工的加班补助金额工资
        Double overTimeSalary = attendanceOvertimeRepository.findByUserIdAndYearMonth(criteria.getUserId(), firstDayOfMonth, firstDayOfNextMonth);
        // 查询配置表
        SysConfigProportion sysConfigProportion = sysConfigProportionRepository.findByTitle("加班补助金额");
        // 出差补助金
        Double travelSubsidy = (overTimeSalary == null ? 0.0 : overTimeSalary) * sysConfigProportion.getProportion();
        return travelSubsidy;
    }
        @Override
    public Double queryTravelAllowance(UserLevelWageQueryCriteria criteria) throws ParseException {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime dateTime = LocalDateTime.parse(criteria.getTargetYearMonth(), formatter);
        // 获取月初日期
        LocalDateTime firstDayOfMonth = dateTime.withDayOfMonth(1);
        // 获取下月初日期
        LocalDateTime firstDayOfNextMonth = firstDayOfMonth.plusMonths(1);
        System.out.println("月初日期:" + firstDayOfMonth);
        System.out.println("下月初日期:" + firstDayOfNextMonth);
        // 查询出差表的记录
        Integer bussSameMonthDays = attendanceBusinessTravelRepository.findByUserIdAndYearMonth(criteria.getUserId(), firstDayOfMonth, firstDayOfNextMonth);
        // 查询配置表
        SysConfigProportion sysConfigProportion = sysConfigProportionRepository.findByTitle("出差补助金额");
        // 出差补助金
        Double travelSubsidy = (bussSameMonthDays == null ? 0 : bussSameMonthDays) * sysConfigProportion.getProportion();
        return travelSubsidy;
    }
    @Override
    @Transactional
    public UserLevelWageDto findById(Long id) {
        UserLevelWage userLevelWage = userLevelWageRepository.findById(id).orElseGet(UserLevelWage::new);
eladmin-web-master/src/api/attendance/attendanceOvertime.js
New file
@@ -0,0 +1,43 @@
import request from '@/utils/request'
export function add(data) {
  return request({
    url: 'api/attendanceOvertime',
    method: 'post',
    data
  })
}
export function del(ids) {
  return request({
    url: 'api/attendanceOvertime/',
    method: 'delete',
    data: ids
  })
}
export function edit(data) {
  return request({
    url: 'api/attendanceOvertime',
    method: 'put',
    data
  })
}
export function calcTimeLength(data) {
  return request({
    url: 'api/attendanceOvertime/calcTimeLength',
    method: 'post',
    data
  })
}
export function approve(data) {
  return request({
    url: 'api/attendanceOvertime/approve',
    method: 'put',
    data
  })
}
export default { add, edit, del, calcTimeLength, approve }
eladmin-web-master/src/api/treatment/userLevelWage.js
@@ -32,4 +32,22 @@
  })
}
export default { add, edit, del, getTargetYearMonth }
export function getTravelAllowance(params) {
  return request({
    url: 'api/userLevelWage/getTravelAllowance',
    method: 'get',
    params
  })
}
export function getOvertimeAllowance(params) {
  return request({
    url: 'api/userLevelWage/getOvertimeAllowance',
    method: 'get',
    params
  })
}
export default { add, edit, del, getTargetYearMonth, getTravelAllowance, getOvertimeAllowance }
eladmin-web-master/src/utils/constant.js
@@ -343,6 +343,15 @@
// 费用类型
export const EXPENSE_TYPE = 'expense_type'
// 加班审批状态
export const OVERTIME_STATUS = 'overtime_status'
// 加班审批状态:审核中
export const OVERTIME_APPROVAL = 'overtime_approval'
// 加班审批状态:已通过
export const OVERTIME_PASS = 'overtime_pass'
// 加班审批状态:已退回
export const OVERTIME_RETURN = 'overtime_return'
export default {
  ROLE_LEVEL_SUPER,
  ROLE_LEVEL_GENERAL,
@@ -497,5 +506,9 @@
  ACCOUNT_TYPE_ZIXUN,
  ACCOUNT_TYPE_HENGZHEN,
  BUSINESS_STATUS,
  EXPENSE_TYPE
  EXPENSE_TYPE,
  OVERTIME_STATUS,
  OVERTIME_APPROVAL,
  OVERTIME_PASS,
  OVERTIME_RETURN
}
eladmin-web-master/src/views/attendance/attendanceLeave/index.vue
@@ -377,8 +377,6 @@
      makeUpCardVisible: false,
      successLoading: false,
      userRolesLevelMin: null,
      // 角色级别:普通用户
      roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY,
      // 角色级别: 总经理
      roleLevelGenerl: constant.ROLE_LEVEL_GENERAL
    }
eladmin-web-master/src/views/attendance/attendanceOvertime/index.vue
New file
@@ -0,0 +1,446 @@
<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div>
        <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>
        <el-select v-model="query.approvalUserId" 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>
        <el-select v-model="query.approvalStatus" filterable clearable placeholder="审批状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[dictApprovalStart]"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <el-date-picker
          v-model="query.overtimeStartTime"
          type="daterange"
          clearable
          class="date-item"
          value-format="yyyy-MM-dd HH:mm:ss"
          placeholder="请选择日期时间"
          range-separator=" : "
          start-placeholder="开始日期"
          end-placeholder="开始日期"
        />
        <el-date-picker
          v-model="query.overtimeEndTime"
          type="daterange"
          clearable
          class="date-item"
          value-format="yyyy-MM-dd HH:mm:ss"
          placeholder="请选择日期时间"
          range-separator=" : "
          start-placeholder="结束日期"
          end-placeholder="结束日期"
        />
        <rrOperation />
      </div>
      <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表单组件-->
      <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="80px">
          <el-form-item label="申请人" prop="userId">
            <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="disabledUser(form)">
              <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="approvalUserId">
            <el-select v-model="form.approvalUserId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn">
              <el-option
                v-for="item in approvalUsers"
                :key="item.id"
                :label="item.nickName"
                :value="item.id"
                :disabled="!item.enabled"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="加班开始时间" prop="overtimeStartTime">
            <el-date-picker
              v-model="form.overtimeStartTime"
              :type="'datetime'"
              placeholder="选择日期时间"
              style="width: 340px;"
              value-format="yyyy-MM-dd HH:mm:ss"
              align="right"
              :picker-options="{
                disabledDate(time) {
                  return form.overtimeEndTime ? time.getTime() > new Date(form.overtimeEndTime).getTime() - 8.64e7 : false;
                }
              }"
              :default-time="$store.state.user.user.sysRostering.workStartTime + ':00'"
              :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn"
              @change="checkLeaveTime()"
            />
          </el-form-item>
          <el-form-item label="加班结束时间" prop="overtimeEndTime">
            <el-date-picker
              v-model="form.overtimeEndTime"
              :type="'datetime'"
              placeholder="选择日期时间"
              style="width: 340px;"
              value-format="yyyy-MM-dd HH:mm:ss"
              align="right"
              :picker-options="{
                disabledDate(time) {
                  return form.overtimeStartTime ? time.getTime() < new Date(form.overtimeStartTime).getTime() - 8.64e7 : false;
                }
              }"
              :default-time="$store.state.user.user.sysRostering.workEndTime + ':00'"
              :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn"
              @change="checkLeaveTime()"
            />
          </el-form-item>
          <el-form-item label="加班时长" prop="overtimeDuration">
            <el-input v-model="form.overtimeDuration" disabled style="width: 340px;" />
          </el-form-item>
          <el-form-item label="审批说明">
            <el-input v-model="form.approvalDescription" type="textarea" rows="3" style="width: 340px;" />
          </el-form-item>
          <el-form-item label="备注">
            <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn"/>
          </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-dialog :close-on-click-modal="false" :before-close="closeCard" :visible.sync="makeUpCardVisible" title="请假审批" width="500px">
        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px">
          <el-form-item label="申请人">
            {{ form.userName }}
          </el-form-item>
          <el-form-item label="加班开始时间">
            {{ form.overtimeStartTime }}
          </el-form-item>
          <el-form-item label="加班结束时间">
            {{ form.overtimeEndTime }}
          </el-form-item>
          <el-form-item label="加班时长">
            {{ form.overtimeDuration + '(时)' }}
          </el-form-item>
          <el-form-item label="加班原因">
            {{ form.remarks }}
          </el-form-item>
          <el-form-item v-if="form.approvalStatus === dictAppRovalStatusReturn" label="退回原因" prop="approvalDescription">
            <div style="color: red;">*审核退回需要填写退回原因,请填写后再次点击审核退回</div>
            <el-input v-model="form.approvalDescription" type="textarea" :rows="3" style="width: 340px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="danger" style="margin-right: 10px;" @click="approveFunction(1,form)">审核退回</el-button>
          <el-button v-if="form.approvalStatus !== dictAppRovalStatusReturn" :loading="successLoading" type="success" @click="approveFunction(2,form)">审核通过</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" width="55" />
        <el-table-column prop="userName" label="申请人" min-width="100" fixed="left" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag>{{ scope.row.userName }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="appUserName" label="审批者" min-width="100" fixed="left" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag>{{ scope.row.appUserName }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="overtimeStartTime" label="加班开始时间" show-overflow-tooltip/>
        <el-table-column prop="overtimeEndTime" label="加班结束时间" show-overflow-tooltip/>
        <el-table-column prop="overtimeDuration" label="加班时长" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.overtimeDuration + '(时)' }}
          </template>
        </el-table-column>
        <el-table-column prop="approvalStatus" label="审批状态" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag v-if="scope.row.approvalStatus === dictAppRovalStatusUnderAppover" type="warning">{{ dict.label[dictApprovalStart][scope.row.approvalStatus] }}</el-tag>
            <el-tag v-if="scope.row.approvalStatus === dictAppRovalStatusPassed" type="success">{{ dict.label[dictApprovalStart][scope.row.approvalStatus] }}</el-tag>
            <el-tag v-if="scope.row.approvalStatus === dictAppRovalStatusReturn" type="danger">{{ dict.label[dictApprovalStart][scope.row.approvalStatus] }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="approvalDescription" label="审批说明"  show-overflow-tooltip/>
        <el-table-column prop="remarks" label="备注" show-overflow-tooltip/>
        <el-table-column prop="createTime" label="创建时间" show-overflow-tooltip/>
        <el-table-column v-if="checkPer(['admin','attendanceOvertime:approve'])" label="审核操作" width="180px" align="center">
          <template slot-scope="scope">
            <el-button
              v-if="scope.row.approvalUserId === $store.state.user.user.id"
              v-permission="permission.approve"
              :loading="crud.status.cu === 2"
              size="mini"
              type="primary"
              icon="el-icon-s-check"
              :disabled="scope.row.approvalStatus === dictAppRovalStatusUnderAppover ? false : true"
              @click="toApprove(scope.row)"
            >审核
            </el-button>
            <el-popover
              :ref="`popover_${scope.row.id}`"
              width="200"
            >
              <p>确定撤销该记录?</p>
              <div style="text-align: right; margin: 0">
                <el-button size="mini" type="primary" @click="canel(scope.row)">取消</el-button>
                <el-button :loading="successLoading" type="primary" size="mini" @click="revoke(scope.row)">确定</el-button>
              </div>
              <el-button
                v-show="scope.row.approvalUserId === $store.state.user.user.id"
                slot="reference"
                v-permission="permission.approve"
                type="danger"
                icon="el-icon-edit-outline"
                size="mini"
                :disabled="scope.row.approvalStatus === dictAppRovalStatusUnderAppover ? true : false"
              >撤销
              </el-button>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column v-if="checkPer(['admin','attendanceOvertime:edit','attendanceOvertime:del'])" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>
<script>
import crudAttendanceOvertime from '@/api/attendance/attendanceOvertime'
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'
import { mapGetters } from 'vuex'
const defaultForm = { id: null, userId: null, approvalUserId: null, overtimeStartTime: null, overtimeEndTime: null, overtimeDuration: null, overtimeDurationUnit: null, approvalStatus: null, approvalDescription: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
export default {
  name: 'AttendanceOvertime',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: '考勤加班', url: 'api/attendanceOvertime', idField: 'id', sort: 'id,desc', crudMethod: { ...crudAttendanceOvertime }})
  },
  dicts: [constant.OVERTIME_STATUS],
  data() {
    return {
      permission: {
        add: ['admin', 'attendanceOvertime:add'],
        edit: ['admin', 'attendanceOvertime:edit'],
        del: ['admin', 'attendanceOvertime:del'],
        download: ['admin', 'attendanceOvertime:list'],
        approve: ['admin', 'attendanceOvertime:approve'],
      },
      rules: {
        userId: [
          { required: true, message: '用户ID不能为空', trigger: 'blur' }
        ],
        approvalUserId: [
          { required: true, message: '审批用户ID不能为空', trigger: 'blur' }
        ],
        overtimeStartTime: [
          { required: true, message: '加班开始时间不能为空', trigger: 'blur' }
        ],
        overtimeEndTime: [
          { required: true, message: '加班结束时间不能为空', trigger: 'blur' }
        ],
        overtimeDuration: [
          { required: true, message: '加班时长不能为空', trigger: 'blur' }
        ],
        overtimeDurationUnit: [
          { required: true, message: '加班时长单位不能为空', trigger: 'blur' }
        ],
        createBy: [
          { required: true, message: '创建者不能为空', trigger: 'blur' }
        ],
        createTime: [
          { required: true, message: '创建时间不能为空', trigger: 'blur' }
        ]
      },
      users: [],
      approvalUsers: [],
      dictApprovalStart: constant.OVERTIME_STATUS,
      userRolesLevelMin: null,
      // 角色级别: 总经理
      roleLevelGenerl: constant.ROLE_LEVEL_GENERAL,
      dictAppRovalStatusUnderAppover: constant.OVERTIME_APPROVAL,
      dictAppRovalStatusPassed: constant.OVERTIME_PASS,
      dictAppRovalStatusReturn: constant.OVERTIME_RETURN,
      successLoading: false,
      makeUpCardVisible: false,
    }
  },
  computed: {
    ...mapGetters([
      'user'
    ])
  },
  created() {
    this.getUsers()
    this.getApprovalUsers()
  },
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      // 用户角色级别数组
      const userRolesLevel = this.user.roles.map(({ level }) => level)
      // 用户最大角色级别
      this.userRolesLevelMin = Math.min(...userRolesLevel)
      return true
    },
    // 钩子:新建 - 之前
    [CRUD.HOOK.beforeToAdd]() {
      // 判断用户最大角色级别是否大于总经理角色:赋值
      if (this.userRolesLevelMin > this.roleLevelGenerl) {
        // 表单赋值
        this.form.userId = this.user.id
      }
    },
    // 查询员工
    getUsers() {
      crudUser.getAll().then(res => {
        this.users = res
      })
    },
    // 查询审核人
    getApprovalUsers() {
      crudUser.getApprovalUsers().then(res => {
        this.approvalUsers = res
      })
    },
    // 审核页面赋值
    toApprove(data, Number) {
      if (Number !== '1') {
        this.makeUpCardVisible = true
      }
      this.form.id = data.id
      this.form.userId = data.userId
      this.form.userName = data.userName
      this.form.overtimeStartTime = data.overtimeStartTime
      this.form.overtimeEndTime = data.overtimeEndTime
      this.form.overtimeDuration = data.overtimeDuration
      this.form.approvalDescription = data.approvalDescription
      this.form.remarks = data.remarks
    },
    // 审核提交功能
    approveFunction(Number, data) {
      this.form.userId = data.userId
      const msg = Number === 2 ? '通过' : '拒绝'
      this.$refs['form'].validate(valid => {
        if (!valid) {
          return
        }
        // 判断通过状态
        if (Number === 2) {
          this.form.approvalStatus = this.dictAppRovalStatusPassed
        } else {
          // 退回改状态显示退回原因
          this.form.approvalStatus = this.dictAppRovalStatusReturn
          if (this.form.approvalDescription == null) {
            return
          }
        }
        this.successLoading = true
        crudAttendanceOvertime.approve(this.form).then(res => {
          this.crud.refresh()
          this.makeUpCardVisible = false
          this.successLoading = false
          this.$message({
            type: 'success',
            message: '审核' + msg + '成功'
          })
        }).catch(() => {
          this.makeUpCardVisible = false
          this.successLoading = false
        })
        if (this.$refs['form']) {
          this.$refs['form'].resetFields()
        }
      })
    },
    // 撤消功能
    revoke(data) {
      this.toApprove(data, '1')
      this.form.approvalStatus = this.dictAppRovalStatusUnderAppover
      this.successLoading = true
      crudAttendanceOvertime.approve(this.form).then(res => {
        this.crud.refresh()
        this.successLoading = false
        this.$message({ type: 'success', message: '撤销成功' })
        this.$refs[`popover_${data.id}`].showPopper = false
      }).catch((error) => {
        this.$message({ type: 'error', message: error.response.data.message })
      })
      if (this.$refs['form']) {
        this.$refs['form'].resetFields()
      }
      this.crud.cancelCU()
    },
    // 禁用
    disabledUser(data) {
      if (this.userRolesLevelMin > this.roleLevelGenerl) {
        return true
      }
      if (data.approvalStatus !== null && data.approvalStatus === this.dictAppRovalStatusPassed || data.approvalStatus === this.dictAppRovalStatusReturn) {
        return true
      }
    },
    // 计算加班时长
    checkLeaveTime() {
      if(this.form.userId != null && this.form.overtimeStartTime != null && this.form.overtimeEndTime != null) {
        this.form.overtimeDuration = null
        crudAttendanceOvertime.calcTimeLength(this.form).then(res => {
          this.form.overtimeDuration = res.overtimeDuration
         })
      }
    },
    // 关闭
    closeCard() {
      if (this.$refs['form']) {
        this.$refs['form'].resetFields()
      }
      this.crud.cancelCU()
      this.makeUpCardVisible = false
    },
  }
}
</script>
<style scoped>
</style>
eladmin-web-master/src/views/salary/newSalary/index.vue
@@ -103,7 +103,7 @@
          </el-form-item>
          <el-form-item label="实际工资" prop="actualBasicWage">
            <money-input :key="actualBasicWageRandom" v-model="form.actualBasicWage" :width="523" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
          </el-form-item>
          </el-form-item>
          <el-divider>绩效工资</el-divider>
          <el-form-item label="应完成工时" prop="needCompletedAchievementsHours">
            <el-input v-model="form.needCompletedAchievementsHours" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="achievementsParameterBlur">
@@ -158,6 +158,9 @@
          </el-form-item>
          <el-form-item label="出差补助工资" prop="travelAllowance">
            <money-input :key="travelAllowanceRandom" v-model="form.travelAllowance" :width="523" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
          </el-form-item>
          <el-form-item label="加班工资" prop="overtimeAllowance">
            <money-input :key="overtimeAllowanceRandom" v-model="form.overtimeAllowance" :width="523" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />
          </el-form-item>
          <el-divider>公积金</el-divider>
          <el-form-item label="基数" prop="accumulationFund">
@@ -376,7 +379,7 @@
            {{ crud.toMoney(scope.row.afterTaxAmount) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="afterTaxAmount" label="其他金额" width="100">
        <el-table-column :show-overflow-tooltip="true" prop="pieceRate" label="其他金额" width="100">
          <template slot-scope="scope">
            {{crud.toMoney((scope.row.pieceRate == null ? 0 : scope.row.pieceRate) + (scope.row.travelAllowance == null ? 0 : scope.row.travelAllowance)) }}
          </template>
@@ -484,7 +487,7 @@
import crudSysConfigIndividualIncomeTax from '@/api/system/configIndividualIncomeTax'
// import { getMeritWage } from '../../../api/salary/newSalary'
const defaultForm = { id: null, userId: null, salaryYearMonth: null, basicWage: null, fullDays: null, absenceDays: null, actualBasicWage: null, achievementsWage: null, needCompletedAchievementsHours: null, alreadyCompletedAchievementsHours: null, CompletedAchievementsRate: null, meritMoney: null, actualAchievementsWage: null, performanceWage: null, personalPerformanceProportion: null, needCompletedPerformanceHours: null, alreadyCompletedPerformanceHours: null, actualPerformanceWage: null, teamWage: null, actualComplianceTeamHours: null, alreadyCompletedTeamHours: null, actualTeamWage: null, pieceRate: 0, travelAllowance: 0, accumulationFund: null, accumulationFundPersonal: null, accumulationFundPersonalAmount: null, accumulationFundCompany: null, accumulationFundCompanyAmount: null, retirementInsurance: null, retirementInsurancePersonal: null, retirementInsurancePersonalAmount: null, retirementInsuranceCompany: null, retirementInsuranceCompanyAmount: null, medicalInsurance: null, medicalInsurancePersonal: null, medicalInsurancePersonalAmount: null, medicalInsuranceCompany: null, medicalInsuranceCompanyAmount: null, unemploymentInsurance: null, unemploymentInsurancePersonal: null, unemploymentInsurancePersonalAmount: null, unemploymentInsuranceCompany: null, unemploymentInsuranceCompanyAmount: null, birthInsurance: null, birthInsurancePersonal: null, birthInsurancePersonalAmount: null, birthInsuranceCompany: null, birthInsuranceCompanyAmount: null, employmentInsurance: null, employmentInsurancePersonal: null, employmentInsurancePersonalAmount: null, employmentInsuranceCompany: null, employmentInsuranceCompanyAmount: null, preTaxAmount: null, individualIncomeTax: null, afterTaxAmount: null, remarks: null, publicityStatus: constant.PUBLICITY_STATUS_NOT, approveStatus: constant.APPROVE_STATUS_UNRECOGNIZED, createBy: null, createTime: null, updateBy: null, updateTime: null }
const defaultForm = { id: null, userId: null, salaryYearMonth: null, basicWage: null, fullDays: null, absenceDays: null, actualBasicWage: null, achievementsWage: null, needCompletedAchievementsHours: null, alreadyCompletedAchievementsHours: null, CompletedAchievementsRate: null, meritMoney: null, actualAchievementsWage: null, performanceWage: null, personalPerformanceProportion: null, needCompletedPerformanceHours: null, alreadyCompletedPerformanceHours: null, actualPerformanceWage: null, teamWage: null, actualComplianceTeamHours: null, alreadyCompletedTeamHours: null, actualTeamWage: null, pieceRate: 0, travelAllowance: 0, overtimeAllowance: 0, accumulationFund: null, accumulationFundPersonal: null, accumulationFundPersonalAmount: null, accumulationFundCompany: null, accumulationFundCompanyAmount: null, retirementInsurance: null, retirementInsurancePersonal: null, retirementInsurancePersonalAmount: null, retirementInsuranceCompany: null, retirementInsuranceCompanyAmount: null, medicalInsurance: null, medicalInsurancePersonal: null, medicalInsurancePersonalAmount: null, medicalInsuranceCompany: null, medicalInsuranceCompanyAmount: null, unemploymentInsurance: null, unemploymentInsurancePersonal: null, unemploymentInsurancePersonalAmount: null, unemploymentInsuranceCompany: null, unemploymentInsuranceCompanyAmount: null, birthInsurance: null, birthInsurancePersonal: null, birthInsurancePersonalAmount: null, birthInsuranceCompany: null, birthInsuranceCompanyAmount: null, employmentInsurance: null, employmentInsurancePersonal: null, employmentInsurancePersonalAmount: null, employmentInsuranceCompany: null, employmentInsuranceCompanyAmount: null, preTaxAmount: null, individualIncomeTax: null, afterTaxAmount: null, remarks: null, publicityStatus: constant.PUBLICITY_STATUS_NOT, approveStatus: constant.APPROVE_STATUS_UNRECOGNIZED, createBy: null, createTime: null, updateBy: null, updateTime: null }
export default {
  name: 'NewSalary',
  components: { pagination, crudOperation, rrOperation, udOperation, moneyInput },
@@ -789,6 +792,8 @@
      pieceRateRandom: 0,
      // 出差补助工资随机数
      travelAllowanceRandom: 0,
      // 加班工资随机数
      overtimeAllowanceRandom: 0,
      // 公积金基数随机数
      accumulationFundRandom: 0,
      // 公积金个人缴纳金额随机数
@@ -930,31 +935,29 @@
      this.pieceRateRandom = Math.random()
      // 出差补助工资
      this.travelAllowanceRandom = Math.random()
      // 加班工资
      this.overtimeAllowanceRandom = Math.random()
      // 个人所得税随机数
      // this.individualIncomeTaxRandom = Math.random()
      this.individualIncomeTaxRandom = 0
      // 税后金额随机数
      this.afterTaxAmountRandom = Math.random(),
      this.afterTaxAmountRandom = Math.random()
      // 获取用户级别工资
      crudUserLevelWage.getTargetYearMonth({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => {
        this.Level_now = res.level
      })
      // crudUserLevelWage.getTargetYearMonth({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => {
      //   this.Level_now = res.level
      // })
    },
    // 钩子: 编辑 - 之前
    // [CRUD.HOOK.beforeToEdit]() {
    //   // 表单加载
    //   this.formLoading = true
    // },
    // 获取用户级别数据
    getUserLevel() {
      // 判断所属员工、工资年月是否为空
      if (this.form.userId != null && this.form.userId !== '' && this.form.salaryYearMonth != null && this.form.salaryYearMonth !== '') {
        // 表单加载
        this.formLoading = true
        // 执行完以下内容才往下走:获取用户级别工资、获取用户级别保险、获取用户级别其他、获取工作天数、获取出勤小时数、获取达标工时、获取已完成工时
        // 执行完以下内容才往下走:获取用户级别工资、获取用户级别保险、获取用户级别其他、获取工作天数、获取出勤小时数、获取达标工时、获取已完成工时、获取员工出差补助
        Promise.all([
          this.getUserLevelWage(), this.getUserLevelOther(), this.getWorkDays(), this.getAttendanceHours(),
          this.getComplianceWork(), this.getCompletedWork(), this.getUserLevelInsurance()
          this.getComplianceWork(), this.getCompletedWork(), this.getUserLevelInsurance(), this.getTravelAllowance(), this.getOvertimeAllowance()
        ]).then(res => {
          // 表单加载
          this.formLoading = false
@@ -963,6 +966,36 @@
          this.formLoading = false
        })
      }
    },
    // 获取员工出差补助
    getTravelAllowance() {
      return new Promise((resolve, reject) => {
        // 获取用户级别其他
        crudUserLevelWage.getTravelAllowance({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => {
          this.form.travelAllowance = res
          this.travelAllowanceRandom = Math.random()
          // 成功
          resolve()
        }).catch(() => {
          // 失败
          reject()
        })
      })
    },
    // 获取员工加班工资
    getOvertimeAllowance() {
      return new Promise((resolve, reject) => {
        // 获取用户级别其他
        crudUserLevelWage.getOvertimeAllowance({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => {
          this.form.overtimeAllowance = res
          this.overtimeAllowanceRandom = Math.random()
          // 成功
          resolve()
        }).catch(() => {
          // 失败
          reject()
        })
      })
    },
    // 获取用户级别工资
    getUserLevelWage() {
@@ -1238,18 +1271,21 @@
    },
    // 获取工作天数
    getWorkDays() {
      console.log("useruseroooii:" + this.form.userId)
      return new Promise((resolve, reject) => {
        // 获取工作天数
        crudNewSalary.workDays({ targetYearMonth: this.form.salaryYearMonth }).then(res => {
        crudNewSalary.workDays({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => {
          // 全勤小时数
          this.form.fullDays = Number((res * 8).toFixed(2))
          // 应完成绩效工时
          this.form.needCompletedAchievementsHours = Number((res * 8).toFixed(2))
          this.form.CompletedAchievementsRate = Number(this.form.alreadyCompletedAchievementsHours / this.form.needCompletedAchievementsHours * 100).toFixed(2)
          // this.form.CompletedAchievementsRate = 100.0
          crudNewSalary.getMeritWage(this.form.CompletedAchievementsRate, this.Level_now).then(res => {
          if(this.form.CompletedAchievementsRate != NaN && this.Level_now != undefined) {
            crudNewSalary.getMeritWage(this.form.CompletedAchievementsRate, this.Level_now).then(res => {
            this.form.meritMoney = res
          })
          }
          // 发请求获取当前这个用户当前的基本的当前的业绩完成比可以得到多少钱
          // 定时器
          const interval = setInterval(() => {
@@ -1733,7 +1769,8 @@
    // 统计金额
    statisticalAmount() {
      // 税前金额
      this.form.preTaxAmount = this.form.actualBasicWage + this.form.actualAchievementsWage + this.form.actualPerformanceWage + this.form.actualTeamWage + this.form.pieceRate + this.form.travelAllowance + this.form.meritMoney
      // this.form.preTaxAmount = this.form.actualBasicWage + this.form.actualAchievementsWage + this.form.actualPerformanceWage + this.form.actualTeamWage + this.form.pieceRate + this.form.travelAllowance + this.form.meritMoney
      this.form.preTaxAmount = this.form.actualBasicWage + this.form.actualAchievementsWage + this.form.actualPerformanceWage + this.form.actualTeamWage + this.form.pieceRate + this.form.travelAllowance + this.form.meritMoney + this.form.overtimeAllowance
      // 税前金额随机数
      this.preTaxAmountRandom = Math.random()
      this.getWorkDays()
eladmin-web-master/src/views/task/task/index.vue
@@ -148,6 +148,16 @@
              />
            </el-select>
          </el-form-item>
          <el-form-item label="任务状态" v-if="isShow">
            <el-select v-model="form.taskStatus" filterable clearable placeholder="请选择" style="width: 340px;">
              <el-option
                v-for="item in dict[taskStatus]"
                :key="item.id"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="描述">
            <el-input v-model="form.description" :rows="3" type="textarea" style="width: 340px;" />
          </el-form-item>
@@ -488,7 +498,8 @@
      queryUser: [],
      dialogVisible: false,
      taskDetailDisabled: true,
      calendarLoading: true
      calendarLoading: true,
      isShow: false
    }
  },
  watch: {
@@ -588,6 +599,11 @@
      this.inputValue = null
      this.getTags()
    },
    // 新增之前
    [CRUD.HOOK.beforeToAdd]() {
      this.form.taskStatus = null
      this.isShow = false
    },
    // 钩子:新建 - 之前
    [CRUD.HOOK.beforeToCU]() {
      this.form.projectId = this.crud.query.projectId
@@ -598,6 +614,10 @@
        this.pidTasks = res
      })
    },
    // 编辑之前
    [CRUD.HOOK.beforeToEdit]() {
      this.isShow = true
    },
    // 日期点击
    handleDateClick(selectInfo) {
      console.log('handleDateClick.info:', selectInfo)
eladmin-web-master/src/views/task/taskUser/index.vue
@@ -1021,7 +1021,6 @@
          "task_status_in_hand",
          "task_status_test",
          "task_status_stop",
          "task_status_completed"
        ];
        this.selectedTaskName = data.name;
        this.flag = data.flag;
@@ -1077,6 +1076,14 @@
          所属员工ID: _,
          任务状态ID: ___,
          优先度ID: __,
          隔绝列1: ____,
          隔绝列2: _____,
          隔绝列3: ______,
          隔绝列4: _______,
          隔绝列5: ________,
          隔绝列6: _________,
          隔绝列7: __________,
          隔绝列8: ____________,
          ...newItem
        } = item;
        if ("任务开始时间" in newItem) {
@@ -1140,7 +1147,9 @@
      console.log("this.generateForm2 : ", this.generateFormTwo);
      this.tableHeader = header.filter(
        item =>
          item !== "所属员工ID" && item !== "任务状态ID" && item !== "优先度ID"
          item !== "所属员工ID" && item !== "任务状态ID" && item !== "优先度ID" && item !== "隔绝列1" &&
          item !== "隔绝列2" && item !== "隔绝列3" && item !== "隔绝列4" && item !== "隔绝列5" && item !== "隔绝列6" &&
          item !== "隔绝列7" && item !== "隔绝列8"
      );
    },
    // 生成表单打开
eladmin-web-master/src/views/treatment/userInsurance/index.vue
@@ -380,6 +380,12 @@
      crudUser.getAll({ enabled: true }).then(res => {
        this.users = res
      })
      this.users.forEach(user => {
        if (user.id === userId) {
          const num=  user.company
        }
      })
    },
    // 变更员工
    changeUser(userId) {