1. 休息日维护, 请假管理调整, 员工生成考勤信息解耦, 字典接口调整, 新增使用code做关联信息的接口
This commit is contained in:
parent
289d595239
commit
95f42c9fa1
@ -66,7 +66,7 @@ public class RzAttendanceStatistical extends BaseEntity
|
||||
@Excel(name = "特殊加班(小时)")
|
||||
private BigDecimal overTimeHours;
|
||||
|
||||
/** 迟到次数 */
|
||||
/** 异常次数 */
|
||||
@Excel(name = "异常次数")
|
||||
private Long lateNumber;
|
||||
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.evo.attendance.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.evo.attendance.domain.RzAttendanceStatistical;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -11,7 +13,7 @@ import java.util.List;
|
||||
* @author chenyj
|
||||
* @date 2024-09-05
|
||||
*/
|
||||
public interface RzAttendanceStatisticalMapper
|
||||
public interface RzAttendanceStatisticalMapper extends BaseMapper<RzAttendanceStatistical>
|
||||
{
|
||||
/**
|
||||
* 查询考勤统计
|
||||
|
||||
@ -2,6 +2,9 @@ package com.evo.attendance.service;
|
||||
|
||||
import com.evo.attendance.domain.RzAttendanceStatistical;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.system.domain.SysStaff;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -47,4 +50,13 @@ public interface IRzAttendanceStatisticalService
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult importRzAttendanceStatistical(List<RzAttendanceStatistical> list);
|
||||
|
||||
/***
|
||||
* 生成考勤信息
|
||||
* @param sysStaff
|
||||
* @param dayList
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
RzAttendanceStatistical createRzAttendance(SysStaff sysStaff, List<String> dayList, Date date);
|
||||
}
|
||||
|
||||
@ -1,25 +1,32 @@
|
||||
package com.evo.attendance.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.evo.attendance.domain.RzAbnormal;
|
||||
import com.evo.attendance.domain.RzAbnormalDetail;
|
||||
import com.evo.attendance.domain.RzAttendance;
|
||||
import com.evo.attendance.domain.RzAttendanceStatistical;
|
||||
import com.evo.attendance.mapper.RzAbnormalDetailMapper;
|
||||
import com.evo.attendance.mapper.RzAbnormalMapper;
|
||||
import com.evo.attendance.mapper.RzAttendanceMapper;
|
||||
import com.evo.attendance.mapper.RzAttendanceStatisticalMapper;
|
||||
import com.evo.attendance.service.IRzAbnormalDetailService;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.ParamUtils;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
import com.evo.personnelMatters.domain.RzHoliday;
|
||||
import com.evo.personnelMatters.mapper.RzHolidayMapper;
|
||||
import com.evo.utils.DateUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.evo.attendance.mapper.RzAbnormalDetailMapper;
|
||||
import com.evo.attendance.domain.RzAbnormalDetail;
|
||||
import com.evo.attendance.service.IRzAbnormalDetailService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Year;
|
||||
import java.time.YearMonth;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
/**
|
||||
* 考勤异常详情Service业务层处理
|
||||
@ -37,8 +44,6 @@ public class RzAbnormalDetailServiceImpl implements IRzAbnormalDetailService
|
||||
@Resource
|
||||
private RzAbnormalMapper rzAbnormalMapper; //异常汇总
|
||||
@Resource
|
||||
private RzHolidayMapper rzHolidayMapper; //节假日
|
||||
@Resource
|
||||
private RzAttendanceStatisticalMapper rzAttendanceStatisticalMapper; //考勤统计
|
||||
/**
|
||||
* 查询考勤异常详情
|
||||
@ -64,43 +69,53 @@ public class RzAbnormalDetailServiceImpl implements IRzAbnormalDetailService
|
||||
return rzAbnormalDetailMapper.selectRzAbnormalDetailList(rzAbnormalDetail);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
int year = 2025;
|
||||
YearMonth yearMonth = YearMonth.of(year,1);
|
||||
LocalDate date = yearMonth.atDay(1);
|
||||
while (date.getYear() == year){
|
||||
if(date.getDayOfWeek() == DayOfWeek.SUNDAY){
|
||||
System.out.println(date);
|
||||
}
|
||||
date = date.plusDays(1);
|
||||
}
|
||||
|
||||
// Year yearObject = Year.of(year); // 获取年份对象
|
||||
|
||||
|
||||
// IntStream.rangeClosed(1, 12) // 遍历1到12月
|
||||
// .forEach(month -> {
|
||||
// YearMonth yearMonth = YearMonth.of(year, month);
|
||||
// LocalDate firstDayOfMonth = yearMonth.atDay(1); // 获取当月的第1天
|
||||
// LocalDate firstSunday = firstDayOfMonth // 从第1天开始找第一个周日
|
||||
// .with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY));
|
||||
// System.out.println("Month: " + yearMonth + ", First Sunday: " + firstSunday);
|
||||
// });
|
||||
}
|
||||
/**
|
||||
* 新增考勤异常详情
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public void insertRzAbnormalDetail(){
|
||||
//获取所有人的考勤信息
|
||||
List<RzAttendance> res_list = rzAttendanceMapper.currentDateAllAttendance();
|
||||
try{
|
||||
RzAbnormalDetail rzAbnormalDetail = null;
|
||||
//查询节假日
|
||||
List<RzHoliday> h_list = rzHolidayMapper.selectRzHolidayList(null);
|
||||
//判断是否是节假日
|
||||
int flag = 0;
|
||||
for (RzHoliday rzHoliday : h_list) {
|
||||
if(rzHoliday.getHoliday().compareTo(res_list.get(0).getAttendanceDate()) == 0){
|
||||
flag = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//检查是否为假期
|
||||
Boolean isHoliday = ParamUtils.checkHoliday(res_list.get(0).getAttendanceDate());
|
||||
for (RzAttendance rzAttendance : res_list) {
|
||||
//判断是否是周日
|
||||
if(DateUtil.isSaturday(rzAttendance.getAttendanceDate(),1) || flag == 1){
|
||||
//判断未打卡
|
||||
if(rzAttendance.getWorkStartTime() == null){
|
||||
rzAttendance.setRemarks("公休");
|
||||
//判断是否为假期
|
||||
if(isHoliday){
|
||||
//判断未打卡, 做加班还是公休备注
|
||||
rzAttendance.setRemarks((rzAttendance.getWorkStartTime() == null ? "公休": "加班"));
|
||||
rzAttendanceMapper.updateRzAttendance(rzAttendance);
|
||||
continue;
|
||||
}
|
||||
rzAttendance.setRemarks("加班");
|
||||
rzAttendanceMapper.updateRzAttendance(rzAttendance);
|
||||
continue;
|
||||
}
|
||||
//判断今天没有打卡
|
||||
if("1".equals(rzAttendance.getYcsFlag()) || "1".equals(rzAttendance.getYcxFlag())
|
||||
|| rzAttendance.getWorkStartTime() == null || rzAttendance.getWorkEndTime() == null){
|
||||
//判断员工当月是否已经有迟到
|
||||
//判断有没有异常打卡
|
||||
if(anomalyCheckIn(rzAttendance)){
|
||||
//判断员工当月是否存在异常情况
|
||||
RzAbnormal rzAbnormal = rzAbnormalMapper.selectRzAbnormalByUserId(rzAttendance.getStaffId(),new Date());
|
||||
//不存在的话, 创建新的
|
||||
if(StringUtils.isNull(rzAbnormal)){
|
||||
rzAbnormal = new RzAbnormal();
|
||||
rzAbnormal.setDeptId(rzAttendance.getDeptId());
|
||||
@ -112,7 +127,23 @@ public class RzAbnormalDetailServiceImpl implements IRzAbnormalDetailService
|
||||
rzAbnormal.setDelFlag("0");
|
||||
rzAbnormalMapper.insertRzAbnormal(rzAbnormal);
|
||||
}
|
||||
rzAbnormalDetail = new RzAbnormalDetail();
|
||||
rzAbnormalDetailMapper.insertRzAbnormalDetail(getRzAbnormalDetail(rzAttendance, rzAbnormal));
|
||||
//反写汇总
|
||||
rzAbnormal.setNumber(rzAbnormal.getNumber() + 1);
|
||||
rzAbnormalMapper.updateRzAbnormal(rzAbnormal);
|
||||
//反写统计
|
||||
RzAttendanceStatistical attendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(rzAttendance.getStaffId(),rzAttendance.getAttendanceDate());
|
||||
attendanceStatistical.setLateNumber(attendanceStatistical.getLateNumber() + 1);
|
||||
rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(attendanceStatistical);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private RzAbnormalDetail getRzAbnormalDetail(RzAttendance rzAttendance, RzAbnormal rzAbnormal) {
|
||||
RzAbnormalDetail rzAbnormalDetail = new RzAbnormalDetail();
|
||||
rzAbnormalDetail.setAbnormalId(rzAbnormal.getId());
|
||||
rzAbnormalDetail.setName(rzAttendance.getName());
|
||||
rzAbnormalDetail.setClockDate(rzAttendance.getAttendanceDate());
|
||||
@ -128,21 +159,15 @@ public class RzAbnormalDetailServiceImpl implements IRzAbnormalDetailService
|
||||
rzAbnormalDetail.setClockType("未打下班卡");
|
||||
}
|
||||
rzAbnormalDetail.setDelFlag("0");
|
||||
rzAbnormalDetailMapper.insertRzAbnormalDetail(rzAbnormalDetail);
|
||||
//反写汇总
|
||||
rzAbnormal.setNumber(rzAbnormal.getNumber() + 1);
|
||||
rzAbnormalMapper.updateRzAbnormal(rzAbnormal);
|
||||
//反写统计
|
||||
RzAttendanceStatistical attendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(rzAttendance.getStaffId(),rzAttendance.getAttendanceDate());
|
||||
attendanceStatistical.setLateNumber(attendanceStatistical.getLateNumber() + 1);
|
||||
rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(attendanceStatistical);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return rzAbnormalDetail;
|
||||
}
|
||||
|
||||
public Boolean anomalyCheckIn(RzAttendance rzAttendance){
|
||||
// 上班异常 || 下班异常 || 上班没打卡 || 下班没打卡
|
||||
return ("1".equals(rzAttendance.getYcsFlag()) || "1".equals(rzAttendance.getYcxFlag()) || rzAttendance.getWorkStartTime() == null || rzAttendance.getWorkEndTime() == null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改考勤异常详情
|
||||
*
|
||||
|
||||
@ -1,22 +1,28 @@
|
||||
package com.evo.attendance.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.evo.attendance.domain.RzAttendance;
|
||||
import com.evo.attendance.mapper.RzAttendanceMapper;
|
||||
import com.evo.common.annotation.DataScope;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.domain.entity.SysDept;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.attendance.domain.RzAttendanceStatistical;
|
||||
import com.evo.attendance.mapper.RzAttendanceMapper;
|
||||
import com.evo.attendance.mapper.RzAttendanceStatisticalMapper;
|
||||
import com.evo.attendance.service.IRzAttendanceStatisticalService;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
import com.evo.common.annotation.DataScope;
|
||||
import com.evo.common.constant.Constants;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.domain.entity.SysDept;
|
||||
import com.evo.common.utils.*;
|
||||
import com.evo.personnelMatters.domain.RzOverTime;
|
||||
import com.evo.personnelMatters.mapper.RzOverTimeMapper;
|
||||
import com.evo.system.domain.SysStaff;
|
||||
import com.evo.system.mapper.SysDeptMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -26,10 +32,8 @@ import java.util.List;
|
||||
* @date 2024-09-05
|
||||
*/
|
||||
@Service
|
||||
public class RzAttendanceStatisticalServiceImpl implements IRzAttendanceStatisticalService
|
||||
public class RzAttendanceStatisticalServiceImpl extends ServiceImpl<RzAttendanceStatisticalMapper, RzAttendanceStatistical> implements IRzAttendanceStatisticalService
|
||||
{
|
||||
@Resource
|
||||
private RzAttendanceStatisticalMapper rzAttendanceStatisticalMapper;
|
||||
@Resource
|
||||
private SysDeptMapper deptMapper; //部门
|
||||
@Resource
|
||||
@ -45,7 +49,7 @@ public class RzAttendanceStatisticalServiceImpl implements IRzAttendanceStatisti
|
||||
@Override
|
||||
public RzAttendanceStatistical selectRzAttendanceStatisticalById(Long id)
|
||||
{
|
||||
return rzAttendanceStatisticalMapper.selectRzAttendanceStatisticalById(id);
|
||||
return getBaseMapper().selectRzAttendanceStatisticalById(id);
|
||||
}
|
||||
/**
|
||||
* 查询考勤统计列表
|
||||
@ -57,7 +61,7 @@ public class RzAttendanceStatisticalServiceImpl implements IRzAttendanceStatisti
|
||||
@DataScope(deptAlias = "d")
|
||||
public List<RzAttendanceStatistical> selectRzAttendanceStatisticalList(RzAttendanceStatistical rzAttendanceStatistical)
|
||||
{
|
||||
List<RzAttendanceStatistical> res_list = rzAttendanceStatisticalMapper.selectRzAttendanceStatisticalList(rzAttendanceStatistical);
|
||||
List<RzAttendanceStatistical> res_list = getBaseMapper().selectRzAttendanceStatisticalList(rzAttendanceStatistical);
|
||||
for (RzAttendanceStatistical attendanceStatistical : res_list) {
|
||||
SysDept sysDept = deptMapper.selectDeptById(attendanceStatistical.getDeptId());
|
||||
attendanceStatistical.setDeptName(sysDept.getDeptName());
|
||||
@ -76,7 +80,7 @@ public class RzAttendanceStatisticalServiceImpl implements IRzAttendanceStatisti
|
||||
rzAttendanceStatistical.setRealAttendance(rzAttendanceStatistical.getEssentialAttendance().add(rzAttendanceStatistical.getWorkOvertimeNumber()));
|
||||
rzAttendanceStatistical.setUpdateTime(DateUtils.getNowDate());
|
||||
rzAttendanceStatistical.setUpdateBy(SecurityUtils.getUsername());
|
||||
return rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
return getBaseMapper().updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,7 +93,7 @@ public class RzAttendanceStatisticalServiceImpl implements IRzAttendanceStatisti
|
||||
return AjaxResult.error("请输入校正日期!!");
|
||||
}
|
||||
//查询条件月统计的数据
|
||||
List<RzAttendanceStatistical> ms_list = rzAttendanceStatisticalMapper.queryStatisticalByMonth(rzAttendanceStatistical.getMonth());
|
||||
List<RzAttendanceStatistical> ms_list = getBaseMapper().queryStatisticalByMonth(rzAttendanceStatistical.getMonth());
|
||||
//计算打卡汇总表
|
||||
for (RzAttendanceStatistical attendanceStatistical : ms_list) {
|
||||
//初始化打卡记录
|
||||
@ -113,7 +117,7 @@ public class RzAttendanceStatisticalServiceImpl implements IRzAttendanceStatisti
|
||||
attendanceStatistical.setWorkOvertimeNumber(rzOverTime.getOverHours());
|
||||
}
|
||||
attendanceStatistical.setRealAttendance(attendanceStatistical.getEssentialAttendance().add(attendanceStatistical.getWorkOvertimeNumber()));
|
||||
rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(attendanceStatistical) ;
|
||||
getBaseMapper().updateRzAttendanceStatistical(attendanceStatistical) ;
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
@ -129,8 +133,81 @@ public class RzAttendanceStatisticalServiceImpl implements IRzAttendanceStatisti
|
||||
return AjaxResult.error("导入数据为空!!");
|
||||
}
|
||||
for (RzAttendanceStatistical rzAttendanceStatistical : list) {
|
||||
rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
getBaseMapper().updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
}
|
||||
return AjaxResult.success("导入数据成功!!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public RzAttendanceStatistical createRzAttendance(SysStaff sysStaff, List<String> dayList, Date date) {
|
||||
if(date == null){
|
||||
date = DateUtils.getNowDate();
|
||||
}
|
||||
if(Collections.isEmpty(dayList)){
|
||||
dayList = DateUtils.getMonthAndDays(date);
|
||||
}
|
||||
//根据员工ID查询当月的统计信息统计信息
|
||||
RzAttendanceStatistical rzAttendanceStatistical = getBaseMapper().getRzAttendanceStatisticalByDateAndName(sysStaff.getUserId(),date);
|
||||
if(StringUtils.isNotNull(rzAttendanceStatistical)){
|
||||
//判断名称和部门是否一样。不一样操作修改
|
||||
if(!rzAttendanceStatistical.getName().equals(sysStaff.getName()) || rzAttendanceStatistical.getDeptId() != sysStaff.getDeptId()){
|
||||
//修改部门和姓名
|
||||
rzAttendanceStatistical.setName(sysStaff.getName());
|
||||
rzAttendanceStatistical.setDeptId(sysStaff.getDeptId());
|
||||
getBaseMapper().updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
//查询考勤详情修改
|
||||
List<RzAttendance> kq_list = rzAttendanceMapper.queryMonthAttendanceByStaffId(sysStaff.getUserId(),new Date());
|
||||
//循环修改信息
|
||||
for (RzAttendance rzAttendance : kq_list) {
|
||||
rzAttendance.setDeptId(sysStaff.getDeptId());
|
||||
rzAttendance.setName(sysStaff.getName());
|
||||
rzAttendanceMapper.updateRzAttendance(rzAttendance);
|
||||
}
|
||||
}
|
||||
return rzAttendanceStatistical;
|
||||
}
|
||||
//新增考勤统计
|
||||
rzAttendanceStatistical = new RzAttendanceStatistical();
|
||||
rzAttendanceStatistical.setStaffId(sysStaff.getUserId());
|
||||
rzAttendanceStatistical.setName(sysStaff.getName());
|
||||
rzAttendanceStatistical.setMonth(date);
|
||||
rzAttendanceStatistical.setShouldAttendance(new BigDecimal(ParamUtils.getMonthWorkDayNum(getMonthWorkDayNum(date))).multiply(new BigDecimal("8.00")));
|
||||
rzAttendanceStatistical.setDeptId(sysStaff.getDeptId());
|
||||
rzAttendanceStatistical.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
rzAttendanceStatistical.setCreateBy(SecurityUtils.getUsername());
|
||||
rzAttendanceStatistical.setCreateTime(date);
|
||||
rzAttendanceStatistical.setAbsenteeism(new BigDecimal(0));
|
||||
getBaseMapper().insertRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
//新增考勤详情
|
||||
SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd");
|
||||
RzAttendance rzAttendance = null;
|
||||
List<RzAttendance> pa_list = new ArrayList<RzAttendance>();
|
||||
for(String day: dayList){
|
||||
rzAttendance = new RzAttendance();
|
||||
rzAttendance.setDeptId(sysStaff.getDeptId());
|
||||
rzAttendance.setName(sysStaff.getName());
|
||||
rzAttendance.setStaffId(sysStaff.getUserId());
|
||||
try{
|
||||
rzAttendance.setAttendanceDate(sdfd.parse(day));
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
rzAttendance.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
rzAttendance.setCreateTime(DateUtils.getNowDate());
|
||||
rzAttendance.setCreateBy(SecurityUtils.getUsername());
|
||||
pa_list.add(rzAttendance);
|
||||
}
|
||||
rzAttendanceMapper.insertBatchRzAttendance(pa_list);
|
||||
|
||||
return rzAttendanceStatistical;
|
||||
}
|
||||
|
||||
public Integer getMonthWorkDayNum(Date date){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
return calendar.getActualMaximum(java.util.Calendar.MONTH);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -8,8 +8,12 @@ import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.evo.common.constant.Constants;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
|
||||
/**
|
||||
@ -203,6 +207,62 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||
return endYear-startYear;
|
||||
}
|
||||
|
||||
public static Integer getBetweenMonth(Date start, Date end){
|
||||
Calendar currentDate = Calendar.getInstance();
|
||||
currentDate.setTime(start);
|
||||
|
||||
// 将输入的Date转换为Calendar以便获取年月信息
|
||||
Calendar endCalendar = Calendar.getInstance();
|
||||
endCalendar.setTime(end);
|
||||
// 计算年份差和月份差
|
||||
int yearsDiff = endCalendar.get(Calendar.YEAR) - currentDate.get(Calendar.YEAR);
|
||||
int monthsDiff = endCalendar.get(Calendar.MONTH) - currentDate.get(Calendar.MONTH);
|
||||
|
||||
// 调整月份差,考虑到年份差可能影响实际的月份数差异
|
||||
monthsDiff += yearsDiff * 12;
|
||||
|
||||
return monthsDiff;
|
||||
}
|
||||
|
||||
public static Long getBetweenDays(Date start, Date end){
|
||||
Calendar currentDate = Calendar.getInstance();
|
||||
currentDate.setTime(start);
|
||||
|
||||
// 将输入的Date转换为Calendar以便获取年月信息
|
||||
Calendar endCalendar = Calendar.getInstance();
|
||||
endCalendar.setTime(end);
|
||||
return calculateDifferenceInDays(endCalendar, currentDate);
|
||||
}
|
||||
|
||||
|
||||
public static long calculateDifferenceInDays(Calendar date1, Calendar date2) {
|
||||
long diffInMillies = Math.abs(date1.getTimeInMillis() - date2.getTimeInMillis());
|
||||
return diffInMillies / (24 * 60 * 60 * 1000); // 将毫秒转换为天
|
||||
}
|
||||
|
||||
public static List<String> getCurrentMonthAndDays(){
|
||||
return getMonthAndDays(DateUtils.getNowDate());
|
||||
}
|
||||
public static List<String> getMonthAndDays(Date date){
|
||||
List<String> dayList = new ArrayList<String>();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
int days = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
SimpleDateFormat sdfm = new SimpleDateFormat("yyyy-MM");
|
||||
for(int p=1;p<=days;p++){
|
||||
try{
|
||||
String rq = sdfm.format(date)+"-";
|
||||
if(p < 10){
|
||||
rq += Constants.SEIZE_A_SEAT_0 + p;
|
||||
}else {
|
||||
rq += p;
|
||||
}
|
||||
dayList.add(rq);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return dayList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,11 +1,22 @@
|
||||
package com.evo.common.utils;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.evo.attendance.domain.RzSysParam;
|
||||
import com.evo.attendance.service.IRzSysParamService;
|
||||
import com.evo.personnelMatters.domain.RzHoliday;
|
||||
import com.evo.personnelMatters.service.IRzHolidayService;
|
||||
import com.evo.system.service.ISysDictDataService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 全局参数获取配置类
|
||||
@ -17,19 +28,109 @@ import javax.annotation.Resource;
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ParamUtils {
|
||||
|
||||
private static IRzSysParamService paramService;
|
||||
|
||||
private static ISysDictDataService dictDataService;
|
||||
|
||||
private static IRzHolidayService rzHolidayService;
|
||||
|
||||
@Autowired
|
||||
public ParamUtils(IRzSysParamService paramService) {
|
||||
public ParamUtils(IRzSysParamService paramService, ISysDictDataService dictDataService,IRzHolidayService rzHolidayService) {
|
||||
this.paramService = paramService;
|
||||
this.dictDataService = dictDataService;
|
||||
this.rzHolidayService = rzHolidayService;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 获取全局静态文件地址
|
||||
* @return
|
||||
*/
|
||||
public static String getGlobalStaticUrl(){
|
||||
RzSysParam param= paramService.getRzSysParam("静态地址URL", "static_url","http://192.168.16.1:8081","静态文件的url地址");
|
||||
return param.getParamValue();
|
||||
}
|
||||
|
||||
/***
|
||||
* 获取那些请假类型不包含法休
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getLeaveTypeNotIncludedFaXiu(){
|
||||
RzSysParam param= paramService.getRzSysParam("请假类型不包含法休", "leave_type_not_included_fa_xiu","56,57,58","记录请假类型不包含法休, 属性值为字典的假期类型code, 多个参数使用,隔开");
|
||||
return Collections.asList(param.getParamValue().split(","));
|
||||
}
|
||||
/***
|
||||
* 获取那些请假类型不包含法休, 公休(周日)
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getLeaveTypeNotIncludedFaXiuAndPublicHoliday(){
|
||||
RzSysParam param= paramService.getRzSysParam("请假类型不包含法休和公休", "leave_type_not_included_fa_xiu_and_public_holiday","54","记录请假类型不包含法休和公休, 属性值为字典的假期类型code, 多个参数使用,隔开");
|
||||
return Collections.asList(param.getParamValue().split(","));
|
||||
}
|
||||
|
||||
/***
|
||||
* 获取那些请假类型需要自动计算请假时长
|
||||
* @return
|
||||
*/
|
||||
public static List<String> autoCalculationHolidayType(){
|
||||
RzSysParam param= paramService.getRzSysParam("需要自动计算请假时长的请假类型", "auto_calculation_holiday_type","54,56,57,58,59","需要自动计算请假时长的请假类型, 多个参数使用,隔开");
|
||||
return Collections.asList(param.getParamValue().split(","));
|
||||
}
|
||||
|
||||
/***
|
||||
* 获取每月的工作天数
|
||||
* @param monthNum
|
||||
* @return
|
||||
*/
|
||||
public static String getMonthWorkDayNum(Integer monthNum){
|
||||
return dictDataService.selectDictValue("sys_work_days",monthNum+"月");
|
||||
}
|
||||
|
||||
/***
|
||||
* 检查日期是否为假期
|
||||
* @param checkDate
|
||||
* @return true: 是 false: 不是
|
||||
*/
|
||||
public static Boolean checkHoliday(Date checkDate){
|
||||
if(checkDate == null){
|
||||
return false;
|
||||
}
|
||||
return checkHoliday(DateUtils.parseDateToStr("yyyy-MM-dd", checkDate));
|
||||
}
|
||||
/***
|
||||
* 检查日期是否为假期
|
||||
* @param checkDate
|
||||
* @return true: 是 false: 不是
|
||||
*/
|
||||
public static Boolean checkHoliday(String checkDate){
|
||||
if(StringUtils.isEmpty(checkDate)){
|
||||
return false;
|
||||
}
|
||||
//检查格式, 如果格式不匹配, 输出日志, 直接返回true
|
||||
if(!Pattern.compile("").matcher(checkDate).matches()){
|
||||
log.error("当前检查日期{}, 不符合检查规则", checkDate);
|
||||
return false;
|
||||
}
|
||||
//检查是否为假期
|
||||
return getHoliddayList(Integer.valueOf(checkDate.substring(0,4)), 0).contains(checkDate);
|
||||
}
|
||||
|
||||
/***
|
||||
* 获取假期范围 0 全部 1法休 2 公休
|
||||
* @param year
|
||||
* @Param holidayType 0 全部 1法休 2 公休
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getHoliddayList(Integer year, Integer holidayType){
|
||||
//获取当前年
|
||||
RzHoliday rzHoliday = rzHolidayService.selectRzHolidayByYear(year);
|
||||
Map<String, Integer> holidaysMaps = JSONObject.parseObject(rzHoliday.getHolidayInfo(), Map.class);
|
||||
if(Integer.valueOf(0).equals(holidayType)){
|
||||
return holidaysMaps.keySet().stream().collect(Collectors.toList());
|
||||
}
|
||||
return holidaysMaps.entrySet().stream().filter(m -> holidayType.equals(m.getValue())).map(m-> m.getKey()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
package com.evo.common.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 法修日维护类
|
||||
*
|
||||
* @ClassName:MyDateVo
|
||||
* @date: 2025年05月24日 17:24
|
||||
* @author: andy.shi
|
||||
* @contact: 17330188597
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Data
|
||||
public class HolidayParamVo {
|
||||
|
||||
Long id;
|
||||
|
||||
String holidayDate;
|
||||
|
||||
/***
|
||||
* 假期类型, 1 法休, 2公休
|
||||
*/
|
||||
Integer holidayType;
|
||||
|
||||
Boolean add;
|
||||
}
|
||||
25
evo-admin/src/main/java/com/evo/common/vo/HolidayVo.java
Normal file
25
evo-admin/src/main/java/com/evo/common/vo/HolidayVo.java
Normal file
@ -0,0 +1,25 @@
|
||||
package com.evo.common.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 法修日类
|
||||
*
|
||||
* @ClassName:HolidVo
|
||||
* @date: 2025年05月24日 17:28
|
||||
* @author: andy.shi
|
||||
* @contact: 17330188597
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Data
|
||||
public class HolidayVo {
|
||||
|
||||
Long holidayId;
|
||||
|
||||
Integer year;
|
||||
|
||||
List<List<List<MyDateVo>>> list = new ArrayList<>();
|
||||
}
|
||||
31
evo-admin/src/main/java/com/evo/common/vo/MyDateVo.java
Normal file
31
evo-admin/src/main/java/com/evo/common/vo/MyDateVo.java
Normal file
@ -0,0 +1,31 @@
|
||||
package com.evo.common.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 法修日维护类
|
||||
*
|
||||
* @ClassName:MyDateVo
|
||||
* @date: 2025年05月24日 17:24
|
||||
* @author: andy.shi
|
||||
* @contact: 17330188597
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Data
|
||||
public class MyDateVo {
|
||||
|
||||
Integer year;
|
||||
|
||||
Integer month;
|
||||
|
||||
Integer day;
|
||||
|
||||
String localDate;
|
||||
|
||||
Boolean holiday;
|
||||
/***
|
||||
* 1法休 2公休
|
||||
*/
|
||||
Integer holidayType;
|
||||
|
||||
}
|
||||
@ -14,15 +14,22 @@ import lombok.Data;
|
||||
@Data
|
||||
public class OptionVo {
|
||||
|
||||
Long key;
|
||||
Long value;
|
||||
|
||||
String value;
|
||||
String label;
|
||||
|
||||
String listClass;
|
||||
|
||||
public OptionVo() {
|
||||
}
|
||||
|
||||
public OptionVo(Long key, String value) {
|
||||
this.key = key;
|
||||
public OptionVo(Long value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
public OptionVo(Long value, String label, String listClass) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
this.listClass = listClass;
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ import com.evo.system.domain.SysStaffDetail;
|
||||
import com.evo.system.mapper.SysDeptMapper;
|
||||
import com.evo.system.mapper.SysStaffDetailMapper;
|
||||
import com.evo.system.mapper.SysStaffMapper;
|
||||
import com.evo.system.service.ISysDictDataService;
|
||||
import com.evo.utils.DateUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -66,7 +67,8 @@ public class RzSalaryDetailServiceImpl implements IRzSalaryDetailService
|
||||
private SysDeptMapper deptMapper; //部门
|
||||
@Resource
|
||||
private RzSpecialOverTimeMapper rzSpecialOverTimeMapper;
|
||||
|
||||
@Resource
|
||||
private ISysDictDataService sysDictDataService;
|
||||
/**
|
||||
* 查询工资详情
|
||||
*
|
||||
@ -352,79 +354,91 @@ public class RzSalaryDetailServiceImpl implements IRzSalaryDetailService
|
||||
//获取统计月份
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(month);
|
||||
//获取全年天数 - 节假日天数
|
||||
int days = calendar.getActualMaximum(Calendar.DAY_OF_YEAR);
|
||||
SimpleDateFormat sdfm = new SimpleDateFormat("yyyy-MM");
|
||||
SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd");
|
||||
//获取当前月
|
||||
Integer monthNum = calendar.getActualMaximum(Calendar.MONTH);
|
||||
//根据当前月获取字典信息
|
||||
String wordDays = sysDictDataService.selectDictValue("sys_work_days", monthNum+"月");
|
||||
// rzHolidayMapper.selectList();
|
||||
//获取假期信息
|
||||
//判断假期和特殊上班时间
|
||||
List<RzHoliday> h_list = rzHolidayMapper.selectRzHolidayList(null);
|
||||
try{
|
||||
//获取统计月所在年的开始和结束时间,统计一年的工作日期
|
||||
String start = sdfm.format(month).split("-")[0] + "-01-01";
|
||||
String end = sdfm.format(month).split("-")[0] + "-12-31";
|
||||
days -= DateUtil.isWeeked(sdfd.parse(start),sdfd.parse(end),1);
|
||||
for (RzHoliday rzHoliday : h_list) {
|
||||
if(rzHoliday.getHoliday().after(sdfd.parse(sdfm.format(month)+"-01"))
|
||||
&& rzHoliday.getHoliday().before(sdfd.parse(sdfm.format(month)+"-" + calendar.get(Calendar.DAY_OF_MONTH)))){
|
||||
if("1".equals(rzHoliday.getSpecialFlag())){
|
||||
days += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
//记录工资详情
|
||||
SysStaffDetail sysStaffDetail = sysStaffDetailMapper.selectSysStaffDetailByStaffId(sysStaff.getUserId());
|
||||
//补助扣除比例
|
||||
BigDecimal bfb = new BigDecimal("0.00");
|
||||
//获取考勤统计
|
||||
RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(sysStaff.getUserId(),month);
|
||||
//判断入职日期,社保缴纳日期以前入职,计算补助扣除比例
|
||||
if(sysStaff.getEmploymentDate().before(date)){
|
||||
//计算请假百分比
|
||||
BigDecimal b = rzAttendanceStatistical.getAbsenteeism().divide(new BigDecimal("4"));
|
||||
bfb = b.multiply(new BigDecimal(Constants.SUBSIDY_PROPORTION));
|
||||
sysStaffDetail.setAbsenteeismSubsidies(bfb);
|
||||
}else{
|
||||
sysStaffDetail.setAbsenteeismSubsidies(new BigDecimal("1.00"));
|
||||
}
|
||||
// sysStaffDetail.setNightShiftSubsidies(sysStaffDetail.getNightShiftSubsidies().multiply(new BigDecimal(rzAttendanceStatistical.getNightNumber())));
|
||||
// sysStaffDetail.setDinnerSubsidies(sysStaffDetail.getDinnerSubsidies().multiply(new BigDecimal(rzAttendanceStatistical.getNightNumber())));
|
||||
//是否打卡
|
||||
if("否".equals(sysStaff.getClockIn())){
|
||||
return sysStaffDetail;
|
||||
}
|
||||
//查询员工考勤月的考勤
|
||||
List<RzAttendance> att_list = rzAttendanceMapper.queryMonthAttendanceByStaffId(sysStaff.getUserId(),month);
|
||||
//判断是日工资
|
||||
if(sysStaffDetail.getDailyWage().doubleValue() > 0) {
|
||||
//额薪资日期在工资月下一个月
|
||||
calendar.set(Calendar.MONTH,1);
|
||||
//全额薪资日期在工资月以前
|
||||
if(sysStaff.getWagesRatioDate().before(month)) {
|
||||
sysStaffDetail.setBasicSalary(sysStaffDetail.getDailyWage().divide(new BigDecimal("8.0"),2, RoundingMode.HALF_UP)
|
||||
.multiply(rzAttendanceStatistical.getRealAttendance().add(rzAttendanceStatistical.getWorkOvertimeNumber())));
|
||||
}else if(sysStaff.getWagesRatioDate().after(calendar.getTime())) {
|
||||
sysStaffDetail.setBasicSalary(sysStaffDetail.getDailyWage().divide(new BigDecimal("8.0"),2, RoundingMode.HALF_UP)
|
||||
.multiply(rzAttendanceStatistical.getRealAttendance().add(rzAttendanceStatistical.getWorkOvertimeNumber())).multiply(new BigDecimal(Constants.SUBSIDY_PERIOD)));
|
||||
}else {
|
||||
//根据转正日期,查询员工的打卡信息
|
||||
BigDecimal att_work = new BigDecimal("0.0");
|
||||
for (RzAttendance rzAttendance : att_list) {
|
||||
if(rzAttendance.getAttendanceDate().before(sysStaff.getWagesRatioDate())) {
|
||||
att_work = att_work.add(rzAttendance.getWorkSum());
|
||||
}
|
||||
}
|
||||
//未转正需要扣除的工资
|
||||
BigDecimal work = sysStaffDetail.getDailyWage().divide(new BigDecimal("8.0"),2, RoundingMode.HALF_UP).multiply(att_work).multiply(new BigDecimal(Constants.SUBSIDY_PERIOD_1));
|
||||
sysStaffDetail.setBasicSalary(sysStaffDetail.getDailyWage().divide(new BigDecimal("8.0"),2, RoundingMode.HALF_UP)
|
||||
.multiply(rzAttendanceStatistical.getRealAttendance().add(rzAttendanceStatistical.getWorkOvertimeNumber())).subtract(work));
|
||||
}
|
||||
sysStaffDetail.setOverWages(sysStaffDetail.getDailyWage().divide(new BigDecimal("8.0"),2, RoundingMode.HALF_UP).multiply(rzAttendanceStatistical.getWorkOvertimeNumber()));
|
||||
sysStaffDetail.setAbsenteeismSalary(new BigDecimal("0.00"));
|
||||
// List<RzHoliday> h_list = rzHolidayMapper.selectRzHolidayList(null);
|
||||
|
||||
return null;
|
||||
|
||||
|
||||
|
||||
// //获取全年天数 - 节假日天数
|
||||
// int days = calendar.getActualMaximum(Calendar.DAY_OF_YEAR);
|
||||
// SimpleDateFormat sdfm = new SimpleDateFormat("yyyy-MM");
|
||||
// SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// //判断假期和特殊上班时间
|
||||
// List<RzHoliday> h_list = rzHolidayMapper.selectRzHolidayList(null);
|
||||
// try{
|
||||
// //获取统计月所在年的开始和结束时间,统计一年的工作日期
|
||||
// String start = sdfm.format(monthNum).split("-")[0] + "-01-01";
|
||||
// String end = sdfm.format(monthNum).split("-")[0] + "-12-31";
|
||||
// days -= DateUtil.isWeeked(sdfd.parse(start),sdfd.parse(end),1);
|
||||
// for (RzHoliday rzHoliday : h_list) {
|
||||
// if(rzHoliday.getHoliday().after(sdfd.parse(sdfm.format(monthNum)+"-01")) && rzHoliday.getHoliday().before(sdfd.parse(sdfm.format(monthNum)+"-" + calendar.get(Calendar.DAY_OF_MONTH)))){
|
||||
// if("1".equals(rzHoliday.getSpecialFlag())){
|
||||
// days += 1;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// //记录工资详情
|
||||
// SysStaffDetail sysStaffDetail = sysStaffDetailMapper.selectSysStaffDetailByStaffId(sysStaff.getUserId());
|
||||
// //补助扣除比例
|
||||
// BigDecimal bfb = new BigDecimal("0.00");
|
||||
// //获取考勤统计
|
||||
// RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(sysStaff.getUserId(), monthNum);
|
||||
// //判断入职日期,社保缴纳日期以前入职,计算补助扣除比例
|
||||
// if(sysStaff.getEmploymentDate().before(date)){
|
||||
// //计算请假百分比
|
||||
// BigDecimal b = rzAttendanceStatistical.getAbsenteeism().divide(new BigDecimal("4"));
|
||||
// bfb = b.multiply(new BigDecimal(Constants.SUBSIDY_PROPORTION));
|
||||
// sysStaffDetail.setAbsenteeismSubsidies(bfb);
|
||||
// }else{
|
||||
// sysStaffDetail.setAbsenteeismSubsidies(new BigDecimal("1.00"));
|
||||
// }
|
||||
//// sysStaffDetail.setNightShiftSubsidies(sysStaffDetail.getNightShiftSubsidies().multiply(new BigDecimal(rzAttendanceStatistical.getNightNumber())));
|
||||
//// sysStaffDetail.setDinnerSubsidies(sysStaffDetail.getDinnerSubsidies().multiply(new BigDecimal(rzAttendanceStatistical.getNightNumber())));
|
||||
// //是否打卡
|
||||
// if("否".equals(sysStaff.getClockIn())){
|
||||
// return sysStaffDetail;
|
||||
// }
|
||||
// //查询员工考勤月的考勤
|
||||
// List<RzAttendance> att_list = rzAttendanceMapper.queryMonthAttendanceByStaffId(sysStaff.getUserId(), monthNum);
|
||||
// //判断是日工资
|
||||
// if(sysStaffDetail.getDailyWage().doubleValue() > 0) {
|
||||
// //额薪资日期在工资月下一个月
|
||||
// calendar.set(Calendar.MONTH,1);
|
||||
// //全额薪资日期在工资月以前
|
||||
// if(sysStaff.getWagesRatioDate().before(monthNum)) {
|
||||
// sysStaffDetail.setBasicSalary(sysStaffDetail.getDailyWage().divide(new BigDecimal("8.0"),2, RoundingMode.HALF_UP)
|
||||
// .multiply(rzAttendanceStatistical.getRealAttendance().add(rzAttendanceStatistical.getWorkOvertimeNumber())));
|
||||
// }else if(sysStaff.getWagesRatioDate().after(calendar.getTime())) {
|
||||
// sysStaffDetail.setBasicSalary(sysStaffDetail.getDailyWage().divide(new BigDecimal("8.0"),2, RoundingMode.HALF_UP)
|
||||
// .multiply(rzAttendanceStatistical.getRealAttendance().add(rzAttendanceStatistical.getWorkOvertimeNumber())).multiply(new BigDecimal(Constants.SUBSIDY_PERIOD)));
|
||||
// }else {
|
||||
// //根据转正日期,查询员工的打卡信息
|
||||
// BigDecimal att_work = new BigDecimal("0.0");
|
||||
// for (RzAttendance rzAttendance : att_list) {
|
||||
// if(rzAttendance.getAttendanceDate().before(sysStaff.getWagesRatioDate())) {
|
||||
// att_work = att_work.add(rzAttendance.getWorkSum());
|
||||
// }
|
||||
// }
|
||||
// //未转正需要扣除的工资
|
||||
// BigDecimal work = sysStaffDetail.getDailyWage().divide(new BigDecimal("8.0"),2, RoundingMode.HALF_UP).multiply(att_work).multiply(new BigDecimal(Constants.SUBSIDY_PERIOD_1));
|
||||
// sysStaffDetail.setBasicSalary(sysStaffDetail.getDailyWage().divide(new BigDecimal("8.0"),2, RoundingMode.HALF_UP)
|
||||
// .multiply(rzAttendanceStatistical.getRealAttendance().add(rzAttendanceStatistical.getWorkOvertimeNumber())).subtract(work));
|
||||
// }
|
||||
// sysStaffDetail.setOverWages(sysStaffDetail.getDailyWage().divide(new BigDecimal("8.0"),2, RoundingMode.HALF_UP).multiply(rzAttendanceStatistical.getWorkOvertimeNumber()));
|
||||
// sysStaffDetail.setAbsenteeismSalary(new BigDecimal("0.00"));
|
||||
// sysStaffDetail.setMiddleSubsidies(sysStaffDetail.getMiddleSubsidies().multiply(new BigDecimal(rzAttendanceStatistical.getMiddleShiftNumber())));
|
||||
}
|
||||
// }
|
||||
//判断是小时工
|
||||
// if(sysStaffDetail.getHoursSalary().doubleValue() > 0) {
|
||||
// //额薪资日期在工资月下一个月
|
||||
@ -450,55 +464,55 @@ public class RzSalaryDetailServiceImpl implements IRzSalaryDetailService
|
||||
// sysStaffDetail.setAbsenteeismSalary(new BigDecimal("0.00"));
|
||||
// sysStaffDetail.setMiddleSubsidies(sysStaffDetail.getMiddleSubsidies().multiply(new BigDecimal(rzAttendanceStatistical.getMiddleShiftNumber())));
|
||||
// }
|
||||
//判断是月工资
|
||||
if(sysStaffDetail.getBasicSalary().doubleValue() > 0 || sysStaffDetail.getJobsSalary().longValue() > 0) {
|
||||
//额薪资日期在工资月下一个月
|
||||
calendar.set(Calendar.MONTH,1);
|
||||
//全额薪资日期在工资月以前
|
||||
if(sysStaff.getWagesRatioDate().before(month)) {
|
||||
sysStaffDetail.setBasicSalary(sysStaffDetail.getBasicSalary().add(sysStaffDetail.getJobsSalary()));
|
||||
}else if(sysStaff.getWagesRatioDate().after(calendar.getTime())) {
|
||||
BigDecimal hours = sysStaffDetail.getBasicSalary().add(sysStaffDetail.getJobsSalary()).divide(rzAttendanceStatistical.getShouldAttendance(),2, RoundingMode.HALF_UP);
|
||||
sysStaffDetail.setBasicSalary(hours.multiply(rzAttendanceStatistical.getRealAttendance()).multiply(new BigDecimal(Constants.SUBSIDY_PERIOD)));
|
||||
}else {
|
||||
//根据转正日期,查询员工的打卡信息
|
||||
BigDecimal att_work = new BigDecimal("0.0");
|
||||
for (RzAttendance rzAttendance : att_list) {
|
||||
if(rzAttendance.getAttendanceDate().before(sysStaff.getWagesRatioDate())) {
|
||||
att_work = att_work.add(rzAttendance.getWorkSum());
|
||||
}
|
||||
}
|
||||
//未转正需要扣除的工资
|
||||
BigDecimal work = sysStaffDetail.getBasicSalary().add(sysStaffDetail.getJobsSalary()).divide(rzAttendanceStatistical.getShouldAttendance(),2, RoundingMode.HALF_UP)
|
||||
.multiply(att_work).multiply(new BigDecimal(Constants.SUBSIDY_PERIOD_1));
|
||||
sysStaffDetail.setBasicSalary(sysStaffDetail.getBasicSalary().add(sysStaffDetail.getJobsSalary()).subtract(work));
|
||||
}
|
||||
//计算月工资的每小时,工资
|
||||
BigDecimal evrymoney = sysStaffDetail.getBasicSalary().multiply(new BigDecimal("11.00"))
|
||||
.add(sysStaffDetail.getBasicSalary().multiply(new BigDecimal(Constants.SUBSIDY_PERIOD)))
|
||||
.divide(new BigDecimal(days).multiply(new BigDecimal("8.00")),2, RoundingMode.HALF_UP);
|
||||
sysStaffDetail.setAbsenteeismSalary(evrymoney.multiply(rzAttendanceStatistical.getShouldAttendance().subtract(rzAttendanceStatistical.getRealAttendance())));
|
||||
// sysStaffDetail.setMiddleSubsidies(new BigDecimal("0.00"));
|
||||
//根据用户获取当前的加班情况
|
||||
RzSpecialOverTime rSpecialOverTime = rzSpecialOverTimeMapper.selectRzSpecialOverTimeByUserIdAndDate(sysStaff.getUserId(),month);
|
||||
if(StringUtils.isNull(rSpecialOverTime)){
|
||||
sysStaffDetail.setOverWages(new BigDecimal("0.00"));
|
||||
}else{
|
||||
sysStaffDetail.setOverWages(evrymoney.multiply(rSpecialOverTime.getSickHours()));
|
||||
}
|
||||
}
|
||||
//判断员工的上班时长,设置保险的补交
|
||||
BigDecimal baifenbi = rzAttendanceStatistical.getRealAttendance().divide(rzAttendanceStatistical.getShouldAttendance(),2, RoundingMode.HALF_UP);
|
||||
if(baifenbi.compareTo(new BigDecimal("0.20")) > 0 && baifenbi.compareTo(new BigDecimal("0.40")) <= 0){
|
||||
sysStaffDetail.setCountInsurance(sysStaffDetail.getCountInsurance().multiply(new BigDecimal("0.70")));
|
||||
}else if(baifenbi.compareTo(new BigDecimal("0.40")) > 0 && baifenbi.compareTo(new BigDecimal("0.60")) <= 0){
|
||||
sysStaffDetail.setCountInsurance(sysStaffDetail.getCountInsurance().multiply(new BigDecimal("0.50")));
|
||||
}else if(baifenbi.compareTo(new BigDecimal("0.60")) > 0){
|
||||
sysStaffDetail.setCountInsurance(sysStaffDetail.getCountInsurance());
|
||||
}else{
|
||||
sysStaffDetail.setCountInsurance(new BigDecimal("0.00"));
|
||||
}
|
||||
return sysStaffDetail;
|
||||
// //判断是月工资
|
||||
// if(sysStaffDetail.getBasicSalary().doubleValue() > 0 || sysStaffDetail.getJobsSalary().longValue() > 0) {
|
||||
// //额薪资日期在工资月下一个月
|
||||
// calendar.set(Calendar.MONTH,1);
|
||||
// //全额薪资日期在工资月以前
|
||||
// if(sysStaff.getWagesRatioDate().before(monthNum)) {
|
||||
// sysStaffDetail.setBasicSalary(sysStaffDetail.getBasicSalary().add(sysStaffDetail.getJobsSalary()));
|
||||
// }else if(sysStaff.getWagesRatioDate().after(calendar.getTime())) {
|
||||
// BigDecimal hours = sysStaffDetail.getBasicSalary().add(sysStaffDetail.getJobsSalary()).divide(rzAttendanceStatistical.getShouldAttendance(),2, RoundingMode.HALF_UP);
|
||||
// sysStaffDetail.setBasicSalary(hours.multiply(rzAttendanceStatistical.getRealAttendance()).multiply(new BigDecimal(Constants.SUBSIDY_PERIOD)));
|
||||
// }else {
|
||||
// //根据转正日期,查询员工的打卡信息
|
||||
// BigDecimal att_work = new BigDecimal("0.0");
|
||||
// for (RzAttendance rzAttendance : att_list) {
|
||||
// if(rzAttendance.getAttendanceDate().before(sysStaff.getWagesRatioDate())) {
|
||||
// att_work = att_work.add(rzAttendance.getWorkSum());
|
||||
// }
|
||||
// }
|
||||
// //未转正需要扣除的工资
|
||||
// BigDecimal work = sysStaffDetail.getBasicSalary().add(sysStaffDetail.getJobsSalary()).divide(rzAttendanceStatistical.getShouldAttendance(),2, RoundingMode.HALF_UP)
|
||||
// .multiply(att_work).multiply(new BigDecimal(Constants.SUBSIDY_PERIOD_1));
|
||||
// sysStaffDetail.setBasicSalary(sysStaffDetail.getBasicSalary().add(sysStaffDetail.getJobsSalary()).subtract(work));
|
||||
// }
|
||||
// //计算月工资的每小时,工资
|
||||
// BigDecimal evrymoney = sysStaffDetail.getBasicSalary().multiply(new BigDecimal("11.00"))
|
||||
// .add(sysStaffDetail.getBasicSalary().multiply(new BigDecimal(Constants.SUBSIDY_PERIOD)))
|
||||
// .divide(new BigDecimal(days).multiply(new BigDecimal("8.00")),2, RoundingMode.HALF_UP);
|
||||
// sysStaffDetail.setAbsenteeismSalary(evrymoney.multiply(rzAttendanceStatistical.getShouldAttendance().subtract(rzAttendanceStatistical.getRealAttendance())));
|
||||
//// sysStaffDetail.setMiddleSubsidies(new BigDecimal("0.00"));
|
||||
// //根据用户获取当前的加班情况
|
||||
// RzSpecialOverTime rSpecialOverTime = rzSpecialOverTimeMapper.selectRzSpecialOverTimeByUserIdAndDate(sysStaff.getUserId(), monthNum);
|
||||
// if(StringUtils.isNull(rSpecialOverTime)){
|
||||
// sysStaffDetail.setOverWages(new BigDecimal("0.00"));
|
||||
// }else{
|
||||
// sysStaffDetail.setOverWages(evrymoney.multiply(rSpecialOverTime.getSickHours()));
|
||||
// }
|
||||
// }
|
||||
// //判断员工的上班时长,设置保险的补交
|
||||
// BigDecimal baifenbi = rzAttendanceStatistical.getRealAttendance().divide(rzAttendanceStatistical.getShouldAttendance(),2, RoundingMode.HALF_UP);
|
||||
// if(baifenbi.compareTo(new BigDecimal("0.20")) > 0 && baifenbi.compareTo(new BigDecimal("0.40")) <= 0){
|
||||
// sysStaffDetail.setCountInsurance(sysStaffDetail.getCountInsurance().multiply(new BigDecimal("0.70")));
|
||||
// }else if(baifenbi.compareTo(new BigDecimal("0.40")) > 0 && baifenbi.compareTo(new BigDecimal("0.60")) <= 0){
|
||||
// sysStaffDetail.setCountInsurance(sysStaffDetail.getCountInsurance().multiply(new BigDecimal("0.50")));
|
||||
// }else if(baifenbi.compareTo(new BigDecimal("0.60")) > 0){
|
||||
// sysStaffDetail.setCountInsurance(sysStaffDetail.getCountInsurance());
|
||||
// }else{
|
||||
// sysStaffDetail.setCountInsurance(new BigDecimal("0.00"));
|
||||
// }
|
||||
// return sysStaffDetail;
|
||||
}
|
||||
/**
|
||||
* 修改工资详情
|
||||
|
||||
@ -1,17 +1,32 @@
|
||||
package com.evo.personnelMatters.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.evo.common.annotation.Log;
|
||||
import com.evo.common.core.controller.BaseController;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.page.TableDataInfo;
|
||||
import com.evo.common.enums.BusinessType;
|
||||
import com.evo.common.utils.Collections;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
import com.evo.common.vo.HolidayParamVo;
|
||||
import com.evo.common.vo.HolidayVo;
|
||||
import com.evo.common.vo.MyDateVo;
|
||||
import com.evo.personnelMatters.domain.RzHoliday;
|
||||
import com.evo.personnelMatters.service.IRzHolidayService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.time.temporal.WeekFields;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 假期管理Controller
|
||||
@ -23,41 +38,73 @@ import java.util.List;
|
||||
@RequestMapping("/personnelMatters/holiday")
|
||||
public class RzHolidayController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
@Resource
|
||||
private IRzHolidayService rzHolidayService;
|
||||
|
||||
/**
|
||||
* 查询假期管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('personnelMatters:holiday:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RzHoliday rzHoliday)
|
||||
{
|
||||
startPage();
|
||||
List<RzHoliday> list = rzHolidayService.selectRzHolidayList(rzHoliday);
|
||||
return getDataTable(list);
|
||||
}
|
||||
// /**
|
||||
// * 查询假期管理列表
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('personnelMatters:holiday:list')")
|
||||
// @GetMapping("/list")
|
||||
// public TableDataInfo list(RzHoliday rzHoliday)
|
||||
// {
|
||||
// startPage();
|
||||
// List<RzHoliday> list = rzHolidayService.selectRzHolidayList(rzHoliday);
|
||||
// return getDataTable(list);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取假期管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('personnelMatters:holiday:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
@GetMapping("/pageInfo/{year}")
|
||||
public AjaxResult pageInfo(@PathVariable("year") Integer year)
|
||||
{
|
||||
return success(rzHolidayService.selectRzHolidayById(id));
|
||||
if(year == null){
|
||||
year = Integer.parseInt(new SimpleDateFormat("yyyy").format(new Date()));
|
||||
}
|
||||
RzHoliday holiday = rzHolidayService.selectRzHolidayByYear(year);
|
||||
Map<String, Integer> holidaysMaps = JSONObject.parseObject(holiday.getHolidayInfo(), Map.class);
|
||||
|
||||
/**
|
||||
* 新增假期管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('personnelMatters:holiday:add')")
|
||||
@Log(title = "假期管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RzHoliday rzHoliday)
|
||||
{
|
||||
rzHoliday.setCreateBy(SecurityUtils.getUsername());
|
||||
return rzHolidayService.insertRzHoliday(rzHoliday);
|
||||
HolidayVo result = new HolidayVo();
|
||||
result.setHolidayId(holiday.getId());
|
||||
result.setYear(year);
|
||||
|
||||
WeekFields weekFields = WeekFields.of(Locale.getDefault());
|
||||
List<List<List<MyDateVo>>> list = new ArrayList<>();
|
||||
//遍历12个月
|
||||
for (int i = 1; i <= 12; i++){
|
||||
List<List<MyDateVo>> weekList = new ArrayList<>();
|
||||
list.add(weekList);
|
||||
//card展示第一天
|
||||
LocalDate firstDayOfMonth = LocalDate.of(year, i, 1);
|
||||
LocalDate firstDay = firstDayOfMonth.with(weekFields.dayOfWeek(), 1);
|
||||
//card展示最后一天
|
||||
LocalDate lastDayOfMonth = firstDayOfMonth.with(TemporalAdjusters.lastDayOfMonth());
|
||||
LocalDate lastDay = lastDayOfMonth.with(weekFields.dayOfWeek(), 1).plusDays(6);
|
||||
//这个月有几周
|
||||
long weeksBetween = ChronoUnit.WEEKS.between(firstDay, lastDay);
|
||||
int cou = 0;
|
||||
//遍历每周
|
||||
for (int j = 0; j < weeksBetween+1; j++){
|
||||
List<MyDateVo> week = new ArrayList<>();
|
||||
weekList.add(week);
|
||||
//遍历每天
|
||||
for (int k = 0; k < 7; k++){
|
||||
LocalDate localDate = firstDay.plusDays(cou++);
|
||||
MyDateVo myDate = new MyDateVo();
|
||||
myDate.setYear(localDate.getYear());
|
||||
myDate.setMonth(localDate.getMonthValue());
|
||||
myDate.setDay(localDate.getDayOfMonth());
|
||||
myDate.setLocalDate(localDate.toString());
|
||||
myDate.setHoliday(holidaysMaps.containsKey(localDate.toString()));//是否是节假日
|
||||
myDate.setHolidayType(holidaysMaps.get(localDate.toString()));//公休还是法休
|
||||
week.add(myDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
result.setList(list);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,21 +112,20 @@ public class RzHolidayController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('personnelMatters:holiday:edit')")
|
||||
@Log(title = "假期管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RzHoliday rzHoliday)
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody HolidayParamVo holidayParamVo)
|
||||
{
|
||||
rzHoliday.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(rzHolidayService.updateRzHoliday(rzHoliday));
|
||||
return toAjax(rzHolidayService.updateRzHoliday(holidayParamVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除假期管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('personnelMatters:holiday:remove')")
|
||||
@Log(title = "假期管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
{
|
||||
return toAjax(rzHolidayService.deleteRzHoliday(id,SecurityUtils.getUsername()));
|
||||
}
|
||||
// /**
|
||||
// * 删除假期管理
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('personnelMatters:holiday:remove')")
|
||||
// @Log(title = "假期管理", businessType = BusinessType.DELETE)
|
||||
// @DeleteMapping("/{id}")
|
||||
// public AjaxResult remove(@PathVariable Long id)
|
||||
// {
|
||||
// return toAjax(rzHolidayService.deleteRzHoliday(id,SecurityUtils.getUsername()));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import com.evo.common.core.controller.BaseController;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.page.TableDataInfo;
|
||||
import com.evo.common.enums.BusinessType;
|
||||
import com.evo.common.utils.ParamUtils;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
import com.evo.common.utils.poi.ExcelUtil;
|
||||
import com.evo.personnelMatters.domain.RzLeave;
|
||||
@ -15,6 +16,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 请假管理Controller
|
||||
@ -41,6 +43,12 @@ public class RzLeaveController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/autoTypeList")
|
||||
public AjaxResult autoTypeList()
|
||||
{
|
||||
return AjaxResult.success(ParamUtils.autoCalculationHolidayType().stream().map(Integer::valueOf).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出请假管理列表
|
||||
*/
|
||||
|
||||
@ -30,11 +30,9 @@ public class RzLeaveDetailController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('personnelMatters:leaveDetail:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RzLeaveDetail rzLeaveDetail)
|
||||
public AjaxResult list(RzLeaveDetail rzLeaveDetail)
|
||||
{
|
||||
startPage();
|
||||
List<RzLeaveDetail> list = rzLeaveDetailService.selectRzLeaveDetailList(rzLeaveDetail);
|
||||
return getDataTable(list);
|
||||
return AjaxResult.success(rzLeaveDetailService.selectRzLeaveDetailList(rzLeaveDetail));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,4 +77,12 @@ public class RzLeaveDetailController extends BaseController
|
||||
{
|
||||
return rzLeaveDetailService.deleteRzLeaveDetailById(id);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/calculationLeaveHour")
|
||||
public AjaxResult calculationLeaveHour(@RequestBody RzLeaveDetail rzLeaveDetail)
|
||||
{
|
||||
return AjaxResult.success(rzLeaveDetailService.calculationLeaveHour(rzLeaveDetail));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
package com.evo.personnelMatters.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.evo.common.annotation.Excel;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
@ -14,6 +17,9 @@ import java.util.Date;
|
||||
* @author chenyj
|
||||
* @date 2024-08-03
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@TableName(value = "bs_holidays")
|
||||
public class RzHoliday extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -21,74 +27,9 @@ public class RzHoliday extends BaseEntity
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 假期时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "假期时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date holiday;
|
||||
/** 年信息 */
|
||||
private Integer year;
|
||||
/** 假期信息, 采用json格式存储 一个日期对应一个名称 */
|
||||
private String holidayInfo;
|
||||
|
||||
/** 假期说明 */
|
||||
@Excel(name = "假期说明")
|
||||
private String remarks;
|
||||
|
||||
@Excel(name = "特殊标识")
|
||||
private String specialFlag;
|
||||
//删除标识
|
||||
private String delFlag;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setHoliday(Date holiday)
|
||||
{
|
||||
this.holiday = holiday;
|
||||
}
|
||||
|
||||
public Date getHoliday()
|
||||
{
|
||||
return holiday;
|
||||
}
|
||||
public void setRemarks(String remarks)
|
||||
{
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public String getRemarks()
|
||||
{
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getSpecialFlag() {
|
||||
return specialFlag;
|
||||
}
|
||||
|
||||
public void setSpecialFlag(String specialFlag) {
|
||||
this.specialFlag = specialFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("holiday", getHoliday())
|
||||
.append("remarks", getRemarks())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.evo.personnelMatters.domain;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.evo.common.annotation.Excel;
|
||||
@ -14,6 +15,7 @@ import com.evo.common.core.domain.BaseEntity;
|
||||
* @author evo
|
||||
* @date 2025-03-15
|
||||
*/
|
||||
@Data
|
||||
public class RzLeave extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -35,9 +37,9 @@ public class RzLeave extends BaseEntity
|
||||
private String name;
|
||||
|
||||
/** 请假月份(到月) */
|
||||
@Excel(name = "请假月份", readConverterExp = "到=月", dateFormat = "yyyy-MM")
|
||||
@JsonFormat(pattern = "yyyy-MM")
|
||||
private Date leaveDate;
|
||||
// @Excel(name = "请假月份", readConverterExp = "到=月", dateFormat = "yyyy-MM")
|
||||
// @JsonFormat(pattern = "yyyy-MM")
|
||||
// private Date leaveDate;
|
||||
|
||||
/** 病假时长(小时) */
|
||||
@Excel(name = "病假时长", readConverterExp = "小=时")
|
||||
@ -78,150 +80,6 @@ public class RzLeave extends BaseEntity
|
||||
/** 删除标识 */
|
||||
private String delFlag;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
public void setDeptId(Long deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setLeaveDate(Date leaveDate)
|
||||
{
|
||||
this.leaveDate = leaveDate;
|
||||
}
|
||||
|
||||
public Date getLeaveDate()
|
||||
{
|
||||
return leaveDate;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public void setSickHours(Integer sickHours)
|
||||
{
|
||||
this.sickHours = sickHours;
|
||||
}
|
||||
|
||||
public Integer getSickHours()
|
||||
{
|
||||
return sickHours;
|
||||
}
|
||||
public void setAbsenceHours(Integer absenceHours)
|
||||
{
|
||||
this.absenceHours = absenceHours;
|
||||
}
|
||||
|
||||
public Integer getAbsenceHours()
|
||||
{
|
||||
return absenceHours;
|
||||
}
|
||||
public void setCompensatoryHours(Integer compensatoryHours)
|
||||
{
|
||||
this.compensatoryHours = compensatoryHours;
|
||||
}
|
||||
|
||||
public Integer getCompensatoryHours()
|
||||
{
|
||||
return compensatoryHours;
|
||||
}
|
||||
public void setMarriageHours(Integer marriageHours)
|
||||
{
|
||||
this.marriageHours = marriageHours;
|
||||
}
|
||||
|
||||
public Integer getMarriageHours()
|
||||
{
|
||||
return marriageHours;
|
||||
}
|
||||
public void setAnnualHours(Integer annualHours)
|
||||
{
|
||||
this.annualHours = annualHours;
|
||||
}
|
||||
|
||||
public Integer getAnnualHours()
|
||||
{
|
||||
return annualHours;
|
||||
}
|
||||
public void setMaternityHours(Integer maternityHours)
|
||||
{
|
||||
this.maternityHours = maternityHours;
|
||||
}
|
||||
|
||||
public Integer getMaternityHours()
|
||||
{
|
||||
return maternityHours;
|
||||
}
|
||||
public void setPaternityHours(Integer paternityHours)
|
||||
{
|
||||
this.paternityHours = paternityHours;
|
||||
}
|
||||
|
||||
public Integer getPaternityHours()
|
||||
{
|
||||
return paternityHours;
|
||||
}
|
||||
public void setFuneralHours(Integer funeralHours)
|
||||
{
|
||||
this.funeralHours = funeralHours;
|
||||
}
|
||||
|
||||
public Integer getFuneralHours()
|
||||
{
|
||||
return funeralHours;
|
||||
}
|
||||
public void setWorkHours(Integer workHours)
|
||||
{
|
||||
this.workHours = workHours;
|
||||
}
|
||||
|
||||
public Integer getWorkHours()
|
||||
{
|
||||
return workHours;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@ -230,7 +88,6 @@ public class RzLeave extends BaseEntity
|
||||
.append("userId", getUserId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("name", getName())
|
||||
.append("leaveDate", getLeaveDate())
|
||||
.append("sickHours", getSickHours())
|
||||
.append("absenceHours", getAbsenceHours())
|
||||
.append("compensatoryHours", getCompensatoryHours())
|
||||
|
||||
@ -3,6 +3,7 @@ package com.evo.personnelMatters.domain;
|
||||
import com.evo.common.annotation.Excel;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
@ -15,6 +16,7 @@ import java.util.Date;
|
||||
* @author chenyj
|
||||
* @date 2024-08-03
|
||||
*/
|
||||
@Data
|
||||
public class RzLeaveDetail extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -27,13 +29,13 @@ public class RzLeaveDetail extends BaseEntity
|
||||
private String name;
|
||||
|
||||
/** 请假开始时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "请假开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "请假开始时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date leaveStartTime;
|
||||
|
||||
/** 请假结束时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "请假结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "请假结束时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date leaveEndTime;
|
||||
|
||||
/** 请假时长 */
|
||||
@ -42,91 +44,12 @@ public class RzLeaveDetail extends BaseEntity
|
||||
//请假汇总ID
|
||||
private Long leaveId;
|
||||
@Excel(name = "请假类型")
|
||||
private String type; //请假类型
|
||||
private Long type; //请假类型
|
||||
|
||||
private String remarks;
|
||||
|
||||
private String delFlag;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setLeaveStartTime(Date leaveStartTime)
|
||||
{
|
||||
this.leaveStartTime = leaveStartTime;
|
||||
}
|
||||
|
||||
public Date getLeaveStartTime()
|
||||
{
|
||||
return leaveStartTime;
|
||||
}
|
||||
public void setLeaveEndTime(Date leaveEndTime)
|
||||
{
|
||||
this.leaveEndTime = leaveEndTime;
|
||||
}
|
||||
|
||||
public Date getLeaveEndTime()
|
||||
{
|
||||
return leaveEndTime;
|
||||
}
|
||||
public void setLeaveHour(Integer leaveHour)
|
||||
{
|
||||
this.leaveHour = leaveHour;
|
||||
}
|
||||
|
||||
public Integer getLeaveHour()
|
||||
{
|
||||
return leaveHour;
|
||||
}
|
||||
public void setLeaveId(Long leaveId)
|
||||
{
|
||||
this.leaveId = leaveId;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public Long getLeaveId()
|
||||
{
|
||||
return leaveId;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
||||
@ -3,6 +3,7 @@ package com.evo.personnelMatters.domain;
|
||||
import com.evo.common.annotation.Excel;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
@ -15,6 +16,7 @@ import java.util.Date;
|
||||
* @author chenyj
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
@Data
|
||||
public class RzOverTime extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -41,78 +43,12 @@ public class RzOverTime extends BaseEntity
|
||||
/** 加班总时长(月) */
|
||||
@Excel(name = "加班总时长")
|
||||
private BigDecimal overHours;
|
||||
@Excel(name = "调休总时长")
|
||||
private BigDecimal taskHours;
|
||||
|
||||
/** 删除标识 */
|
||||
private String delFlag;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
public void setOverTimeMonth(Date overTimeMonth)
|
||||
{
|
||||
this.overTimeMonth = overTimeMonth;
|
||||
}
|
||||
|
||||
public Date getOverTimeMonth()
|
||||
{
|
||||
return overTimeMonth;
|
||||
}
|
||||
public void setOverHours(BigDecimal overHours)
|
||||
{
|
||||
this.overHours = overHours;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public BigDecimal getOverHours()
|
||||
{
|
||||
return overHours;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.evo.personnelMatters.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.evo.personnelMatters.domain.RzHoliday;
|
||||
import java.util.List;
|
||||
|
||||
@ -9,38 +10,8 @@ import java.util.List;
|
||||
* @author chenyj
|
||||
* @date 2024-08-03
|
||||
*/
|
||||
public interface RzHolidayMapper
|
||||
public interface RzHolidayMapper extends BaseMapper<RzHoliday>
|
||||
{
|
||||
/**
|
||||
* 查询假期管理
|
||||
*
|
||||
* @param id 假期管理主键
|
||||
* @return 假期管理
|
||||
*/
|
||||
public RzHoliday selectRzHolidayById(Long id);
|
||||
|
||||
/**
|
||||
* 查询假期管理列表
|
||||
*
|
||||
* @param rzHoliday 假期管理
|
||||
* @return 假期管理集合
|
||||
*/
|
||||
public List<RzHoliday> selectRzHolidayList(RzHoliday rzHoliday);
|
||||
|
||||
/**
|
||||
* 新增假期管理
|
||||
*
|
||||
* @param rzHoliday 假期管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRzHoliday(RzHoliday rzHoliday);
|
||||
|
||||
/**
|
||||
* 修改假期管理
|
||||
*
|
||||
* @param rzHoliday 假期管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRzHoliday(RzHoliday rzHoliday);
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.evo.personnelMatters.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.evo.personnelMatters.domain.RzLeaveDetail;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -10,7 +12,7 @@ import java.util.List;
|
||||
* @author chenyj
|
||||
* @date 2024-08-03
|
||||
*/
|
||||
public interface RzLeaveDetailMapper
|
||||
public interface RzLeaveDetailMapper extends BaseMapper<RzLeaveDetail>
|
||||
{
|
||||
/**
|
||||
* 查询请假管理详情
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.evo.personnelMatters.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.evo.personnelMatters.domain.RzOverTime;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -11,7 +13,7 @@ import java.util.List;
|
||||
* @author chenyj
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
public interface RzOverTimeMapper
|
||||
public interface RzOverTimeMapper extends BaseMapper<RzOverTime>
|
||||
{
|
||||
/**
|
||||
* 查询加班管理
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.evo.personnelMatters.service;
|
||||
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.vo.HolidayParamVo;
|
||||
import com.evo.personnelMatters.domain.RzHoliday;
|
||||
import java.util.List;
|
||||
|
||||
@ -12,44 +13,21 @@ import java.util.List;
|
||||
*/
|
||||
public interface IRzHolidayService
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询假期管理
|
||||
*
|
||||
* @param id 假期管理主键
|
||||
* @param year 年
|
||||
* @return 假期管理
|
||||
*/
|
||||
public RzHoliday selectRzHolidayById(Long id);
|
||||
public RzHoliday selectRzHolidayByYear(Integer year);
|
||||
|
||||
/**
|
||||
* 查询假期管理列表
|
||||
*
|
||||
* @param rzHoliday 假期管理
|
||||
* @return 假期管理集合
|
||||
*/
|
||||
public List<RzHoliday> selectRzHolidayList(RzHoliday rzHoliday);
|
||||
|
||||
/**
|
||||
* 新增假期管理
|
||||
*
|
||||
* @param rzHoliday 假期管理
|
||||
* @return 结果
|
||||
*/
|
||||
public AjaxResult insertRzHoliday(RzHoliday rzHoliday);
|
||||
|
||||
/**
|
||||
* 修改假期管理
|
||||
*
|
||||
* @param rzHoliday 假期管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRzHoliday(RzHoliday rzHoliday);
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param id
|
||||
* @param oprName
|
||||
* @return
|
||||
*/
|
||||
public int deleteRzHoliday(Long id,String oprName);
|
||||
public Boolean updateRzHoliday(HolidayParamVo holidayParamVo);
|
||||
|
||||
}
|
||||
|
||||
@ -50,4 +50,6 @@ public interface IRzLeaveDetailService
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult deleteRzLeaveDetailById(Long id);
|
||||
|
||||
public RzLeaveDetail calculationLeaveHour(RzLeaveDetail rzLeaveDetail);
|
||||
}
|
||||
|
||||
@ -82,16 +82,16 @@ public class RzBusinessTripDetailServiceImpl implements IRzBusinessTripDetailSer
|
||||
//判断出差时间差包含几个周日
|
||||
int zr = DateUtil.isWeeked(rzTripDetail.getTripStartTime(),rzTripDetail.getTripEndTime(),1);
|
||||
//判断是否包含节假日
|
||||
List<RzHoliday> h_list = rzHolidayMapper.selectRzHolidayList(null);
|
||||
for (RzHoliday rzHoliday : h_list) {
|
||||
if(rzHoliday.getHoliday().after(rzTripDetail.getTripStartTime()) && rzHoliday.getHoliday().before(rzTripDetail.getTripEndTime())){
|
||||
if(rzHoliday.getSpecialFlag().equals(Constants.DELETE_FLAG_1)){
|
||||
zr -= 1;
|
||||
}else{
|
||||
zr += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// List<RzHoliday> h_list = rzHolidayMapper.selectRzHolidayList(null);
|
||||
// for (RzHoliday rzHoliday : h_list) {
|
||||
//// if(rzHoliday.getHoliday().after(rzTripDetail.getTripStartTime()) && rzHoliday.getHoliday().before(rzTripDetail.getTripEndTime())){
|
||||
//// if(rzHoliday.getSpecialFlag().equals(Constants.DELETE_FLAG_1)){
|
||||
//// zr -= 1;
|
||||
//// }else{
|
||||
//// zr += 1;
|
||||
//// }
|
||||
//// }
|
||||
// }
|
||||
// 出差天数的计算
|
||||
Long ts = (rzTripDetail.getTripEndTime().getTime() - rzTripDetail.getTripStartTime().getTime())/1000/60/60/24 + 1;
|
||||
rzTripDetail.setTripDay(ts);
|
||||
@ -127,16 +127,16 @@ public class RzBusinessTripDetailServiceImpl implements IRzBusinessTripDetailSer
|
||||
//判断出差时间差包含几个周日
|
||||
int zr = DateUtil.isWeeked(rzTripDetail.getTripStartTime(),rzTripDetail.getTripEndTime(),1);
|
||||
//判断是否包含节假日
|
||||
List<RzHoliday> h_list = rzHolidayMapper.selectRzHolidayList(null);
|
||||
for (RzHoliday rzHoliday : h_list) {
|
||||
if(rzHoliday.getHoliday().after(rzTripDetail.getTripStartTime()) && rzHoliday.getHoliday().before(rzTripDetail.getTripEndTime())){
|
||||
if(rzHoliday.getSpecialFlag().equals(Constants.DELETE_FLAG_1)){
|
||||
zr -= 1;
|
||||
}else{
|
||||
zr += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// List<RzHoliday> h_list = rzHolidayMapper.selectRzHolidayList(null);
|
||||
// for (RzHoliday rzHoliday : h_list) {
|
||||
//// if(rzHoliday.getHoliday().after(rzTripDetail.getTripStartTime()) && rzHoliday.getHoliday().before(rzTripDetail.getTripEndTime())){
|
||||
//// if(rzHoliday.getSpecialFlag().equals(Constants.DELETE_FLAG_1)){
|
||||
//// zr -= 1;
|
||||
//// }else{
|
||||
//// zr += 1;
|
||||
//// }
|
||||
//// }
|
||||
// }
|
||||
// 出差天数的计算
|
||||
Long ts = (rzTripDetail.getTripEndTime().getTime() - rzTripDetail.getTripStartTime().getTime())/1000/60/60/24 + 1;
|
||||
//反写出差总时长 TODO
|
||||
|
||||
@ -1,16 +1,26 @@
|
||||
package com.evo.personnelMatters.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.evo.common.constant.Constants;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.utils.Collections;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
import com.evo.common.vo.HolidayParamVo;
|
||||
import com.evo.personnelMatters.domain.RzHoliday;
|
||||
import com.evo.personnelMatters.mapper.RzHolidayMapper;
|
||||
import com.evo.personnelMatters.service.IRzHolidayService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 假期管理Service业务层处理
|
||||
@ -19,84 +29,53 @@ import java.util.List;
|
||||
* @date 2024-08-03
|
||||
*/
|
||||
@Service
|
||||
public class RzHolidayServiceImpl implements IRzHolidayService
|
||||
public class RzHolidayServiceImpl extends ServiceImpl<RzHolidayMapper, RzHoliday> implements IRzHolidayService
|
||||
{
|
||||
@Resource
|
||||
private RzHolidayMapper rzHolidayMapper;
|
||||
|
||||
/**
|
||||
* 查询假期管理
|
||||
*
|
||||
* @param id 假期管理主键
|
||||
* @return 假期管理
|
||||
*/
|
||||
|
||||
|
||||
@Override
|
||||
public RzHoliday selectRzHolidayById(Long id)
|
||||
{
|
||||
return rzHolidayMapper.selectRzHolidayById(id);
|
||||
public RzHoliday selectRzHolidayByYear(Integer year) {
|
||||
RzHoliday rzHoliday = getOne(new LambdaQueryWrapper<RzHoliday>().eq(RzHoliday::getYear, year), false);
|
||||
if(ObjectUtils.isEmpty(rzHoliday)){
|
||||
rzHoliday = new RzHoliday();
|
||||
rzHoliday.setYear(year);
|
||||
rzHoliday.setHolidayInfo(JSONObject.toJSONString(getAllYearRoundSunday(year)));
|
||||
save(rzHoliday);
|
||||
}
|
||||
return rzHoliday;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询假期管理列表
|
||||
*
|
||||
* @param rzHoliday 假期管理
|
||||
* @return 假期管理
|
||||
*/
|
||||
@Override
|
||||
public List<RzHoliday> selectRzHolidayList(RzHoliday rzHoliday)
|
||||
{
|
||||
return rzHolidayMapper.selectRzHolidayList(rzHoliday);
|
||||
public Map<String, Integer> getAllYearRoundSunday(Integer year){
|
||||
Map<String, Integer> sundays = Collections.emptyMap();
|
||||
YearMonth yearMonth = YearMonth.of(year,1);
|
||||
LocalDate date = yearMonth.atDay(1);
|
||||
while (date.getYear() == year){
|
||||
if(date.getDayOfWeek() == DayOfWeek.SUNDAY){
|
||||
sundays.put(date+"", 2);
|
||||
}
|
||||
date = date.plusDays(1);
|
||||
}
|
||||
return sundays;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增假期管理
|
||||
*
|
||||
* @param rzHoliday 假期管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult insertRzHoliday(RzHoliday rzHoliday)
|
||||
{
|
||||
List<RzHoliday> list = rzHolidayMapper.selectRzHolidayList(rzHoliday);
|
||||
if(StringUtils.isNotNull(list) && list.size() > 0){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
rzHoliday.setCreateTime(DateUtils.getNowDate());
|
||||
rzHoliday.setCreateBy(SecurityUtils.getUsername());
|
||||
rzHoliday.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
int i = rzHolidayMapper.insertRzHoliday(rzHoliday);
|
||||
if(i < 1){
|
||||
AjaxResult.error();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改假期管理
|
||||
*
|
||||
* @param rzHoliday 假期管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRzHoliday(RzHoliday rzHoliday)
|
||||
public Boolean updateRzHoliday(HolidayParamVo holidayParamVo)
|
||||
{
|
||||
rzHoliday.setUpdateTime(DateUtils.getNowDate());
|
||||
rzHoliday.setUpdateBy(SecurityUtils.getUsername());
|
||||
return rzHolidayMapper.updateRzHoliday(rzHoliday);
|
||||
RzHoliday rzHoliday = getById(holidayParamVo.getId());
|
||||
Map<String, Integer> holidaysMaps = JSONObject.parseObject(rzHoliday.getHolidayInfo(), Map.class);
|
||||
if(holidayParamVo.getAdd()){
|
||||
holidaysMaps.put(holidayParamVo.getHolidayDate(), holidayParamVo.getHolidayType());
|
||||
}else{
|
||||
holidaysMaps.remove(holidayParamVo.getHolidayDate());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param id
|
||||
* @param oprName
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int deleteRzHoliday(Long id,String oprName){
|
||||
RzHoliday rzHoliday = rzHolidayMapper.selectRzHolidayById(id);
|
||||
rzHoliday.setDelFlag(Constants.DELETE_FLAG_1);
|
||||
rzHoliday.setUpdateBy(SecurityUtils.getUsername());
|
||||
rzHoliday.setUpdateTime(DateUtils.getNowDate());
|
||||
return updateRzHoliday(rzHoliday);
|
||||
rzHoliday.setHolidayInfo(JSONObject.toJSONString(holidaysMaps));
|
||||
return updateById(rzHoliday);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,18 +1,25 @@
|
||||
package com.evo.personnelMatters.service.impl;
|
||||
|
||||
import com.evo.attendance.domain.RzAttendanceStatistical;
|
||||
import com.evo.attendance.mapper.RzAttendanceStatisticalMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.evo.common.constant.Constants;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.domain.entity.SysDictData;
|
||||
import com.evo.common.utils.Collections;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.ParamUtils;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
import com.evo.personnelMatters.domain.*;
|
||||
import com.evo.personnelMatters.mapper.*;
|
||||
import com.evo.personnelMatters.domain.RzLeave;
|
||||
import com.evo.personnelMatters.domain.RzLeaveDetail;
|
||||
import com.evo.personnelMatters.domain.RzOverTime;
|
||||
import com.evo.personnelMatters.mapper.RzLeaveDetailMapper;
|
||||
import com.evo.personnelMatters.mapper.RzLeaveMapper;
|
||||
import com.evo.personnelMatters.mapper.RzOverTimeMapper;
|
||||
import com.evo.personnelMatters.service.IRzLeaveDetailService;
|
||||
import com.evo.utils.DateUtil;
|
||||
import com.evo.system.service.ISysDictDataService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -26,16 +33,12 @@ import java.util.List;
|
||||
* @date 2024-08-03
|
||||
*/
|
||||
@Service
|
||||
public class RzLeaveDetailServiceImpl implements IRzLeaveDetailService
|
||||
public class RzLeaveDetailServiceImpl extends ServiceImpl<RzLeaveDetailMapper, RzLeaveDetail> implements IRzLeaveDetailService
|
||||
{
|
||||
@Resource
|
||||
private RzLeaveDetailMapper rzLeaveDetailMapper;
|
||||
@Resource
|
||||
private RzLeaveMapper rzLeaveMapper; //请假汇总
|
||||
@Resource
|
||||
private RzBusinessTripMapper rzBusinessTripMapper; //出差
|
||||
@Resource
|
||||
private RzAttendanceStatisticalMapper rzAttendanceStatisticalMapper; //打卡统计
|
||||
private ISysDictDataService sysDictDataService;
|
||||
/**
|
||||
* 查询请假管理详情
|
||||
*
|
||||
@ -45,7 +48,7 @@ public class RzLeaveDetailServiceImpl implements IRzLeaveDetailService
|
||||
@Override
|
||||
public RzLeaveDetail selectRzLeaveDetailById(Long id)
|
||||
{
|
||||
return rzLeaveDetailMapper.selectRzLeaveDetailById(id);
|
||||
return getBaseMapper().selectRzLeaveDetailById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -57,7 +60,7 @@ public class RzLeaveDetailServiceImpl implements IRzLeaveDetailService
|
||||
@Override
|
||||
public List<RzLeaveDetail> selectRzLeaveDetailList(RzLeaveDetail rzLeaveDetail)
|
||||
{
|
||||
return rzLeaveDetailMapper.selectRzLeaveDetailList(rzLeaveDetail);
|
||||
return getBaseMapper().selectRzLeaveDetailList(rzLeaveDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,72 +77,81 @@ public class RzLeaveDetailServiceImpl implements IRzLeaveDetailService
|
||||
if(rzLeaveDetail.getLeaveStartTime().getTime() > rzLeaveDetail.getLeaveEndTime().getTime()){
|
||||
return AjaxResult.error("请假开始时间不能早于结束时间!!");
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
//判断请假开始,结束时间是否在同一个月,不同月提示
|
||||
if(!sdf.format(rzLeaveDetail.getLeaveStartTime()).equals(sdf.format(rzLeaveDetail.getLeaveEndTime()))){
|
||||
return AjaxResult.error("请假时间不能跨月!!");
|
||||
}
|
||||
|
||||
//根据员工姓名查询
|
||||
RzLeave rzLeave = rzLeaveMapper.selectRzLeaveById(rzLeaveDetail.getLeaveId());
|
||||
//计算请假时长
|
||||
Long i = DateUtil.dateUtil.autoLeavehoursForCount(rzLeaveDetail.getLeaveStartTime(),rzLeaveDetail.getLeaveEndTime(),rzLeaveDetail.getType());
|
||||
rzLeaveDetail.setLeaveHour(i.intValue());
|
||||
rzLeaveDetail.setCreateTime(DateUtils.getNowDate());
|
||||
rzLeaveDetail.setCreateBy(SecurityUtils.getUsername());
|
||||
//验证调休
|
||||
if(Long.valueOf(55).equals(rzLeaveDetail.getType())){
|
||||
if(!autoLeavedNumber(rzLeave.getUserId(),rzLeaveDetail.getLeaveStartTime(),rzLeaveDetail.getLeaveHour())){
|
||||
return AjaxResult.error("当前人员的加班时长不足抵扣调休时长!!");
|
||||
}
|
||||
}
|
||||
rzLeaveDetail.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
int r = rzLeaveDetailMapper.insertRzLeaveDetail(rzLeaveDetail);
|
||||
if(r < 1){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
switch (rzLeaveDetail.getType()){
|
||||
case "2":
|
||||
rzLeave.setSickHours(rzLeave.getSickHours() + i.intValue());
|
||||
break;
|
||||
case "3":
|
||||
rzLeave.setAbsenceHours(rzLeave.getAbsenceHours() + i.intValue());
|
||||
break;
|
||||
case "4":
|
||||
rzLeave.setAnnualHours(rzLeave.getAnnualHours() + i.intValue());
|
||||
break;
|
||||
case "5":
|
||||
boolean flag = autoLeavedNumber(rzLeave.getUserId(),rzLeaveDetail.getLeaveStartTime(),i);
|
||||
if(flag){
|
||||
rzLeave.setCompensatoryHours(rzLeave.getCompensatoryHours() + i.intValue());
|
||||
}else{
|
||||
return AjaxResult.error("没有调休时间!!");
|
||||
}
|
||||
break;
|
||||
case "6":
|
||||
rzLeave.setMarriageHours(rzLeave.getMarriageHours() + i.intValue());
|
||||
break;
|
||||
case "7":
|
||||
rzLeave.setMaternityHours(rzLeave.getMaternityHours() + i.intValue());
|
||||
break;
|
||||
case "8":
|
||||
rzLeave.setPaternityHours(rzLeave.getPaternityHours() + i.intValue());
|
||||
break;
|
||||
case "9":
|
||||
rzLeave.setFuneralHours(rzLeave.getFuneralHours() + i.intValue());
|
||||
break;
|
||||
case "10":
|
||||
rzLeave.setWorkHours(rzLeave.getWorkHours() + i.intValue());
|
||||
break;
|
||||
}
|
||||
r = rzLeaveMapper.updateRzLeave(rzLeave);
|
||||
if(r < 1){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
//反写考勤汇总
|
||||
RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(rzLeave.getUserId(),rzLeave.getLeaveDate());
|
||||
rzAttendanceStatistical.setAbsenteeism(new BigDecimal(rzLeave.getWorkHours() + rzLeave.getFuneralHours() + rzLeave.getPaternityHours() + rzLeave.getMaternityHours()
|
||||
+ rzLeave.getMarriageHours() + rzLeave.getCompensatoryHours() + rzLeave.getAnnualHours() + rzLeave.getAbsenceHours() + rzLeave.getSickHours()));
|
||||
r = rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
if(r < 1){
|
||||
if(getBaseMapper().insert(rzLeaveDetail) < 1){
|
||||
return AjaxResult.error("请假详情新增失败");
|
||||
}
|
||||
return buildData(String.valueOf(rzLeaveDetail.getType()), rzLeave, rzLeaveDetail, rzLeaveDetail.getLeaveHour());
|
||||
}
|
||||
|
||||
|
||||
public AjaxResult buildData(String type, RzLeave rzLeave, RzLeaveDetail rzLeaveDetail, Integer holidayHour){
|
||||
switch (type){
|
||||
case "52":
|
||||
rzLeave.setSickHours(big(rzLeave.getSickHours() ,holidayHour));
|
||||
break;
|
||||
case "53":
|
||||
rzLeave.setAbsenceHours(big(rzLeave.getAbsenceHours() ,holidayHour));
|
||||
break;
|
||||
case "54":
|
||||
rzLeave.setAnnualHours(big(rzLeave.getAnnualHours() ,holidayHour));
|
||||
break;
|
||||
case "55":
|
||||
rzLeave.setCompensatoryHours(big(rzLeave.getCompensatoryHours() ,holidayHour));
|
||||
break;
|
||||
case "56":
|
||||
rzLeave.setMarriageHours(big(rzLeave.getMarriageHours() ,holidayHour));
|
||||
break;
|
||||
case "57":
|
||||
rzLeave.setMaternityHours(big(rzLeave.getMaternityHours() ,holidayHour));
|
||||
break;
|
||||
case "58":
|
||||
rzLeave.setPaternityHours(big(rzLeave.getPaternityHours() ,holidayHour));
|
||||
break;
|
||||
case "59":
|
||||
rzLeave.setFuneralHours(big(rzLeave.getFuneralHours() ,holidayHour));
|
||||
break;
|
||||
case "60":
|
||||
rzLeave.setWorkHours(big(rzLeave.getWorkHours() ,holidayHour));
|
||||
break;
|
||||
}
|
||||
if(rzLeaveMapper.updateRzLeave(rzLeave) < 0){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
//不再反写考勤汇总, 由定时器, 每天执行查找
|
||||
//这里需要做特殊处理, 如果时间范围跨月了, 需要每个月的考勤都要处理
|
||||
// Integer betweenMonth = DateUtils.getBetweenMonth(rzLeaveDetail.getLeaveStartTime(), rzLeaveDetail.getLeaveEndTime());
|
||||
// Date date = rzLeaveDetail.getLeaveStartTime();
|
||||
// for (int i = 0; i <= betweenMonth; i++) {
|
||||
// date = DateUtils.addMonths(date, i>0 ? 1 : 0);
|
||||
// System.out.println(DateUtils.parseDateToStr("yyyy-MM-dd", date));
|
||||
// RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(rzLeave.getUserId(),date);
|
||||
// if(rzAttendanceStatistical == null){
|
||||
// SysStaff sysStaff = sysStaffService.selectSysStaffByUserId(rzLeave.getUserId());
|
||||
// rzAttendanceStatistical = sysStaffService.createRzAttendance(sysStaff, Collections.emptyList(), date);
|
||||
// }
|
||||
// rzAttendanceStatistical.setAbsenteeism(rzAttendanceStatistical.getAbsenteeism().add(new BigDecimal(holidayHour)));
|
||||
// rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
// }
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
public Integer big(Integer baseNum, Integer addNum){
|
||||
return new BigDecimal(baseNum).add(new BigDecimal(addNum)).intValue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户ID及时间,调休时间判断员工是否可以调休
|
||||
* @param staffId 员工ID
|
||||
@ -147,15 +159,27 @@ public class RzLeaveDetailServiceImpl implements IRzLeaveDetailService
|
||||
* @param hours 请假时长
|
||||
* @return
|
||||
*/
|
||||
private boolean autoLeavedNumber(Long staffId, Date date,Long hours){
|
||||
//先查询出差是否有加班
|
||||
RzBusinessTrip RzBusinessTrip = rzBusinessTripMapper.selectRzBusinessTripListByMonth(staffId,date);
|
||||
//出差有加班且调休时间够,则可以调休
|
||||
if(StringUtils.isNotNull(RzBusinessTrip) && RzBusinessTrip.getOverDays() * 8 >= hours){
|
||||
RzBusinessTrip.setOverDays((RzBusinessTrip.getOverDays() * 8 - hours)/8);
|
||||
rzBusinessTripMapper.updateRzBusinessTrip(RzBusinessTrip);
|
||||
return true;
|
||||
@Resource
|
||||
RzOverTimeMapper overTimeMapper;
|
||||
private boolean autoLeavedNumber(Long staffId, Date date,Integer hours){
|
||||
// //先查询出差是否有加班
|
||||
// RzBusinessTrip RzBusinessTrip = rzBusinessTripMapper.selectRzBusinessTripListByMonth(staffId,date);
|
||||
// //出差有加班且调休时间够,则可以调休
|
||||
// if(StringUtils.isNotNull(RzBusinessTrip) && RzBusinessTrip.getOverDays() * 8 >= hours){
|
||||
// RzBusinessTrip.setOverDays((RzBusinessTrip.getOverDays() * 8 - hours)/8);
|
||||
// rzBusinessTripMapper.updateRzBusinessTrip(RzBusinessTrip);
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
//
|
||||
//查询加班时长, 核实当前
|
||||
RzOverTime rzOverTime = overTimeMapper.selectOne(new LambdaQueryWrapper<RzOverTime>().eq(RzOverTime::getUserId, staffId).apply(" and date_format(over_time_month,'%Y%m') = date_format({0},'%Y%m')", date));
|
||||
if(rzOverTime != null && rzOverTime.getOverHours().compareTo(rzOverTime.getTaskHours().add(new BigDecimal(hours))) <=0){
|
||||
rzOverTime.setTaskHours(rzOverTime.getTaskHours().add(new BigDecimal(hours)));
|
||||
return overTimeMapper.updateById(rzOverTime) > 0;
|
||||
}
|
||||
|
||||
//不允许调休
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -169,64 +193,27 @@ public class RzLeaveDetailServiceImpl implements IRzLeaveDetailService
|
||||
public AjaxResult updateRzLeaveDetail(RzLeaveDetail rzLeaveDetail)
|
||||
{
|
||||
//根据ID查询原始请假小时数
|
||||
RzLeaveDetail leaveDetail = rzLeaveDetailMapper.selectRzLeaveDetailById(rzLeaveDetail.getId());
|
||||
Long i = DateUtil.dateUtil.autoLeavehoursForCount(rzLeaveDetail.getLeaveStartTime(),rzLeaveDetail.getLeaveEndTime(),rzLeaveDetail.getType());
|
||||
rzLeaveDetail.setLeaveHour(i.intValue());
|
||||
RzLeaveDetail leaveDetail = getBaseMapper().selectRzLeaveDetailById(rzLeaveDetail.getId());
|
||||
rzLeaveDetail.setUpdateBy(SecurityUtils.getUsername());
|
||||
rzLeaveDetail.setUpdateTime(DateUtils.getNowDate());
|
||||
int r = rzLeaveDetailMapper.updateRzLeaveDetail(rzLeaveDetail);
|
||||
if(r < 1){
|
||||
if(getBaseMapper().updateRzLeaveDetail(rzLeaveDetail) < 1){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
//修改请假总时长
|
||||
RzLeave rzLeave = rzLeaveMapper.selectRzLeaveById(rzLeaveDetail.getLeaveId());
|
||||
//判断请假类型没有变化
|
||||
if(leaveDetail.getType().equals(rzLeaveDetail.getType())){
|
||||
switch (rzLeaveDetail.getType()){
|
||||
case "2":
|
||||
rzLeave.setSickHours(rzLeave.getSickHours() + i.intValue() - leaveDetail.getLeaveHour());
|
||||
break;
|
||||
case "3":
|
||||
rzLeave.setAbsenceHours(rzLeave.getAbsenceHours() + i.intValue() - leaveDetail.getLeaveHour());
|
||||
break;
|
||||
case "4":
|
||||
rzLeave.setAnnualHours(rzLeave.getAnnualHours() + i.intValue() - leaveDetail.getLeaveHour());
|
||||
break;
|
||||
case "5":
|
||||
rzLeave.setCompensatoryHours(rzLeave.getCompensatoryHours() + i.intValue() - leaveDetail.getLeaveHour());
|
||||
break;
|
||||
case "6":
|
||||
rzLeave.setMarriageHours(rzLeave.getMarriageHours() + i.intValue() - leaveDetail.getLeaveHour());
|
||||
break;
|
||||
case "7":
|
||||
rzLeave.setMaternityHours(rzLeave.getMaternityHours() + i.intValue() - leaveDetail.getLeaveHour());
|
||||
break;
|
||||
case "8":
|
||||
rzLeave.setPaternityHours(rzLeave.getPaternityHours() + i.intValue() - leaveDetail.getLeaveHour());
|
||||
break;
|
||||
case "9":
|
||||
rzLeave.setFuneralHours(rzLeave.getFuneralHours() + i.intValue() - leaveDetail.getLeaveHour());
|
||||
break;
|
||||
case "10":
|
||||
rzLeave.setWorkHours(rzLeave.getWorkHours() + i.intValue() - leaveDetail.getLeaveHour());
|
||||
break;
|
||||
//如果是调休假, 需要同步更新调休假信息
|
||||
Integer newHolidayHour = new BigDecimal(rzLeaveDetail.getLeaveHour()).subtract(new BigDecimal(leaveDetail.getLeaveHour())).intValue();
|
||||
if(newHolidayHour < 0){
|
||||
//如果小于0 并且是调休, 需要反加加班
|
||||
//验证调休
|
||||
if(Long.valueOf(55).equals(rzLeaveDetail.getType())){
|
||||
RzOverTime rzOverTime = overTimeMapper.selectOne(new LambdaQueryWrapper<RzOverTime>().eq(RzOverTime::getUserId, rzLeave.getUserId()).apply(" and date_format(over_time_month,'%Y%m') = date_format({0},'%Y%m')", rzLeaveDetail.getLeaveStartTime()));
|
||||
rzOverTime.setOverHours(rzOverTime.getTaskHours().add(new BigDecimal(Math.abs(newHolidayHour))));
|
||||
rzOverTime.setTaskHours(rzOverTime.getTaskHours().subtract(new BigDecimal(Math.abs(newHolidayHour))));
|
||||
overTimeMapper.updateById(rzOverTime);
|
||||
}
|
||||
}else{
|
||||
|
||||
}
|
||||
r = rzLeaveMapper.updateRzLeave(rzLeave);
|
||||
if(r < 1){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
//反写考勤汇总
|
||||
RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(rzLeave.getUserId(),rzLeave.getLeaveDate());
|
||||
rzAttendanceStatistical.setAbsenteeism(new BigDecimal(rzLeave.getWorkHours() + rzLeave.getFuneralHours() + rzLeave.getPaternityHours() + rzLeave.getMaternityHours()
|
||||
+ rzLeave.getMarriageHours() + rzLeave.getCompensatoryHours() + rzLeave.getAnnualHours() + rzLeave.getAbsenceHours() + rzLeave.getSickHours()));
|
||||
r = rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
if(r < 1){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
return buildData(String.valueOf(rzLeaveDetail.getType()), rzLeave, rzLeaveDetail, newHolidayHour);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -235,59 +222,119 @@ public class RzLeaveDetailServiceImpl implements IRzLeaveDetailService
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult deleteRzLeaveDetailById(Long id){
|
||||
RzLeaveDetail rzLeaveDetail = rzLeaveDetailMapper.selectRzLeaveDetailById(id);
|
||||
rzLeaveDetail.setUpdateBy(SecurityUtils.getUsername());
|
||||
rzLeaveDetail.setUpdateTime(DateUtils.getNowDate());
|
||||
rzLeaveDetail.setDelFlag(Constants.DELETE_FLAG_1);
|
||||
int r = rzLeaveDetailMapper.updateRzLeaveDetail(rzLeaveDetail);
|
||||
if(r < 1){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
//减少总时长
|
||||
RzLeave rzLeave = rzLeaveMapper.selectRzLeaveById(rzLeaveDetail.getLeaveId());
|
||||
switch (rzLeaveDetail.getType()){
|
||||
case "2":
|
||||
rzLeave.setSickHours(rzLeave.getSickHours() - rzLeaveDetail.getLeaveHour());
|
||||
break;
|
||||
case "3":
|
||||
rzLeave.setAbsenceHours(rzLeave.getAbsenceHours() - rzLeaveDetail.getLeaveHour());
|
||||
break;
|
||||
case "4":
|
||||
rzLeave.setAnnualHours(rzLeave.getAnnualHours() - rzLeaveDetail.getLeaveHour());
|
||||
break;
|
||||
case "5":
|
||||
rzLeave.setCompensatoryHours(rzLeave.getCompensatoryHours() - rzLeaveDetail.getLeaveHour());
|
||||
break;
|
||||
case "6":
|
||||
rzLeave.setMarriageHours(rzLeave.getMarriageHours() - rzLeaveDetail.getLeaveHour());
|
||||
break;
|
||||
case "7":
|
||||
rzLeave.setMaternityHours(rzLeave.getMaternityHours() - rzLeaveDetail.getLeaveHour());
|
||||
break;
|
||||
case "8":
|
||||
rzLeave.setPaternityHours(rzLeave.getPaternityHours() - rzLeaveDetail.getLeaveHour());
|
||||
break;
|
||||
case "9":
|
||||
rzLeave.setFuneralHours(rzLeave.getFuneralHours() - rzLeaveDetail.getLeaveHour());
|
||||
break;
|
||||
case "10":
|
||||
rzLeave.setWorkHours(rzLeave.getWorkHours() - rzLeaveDetail.getLeaveHour());
|
||||
break;
|
||||
}
|
||||
r = rzLeaveMapper.updateRzLeave(rzLeave);
|
||||
if(r < 1){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
//反写考勤汇总
|
||||
RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(rzLeave.getUserId(),rzLeave.getLeaveDate());
|
||||
rzAttendanceStatistical.setAbsenteeism(new BigDecimal(rzLeave.getWorkHours() + rzLeave.getFuneralHours() + rzLeave.getPaternityHours() + rzLeave.getMaternityHours()
|
||||
+ rzLeave.getMarriageHours() + rzLeave.getCompensatoryHours() + rzLeave.getAnnualHours() + rzLeave.getAbsenceHours() + rzLeave.getSickHours()));
|
||||
r = rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
if(r < 1){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
// RzLeaveDetail rzLeaveDetail = getBaseMapper().selectRzLeaveDetailById(id);
|
||||
// rzLeaveDetail.setUpdateBy(SecurityUtils.getUsername());
|
||||
// rzLeaveDetail.setUpdateTime(DateUtils.getNowDate());
|
||||
// rzLeaveDetail.setDelFlag(Constants.DELETE_FLAG_1);
|
||||
// int r = getBaseMapper().updateRzLeaveDetail(rzLeaveDetail);
|
||||
// if(r < 1){
|
||||
// return AjaxResult.error();
|
||||
// }
|
||||
// //减少总时长
|
||||
// RzLeave rzLeave = rzLeaveMapper.selectRzLeaveById(rzLeaveDetail.getLeaveId());
|
||||
// r = rzLeaveMapper.updateRzLeave(rzLeave);
|
||||
// if(r < 1){
|
||||
// return AjaxResult.error();
|
||||
// }
|
||||
// //反写考勤汇总
|
||||
// RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(rzLeave.getUserId(),rzLeave.getLeaveDate());
|
||||
// rzAttendanceStatistical.setAbsenteeism(new BigDecimal(rzLeave.getWorkHours() + rzLeave.getFuneralHours() + rzLeave.getPaternityHours() + rzLeave.getMaternityHours()
|
||||
// + rzLeave.getMarriageHours() + rzLeave.getCompensatoryHours() + rzLeave.getAnnualHours() + rzLeave.getAbsenceHours() + rzLeave.getSickHours()));
|
||||
// r = rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
// if(r < 1){
|
||||
// return AjaxResult.error();
|
||||
// }
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RzLeaveDetail calculationLeaveHour(RzLeaveDetail rzLeaveDetail) {
|
||||
if(rzLeaveDetail.getType() == null || rzLeaveDetail.getLeaveStartTime() == null){
|
||||
return rzLeaveDetail;
|
||||
}
|
||||
String flag = String.valueOf(rzLeaveDetail.getType());
|
||||
SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date beginDate = rzLeaveDetail.getLeaveStartTime();
|
||||
//当前请假类型, 不需要自动计算结束时间和请假小时
|
||||
//需要自动计算
|
||||
if(ParamUtils.autoCalculationHolidayType().contains(flag)){
|
||||
//获取字典类型
|
||||
SysDictData sysDictData = sysDictDataService.selectDictDataById(rzLeaveDetail.getType());
|
||||
List<String> holidayDates = Collections.emptyList();
|
||||
int addDays = Integer.valueOf(sysDictData.getDictValue());
|
||||
//记录所有时间的年, 防止有跨年的情况
|
||||
List<String> yearList = Collections.emptyList();
|
||||
while (addDays > 0){
|
||||
String date = sdfd.format(beginDate);
|
||||
String dateYear = date.substring(0,4);
|
||||
if(!yearList.contains(dateYear)){
|
||||
yearList.add(dateYear);
|
||||
}
|
||||
holidayDates.add(date);
|
||||
beginDate = DateUtils.addDays(beginDate,1);
|
||||
addDays --;
|
||||
}
|
||||
//去除最后增加的天数, 防止出现结束时间过长问题
|
||||
beginDate = DateUtils.addDays(beginDate,-1);
|
||||
//记录最终需要增加多少天
|
||||
Integer endDays = 0;
|
||||
//请假类型及不包含法休, 也不包含公休
|
||||
if(ParamUtils.getLeaveTypeNotIncludedFaXiuAndPublicHoliday().contains(flag)){
|
||||
//获取结果当中的假期时间
|
||||
for (String year : yearList){
|
||||
List<String> holidays = Collections.findDuplicatesList(ParamUtils.getHoliddayList(Integer.valueOf(year), 0), holidayDates);
|
||||
if(Collections.isNotEmpty(holidays)){
|
||||
rzLeaveDetail.setRemarks("不包含法定假日和周末");
|
||||
}
|
||||
endDays = new BigDecimal(endDays).add(new BigDecimal(holidays.size())).intValue();
|
||||
}
|
||||
}else
|
||||
//请假类型不包含法休
|
||||
if(ParamUtils.getLeaveTypeNotIncludedFaXiu().contains(flag)){
|
||||
for (String year : yearList){
|
||||
List<String> holidays = Collections.findDuplicatesList(ParamUtils.getHoliddayList(Integer.valueOf(year), 1), holidayDates);
|
||||
endDays = new BigDecimal(endDays).add(new BigDecimal(holidays.size())).intValue();
|
||||
if(Collections.isNotEmpty(holidays)){
|
||||
rzLeaveDetail.setRemarks("不包含法定假日");
|
||||
}
|
||||
}
|
||||
}
|
||||
//计算结束时间和请假时长 此处使用beginDate 而不使用rzLeaveDetail.getLeaveStartTime() 的原因是, 上面获取全部请假日期的时候, 已经处理过时间, 只需要增加公休,法休时间就可以了
|
||||
rzLeaveDetail.setLeaveEndTime(DateUtils.addDays(beginDate, endDays));
|
||||
rzLeaveDetail.setLeaveHour(new BigDecimal(sysDictData.getDictValue()).multiply(new BigDecimal(8)).intValue());
|
||||
}else{
|
||||
//不需要计算, 过滤节假日啥的, 只过滤周末就好了
|
||||
if(rzLeaveDetail.getLeaveStartTime() == null || rzLeaveDetail.getLeaveEndTime() == null){
|
||||
return rzLeaveDetail;
|
||||
}
|
||||
|
||||
List<String> holidayDates = Collections.emptyList();
|
||||
//记录所有时间的年, 防止有跨年的情况
|
||||
List<String> yearList = Collections.emptyList();
|
||||
while (beginDate.compareTo(rzLeaveDetail.getLeaveEndTime()) <= 0){
|
||||
String date = sdfd.format(beginDate);
|
||||
String dateYear = date.substring(0,4);
|
||||
if(!yearList.contains(dateYear)){
|
||||
yearList.add(dateYear);
|
||||
}
|
||||
holidayDates.add(date);
|
||||
beginDate = DateUtils.addDays(beginDate,1);
|
||||
}
|
||||
//记录最终需要增加多少天
|
||||
Integer endDays = 0;
|
||||
for (String year : yearList){
|
||||
List<String> holidays = Collections.findDuplicatesList(ParamUtils.getHoliddayList(Integer.valueOf(year), 2), holidayDates);
|
||||
if(Collections.isNotEmpty(holidays)){
|
||||
rzLeaveDetail.setRemarks("不包含周末");
|
||||
}
|
||||
endDays = new BigDecimal(endDays).add(new BigDecimal(holidays.size())).intValue();
|
||||
}
|
||||
//计算结束时间和请假时长 此处使用beginDate 而不使用rzLeaveDetail.getLeaveStartTime() 的原因是, 上面获取全部请假日期的时候, 已经处理过时间, 只需要增加公休,法休时间就可以了
|
||||
rzLeaveDetail.setLeaveHour(new BigDecimal(holidayDates.size()).subtract(new BigDecimal(endDays)).multiply(new BigDecimal(8)).intValue());
|
||||
}
|
||||
|
||||
return rzLeaveDetail;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -142,12 +142,12 @@ public class RzLeaveServiceImpl implements IRzLeaveService
|
||||
public List<RzLeaveDetail> listLeaveDetails(RzLeave rzLeave){
|
||||
List<RzLeaveDetail> res_list = null;
|
||||
//查询指定月份的请假统计
|
||||
RzLeave leave = rzLeaveMapper.queryRzLeaveByDateAndUserId(rzLeave.getUserId(),rzLeave.getLeaveDate());
|
||||
if(leave == null){
|
||||
return new ArrayList<RzLeaveDetail>();
|
||||
}
|
||||
// RzLeave leave = rzLeaveMapper.queryRzLeaveByDateAndUserId(rzLeave.getUserId());
|
||||
// if(leave == null){
|
||||
// return new ArrayList<RzLeaveDetail>();
|
||||
// }
|
||||
//查询请假详情
|
||||
res_list = rzLeaveDetailMapper.selectRzLeaveDetailByLeaveId(leave.getId());
|
||||
// res_list = rzLeaveDetailMapper.selectRzLeaveDetailByLeaveId(leave.getId());
|
||||
return res_list;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.evo.personnelMatters.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.evo.common.annotation.DataScope;
|
||||
import com.evo.common.constant.Constants;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
@ -27,10 +28,9 @@ import java.util.List;
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
@Service
|
||||
public class RzOverTimeServiceImpl implements IRzOverTimeService
|
||||
public class RzOverTimeServiceImpl extends ServiceImpl<RzOverTimeMapper, RzOverTime> implements IRzOverTimeService
|
||||
{
|
||||
@Resource
|
||||
private RzOverTimeMapper rzOverTimeMapper;
|
||||
|
||||
@Resource
|
||||
private SysStaffMapper sysStaffMapper; //员工信息
|
||||
@Resource
|
||||
@ -48,7 +48,7 @@ public class RzOverTimeServiceImpl implements IRzOverTimeService
|
||||
@Override
|
||||
public RzOverTime selectRzOverTimeById(Long id)
|
||||
{
|
||||
return rzOverTimeMapper.selectRzOverTimeById(id);
|
||||
return getBaseMapper().selectRzOverTimeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,7 +61,7 @@ public class RzOverTimeServiceImpl implements IRzOverTimeService
|
||||
@DataScope(deptAlias = "d")
|
||||
public List<RzOverTime> selectRzOverTimeList(RzOverTime rzOverTime)
|
||||
{
|
||||
List<RzOverTime> res_list = rzOverTimeMapper.selectRzOverTimeList(rzOverTime);
|
||||
List<RzOverTime> res_list = getBaseMapper().selectRzOverTimeList(rzOverTime);
|
||||
for (RzOverTime overTime : res_list) {
|
||||
overTime.setDeptName(deptMapper.selectDeptById(overTime.getDeptId()).getDeptName());
|
||||
}
|
||||
@ -77,7 +77,7 @@ public class RzOverTimeServiceImpl implements IRzOverTimeService
|
||||
@Override
|
||||
public AjaxResult insertRzOverTime(RzOverTime rzOverTime)
|
||||
{
|
||||
RzOverTime overTime = rzOverTimeMapper.selectRzOverTimeByNameAndMonth(Long.parseLong(rzOverTime.getName()),rzOverTime.getOverTimeMonth());
|
||||
RzOverTime overTime = getBaseMapper().selectRzOverTimeByNameAndMonth(Long.parseLong(rzOverTime.getName()),rzOverTime.getOverTimeMonth());
|
||||
if(StringUtils.isNotNull(overTime)){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
@ -88,7 +88,7 @@ public class RzOverTimeServiceImpl implements IRzOverTimeService
|
||||
rzOverTime.setCreateBy(SecurityUtils.getUsername());
|
||||
rzOverTime.setCreateTime(DateUtils.getNowDate());
|
||||
rzOverTime.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
int i = rzOverTimeMapper.insertRzOverTime(rzOverTime);
|
||||
int i = getBaseMapper().insertRzOverTime(rzOverTime);
|
||||
if(i < 1){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
@ -106,7 +106,7 @@ public class RzOverTimeServiceImpl implements IRzOverTimeService
|
||||
{
|
||||
rzOverTime.setUpdateBy(SecurityUtils.getUsername());
|
||||
rzOverTime.setUpdateTime(DateUtils.getNowDate());
|
||||
return rzOverTimeMapper.updateRzOverTime(rzOverTime);
|
||||
return getBaseMapper().updateRzOverTime(rzOverTime);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,14 +118,14 @@ public class RzOverTimeServiceImpl implements IRzOverTimeService
|
||||
@Override
|
||||
public AjaxResult deleteRzOverTimeById(Long id)
|
||||
{
|
||||
RzOverTime rzOverTime = rzOverTimeMapper.selectRzOverTimeById(id);
|
||||
RzOverTime rzOverTime = getBaseMapper().selectRzOverTimeById(id);
|
||||
if(rzOverTime.getOverHours().compareTo(new BigDecimal("0.0")) > 0){
|
||||
return AjaxResult.error("有加班工时,不能删除!");
|
||||
}
|
||||
rzOverTime.setDelFlag(Constants.DELETE_FLAG_1);
|
||||
rzOverTime.setUpdateBy(SecurityUtils.getUsername());
|
||||
rzOverTime.setUpdateTime(DateUtils.getNowDate());
|
||||
int i = rzOverTimeMapper.updateRzOverTime(rzOverTime);
|
||||
int i = getBaseMapper().updateRzOverTime(rzOverTime);
|
||||
if(i < 1){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
@ -141,7 +141,7 @@ public class RzOverTimeServiceImpl implements IRzOverTimeService
|
||||
public List<RzOverTimeDetail> selectRzOverTimeDetailListByUserIdAndMonth(RzOverTime rzOverTime){
|
||||
List<RzOverTimeDetail> res_list = null;
|
||||
//根据月份和员工ID获取加班ID
|
||||
RzOverTime overTime = rzOverTimeMapper.selectRzOverTimeByNameAndMonth(rzOverTime.getUserId(),rzOverTime.getOverTimeMonth());
|
||||
RzOverTime overTime = getBaseMapper().selectRzOverTimeByNameAndMonth(rzOverTime.getUserId(),rzOverTime.getOverTimeMonth());
|
||||
if(overTime == null){
|
||||
return new ArrayList<RzOverTimeDetail>();
|
||||
}
|
||||
|
||||
@ -2,7 +2,12 @@ package com.evo.system.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.evo.common.vo.OptionVo;
|
||||
import com.evo.personnelMatters.domain.RzSubsidyInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -83,6 +88,17 @@ public class SysDictDataController extends BaseController
|
||||
return success(data);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/type/new/{dictType}")
|
||||
public AjaxResult dictNewType(@PathVariable String dictType)
|
||||
{
|
||||
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
||||
if (StringUtils.isNull(data))
|
||||
{
|
||||
data = new ArrayList<SysDictData>();
|
||||
}
|
||||
return success(data.stream().map(d ->new OptionVo(d.getDictCode(), d.getDictLabel(), d.getListClass())).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.evo.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.evo.common.core.domain.entity.SysDictData;
|
||||
|
||||
@ -9,7 +11,7 @@ import com.evo.common.core.domain.entity.SysDictData;
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public interface SysDictDataMapper
|
||||
public interface SysDictDataMapper extends BaseMapper<SysDictData>
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询字典数据
|
||||
|
||||
@ -27,6 +27,15 @@ public interface ISysDictDataService
|
||||
*/
|
||||
public String selectDictLabel(String dictType, String dictValue);
|
||||
|
||||
/**
|
||||
* 根据字典类型和字典键值查询字典数据信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictLabel 字典键值
|
||||
* @return 字典标签
|
||||
*/
|
||||
public String selectDictValue(String dictType, String dictLabel);
|
||||
|
||||
/**
|
||||
* 根据字典数据ID查询信息
|
||||
*
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
package com.evo.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.evo.attendance.domain.RzAttendanceStatistical;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.domain.entity.SysUser;
|
||||
import com.evo.system.domain.SysStaff;
|
||||
import com.evo.system.domain.vo.SysStaffVo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
package com.evo.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.evo.common.core.domain.entity.SysDictData;
|
||||
@ -14,10 +18,9 @@ import com.evo.system.service.ISysDictDataService;
|
||||
* @author evo
|
||||
*/
|
||||
@Service
|
||||
public class SysDictDataServiceImpl implements ISysDictDataService
|
||||
public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDictData> implements ISysDictDataService
|
||||
{
|
||||
@Autowired
|
||||
private SysDictDataMapper dictDataMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 根据条件分页查询字典数据
|
||||
@ -28,7 +31,7 @@ public class SysDictDataServiceImpl implements ISysDictDataService
|
||||
@Override
|
||||
public List<SysDictData> selectDictDataList(SysDictData dictData)
|
||||
{
|
||||
return dictDataMapper.selectDictDataList(dictData);
|
||||
return getBaseMapper().selectDictDataList(dictData);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -41,7 +44,13 @@ public class SysDictDataServiceImpl implements ISysDictDataService
|
||||
@Override
|
||||
public String selectDictLabel(String dictType, String dictValue)
|
||||
{
|
||||
return dictDataMapper.selectDictLabel(dictType, dictValue);
|
||||
return getBaseMapper().selectDictLabel(dictType, dictValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectDictValue(String dictType, String dictLabel) {
|
||||
SysDictData sysDictData = getOne(new LambdaQueryWrapper<SysDictData>().eq(SysDictData::getDictType, dictType).eq(SysDictData::getDictLabel, dictLabel), false);
|
||||
return ObjectUtils.isNotEmpty(sysDictData) ? sysDictData.getDictValue() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,7 +62,7 @@ public class SysDictDataServiceImpl implements ISysDictDataService
|
||||
@Override
|
||||
public SysDictData selectDictDataById(Long dictCode)
|
||||
{
|
||||
return dictDataMapper.selectDictDataById(dictCode);
|
||||
return getBaseMapper().selectDictDataById(dictCode);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,8 +76,8 @@ public class SysDictDataServiceImpl implements ISysDictDataService
|
||||
for (Long dictCode : dictCodes)
|
||||
{
|
||||
SysDictData data = selectDictDataById(dictCode);
|
||||
dictDataMapper.deleteDictDataById(dictCode);
|
||||
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
||||
getBaseMapper().deleteDictDataById(dictCode);
|
||||
List<SysDictData> dictDatas = getBaseMapper().selectDictDataByType(data.getDictType());
|
||||
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
||||
}
|
||||
}
|
||||
@ -82,10 +91,10 @@ public class SysDictDataServiceImpl implements ISysDictDataService
|
||||
@Override
|
||||
public int insertDictData(SysDictData data)
|
||||
{
|
||||
int row = dictDataMapper.insertDictData(data);
|
||||
int row = getBaseMapper().insertDictData(data);
|
||||
if (row > 0)
|
||||
{
|
||||
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
||||
List<SysDictData> dictDatas = getBaseMapper().selectDictDataByType(data.getDictType());
|
||||
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
||||
}
|
||||
return row;
|
||||
@ -100,10 +109,10 @@ public class SysDictDataServiceImpl implements ISysDictDataService
|
||||
@Override
|
||||
public int updateDictData(SysDictData data)
|
||||
{
|
||||
int row = dictDataMapper.updateDictData(data);
|
||||
int row = getBaseMapper().updateDictData(data);
|
||||
if (row > 0)
|
||||
{
|
||||
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
||||
List<SysDictData> dictDatas = getBaseMapper().selectDictDataByType(data.getDictType());
|
||||
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
||||
}
|
||||
return row;
|
||||
|
||||
@ -2,10 +2,7 @@ package com.evo.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.evo.attendance.domain.RzAttendance;
|
||||
import com.evo.attendance.domain.RzAttendanceStatistical;
|
||||
import com.evo.attendance.mapper.RzAttendanceMapper;
|
||||
import com.evo.attendance.mapper.RzAttendanceStatisticalMapper;
|
||||
import com.evo.attendance.service.IRzAttendanceStatisticalService;
|
||||
import com.evo.common.annotation.DataScope;
|
||||
import com.evo.common.constant.Constants;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
@ -18,8 +15,6 @@ import com.evo.common.utils.SecurityUtils;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
import com.evo.common.utils.bean.BeanUtils;
|
||||
import com.evo.equipment.service.IEqSnDetailService;
|
||||
import com.evo.personnelMatters.domain.RzHoliday;
|
||||
import com.evo.personnelMatters.mapper.RzHolidayMapper;
|
||||
import com.evo.restaurant.domain.RzRestaurantStatistics;
|
||||
import com.evo.restaurant.mapper.RzRestaurantStatisticsMapper;
|
||||
import com.evo.system.domain.SysStaff;
|
||||
@ -31,7 +26,6 @@ import com.evo.system.mapper.SysStaffDetailMapper;
|
||||
import com.evo.system.mapper.SysStaffMapper;
|
||||
import com.evo.system.service.ISysStaffService;
|
||||
import com.evo.system.service.RzUploadService;
|
||||
import com.evo.utils.DateUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@ -73,17 +67,13 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
@Resource
|
||||
private SysDeptMapper deptMapper; //部门信息
|
||||
@Resource
|
||||
private RzAttendanceStatisticalMapper rzAttendanceStatisticalMapper; //考勤统计
|
||||
@Resource
|
||||
private RzAttendanceMapper rzAttendanceMapper; //打卡记录
|
||||
@Resource
|
||||
private RzHolidayMapper rzHolidayMapper; //假期
|
||||
private IRzAttendanceStatisticalService rzAttendanceStatisticalService; //考勤统计
|
||||
@Resource
|
||||
private RzRestaurantStatisticsMapper rzRestaurantStatisticsMapper; //餐饮统计
|
||||
@Resource
|
||||
private RzUploadService rzUploadService;//餐饮统计
|
||||
private RzUploadService rzUploadService;//文件上传
|
||||
@Resource
|
||||
private IEqSnDetailService eqSnDetailService;//餐饮统计
|
||||
private IEqSnDetailService eqSnDetailService;//设备信息
|
||||
/**
|
||||
* 查询员工管理
|
||||
*
|
||||
@ -165,7 +155,7 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
//员工详情
|
||||
createStaffDetail(sysStaff);
|
||||
//打卡统计,打卡详情
|
||||
createRzAttendance(sysStaff, getMonthAndDays());
|
||||
rzAttendanceStatisticalService.createRzAttendance(sysStaff, Collections.emptyList(), null);
|
||||
//处理餐饮信息
|
||||
createRestaurantStatistics(sysStaff);
|
||||
//处理考勤机相关信息
|
||||
@ -216,84 +206,7 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
sysStaffDetailMapper.updateSysStaffDetail(sysStaffDetail);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 创建打卡考勤信息
|
||||
* @param sysStaff
|
||||
*/
|
||||
private void createRzAttendance(SysStaff sysStaff, List<String> dayList){
|
||||
//根据员工ID查询当月的统计信息统计信息
|
||||
RzAttendanceStatistical rzAttendanceStatistical = rzAttendanceStatisticalMapper.getRzAttendanceStatisticalByDateAndName(sysStaff.getUserId(),DateUtils.getNowDate());
|
||||
if(StringUtils.isNotNull(rzAttendanceStatistical)){
|
||||
//判断名称和部门是否一样。不一样操作修改
|
||||
if(!rzAttendanceStatistical.getName().equals(sysStaff.getName()) || rzAttendanceStatistical.getDeptId() != sysStaff.getDeptId()){
|
||||
//修改部门和姓名
|
||||
rzAttendanceStatistical.setName(sysStaff.getName());
|
||||
rzAttendanceStatistical.setDeptId(sysStaff.getDeptId());
|
||||
rzAttendanceStatisticalMapper.updateRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
//查询考勤详情修改
|
||||
List<RzAttendance> kq_list = rzAttendanceMapper.queryMonthAttendanceByStaffId(sysStaff.getUserId(),new Date());
|
||||
//循环修改信息
|
||||
for (RzAttendance rzAttendance : kq_list) {
|
||||
rzAttendance.setDeptId(sysStaff.getDeptId());
|
||||
rzAttendance.setName(sysStaff.getName());
|
||||
rzAttendanceMapper.updateRzAttendance(rzAttendance);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
//新增考勤统计
|
||||
rzAttendanceStatistical = new RzAttendanceStatistical();
|
||||
rzAttendanceStatistical.setStaffId(sysStaff.getUserId());
|
||||
rzAttendanceStatistical.setName(sysStaff.getName());
|
||||
rzAttendanceStatistical.setMonth(DateUtils.getNowDate());
|
||||
rzAttendanceStatistical.setShouldAttendance(new BigDecimal(currentMonthAttendance()).multiply(new BigDecimal("8.00")));
|
||||
rzAttendanceStatistical.setDeptId(sysStaff.getDeptId());
|
||||
rzAttendanceStatistical.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
rzAttendanceStatistical.setCreateBy(SecurityUtils.getUsername());
|
||||
rzAttendanceStatistical.setCreateTime(DateUtils.getNowDate());
|
||||
rzAttendanceStatisticalMapper.insertRzAttendanceStatistical(rzAttendanceStatistical);
|
||||
//新增考勤详情
|
||||
SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd");
|
||||
RzAttendance rzAttendance = null;
|
||||
List<RzAttendance> pa_list = new ArrayList<RzAttendance>();
|
||||
for(String day: dayList){
|
||||
rzAttendance = new RzAttendance();
|
||||
rzAttendance.setDeptId(sysStaff.getDeptId());
|
||||
rzAttendance.setName(sysStaff.getName());
|
||||
rzAttendance.setStaffId(sysStaff.getUserId());
|
||||
try{
|
||||
rzAttendance.setAttendanceDate(sdfd.parse(day));
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
rzAttendance.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
rzAttendance.setCreateTime(DateUtils.getNowDate());
|
||||
rzAttendance.setCreateBy(SecurityUtils.getUsername());
|
||||
pa_list.add(rzAttendance);
|
||||
}
|
||||
rzAttendanceMapper.insertBatchRzAttendance(pa_list);
|
||||
}
|
||||
|
||||
public List<String> getMonthAndDays(){
|
||||
List<String> dayList = new ArrayList<String>();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int days = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
SimpleDateFormat sdfm = new SimpleDateFormat("yyyy-MM");
|
||||
for(int p=1;p<=days;p++){
|
||||
try{
|
||||
String rq = sdfm.format(DateUtils.getNowDate())+"-";
|
||||
if(p < 10){
|
||||
rq += Constants.SEIZE_A_SEAT_0 + p;
|
||||
}else {
|
||||
rq += p;
|
||||
}
|
||||
dayList.add(rq);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return dayList;
|
||||
}
|
||||
/**
|
||||
* 创建餐饮统计
|
||||
* @param sysStaff
|
||||
@ -324,42 +237,6 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
rzRestaurantStatistics.setCreateTime(DateUtils.getNowDate());
|
||||
rzRestaurantStatisticsMapper.insertRzRestaurantStatistics(rzRestaurantStatistics);
|
||||
}
|
||||
/**
|
||||
* 计算当月应出勤天数
|
||||
* @return
|
||||
*/
|
||||
private Long currentMonthAttendance(){
|
||||
//获取当月的天数
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int days = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
SimpleDateFormat sdfm = new SimpleDateFormat("yyyy-MM");
|
||||
SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd");
|
||||
//获取当月第一天和最后一天
|
||||
Date startDate = null;
|
||||
Date endDate = null;
|
||||
try{
|
||||
startDate = sdfd.parse(sdfm.format(DateUtils.getNowDate()) + "-01");
|
||||
endDate = sdfd.parse(sdfm.format(DateUtils.getNowDate()) + "-" + days);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
//除去周日
|
||||
days = days - DateUtil.isWeeked(startDate,endDate,1);
|
||||
//查询假期,计算节假日
|
||||
List<RzHoliday> jq_list = rzHolidayMapper.selectRzHolidayList(null);
|
||||
for (RzHoliday rzHoliday : jq_list) {
|
||||
//判断假期在本月
|
||||
if(rzHoliday.getHoliday().getTime() > startDate.getTime() && rzHoliday.getHoliday().getTime() < endDate.getTime()){
|
||||
//判断是上班或休息
|
||||
if("0".equals(rzHoliday.getSpecialFlag())){
|
||||
days -= 1;
|
||||
}else{
|
||||
days += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Long.valueOf(days);
|
||||
}
|
||||
/**
|
||||
* 修改员工管理
|
||||
*
|
||||
@ -444,7 +321,7 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
//修改员工详情
|
||||
createStaffDetail(sysStaff);
|
||||
//修改考勤统计
|
||||
createRzAttendance(sysStaff, getMonthAndDays());
|
||||
rzAttendanceStatisticalService.createRzAttendance(sysStaff, Collections.emptyList(), null);
|
||||
//餐饮统计
|
||||
createRestaurantStatistics(sysStaff);
|
||||
//处理考勤机相关信息
|
||||
@ -475,7 +352,7 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
//添加员工详情
|
||||
createStaffDetail(sysStaff);
|
||||
//修改考勤统计
|
||||
createRzAttendance(sysStaff, getMonthAndDays());
|
||||
rzAttendanceStatisticalService.createRzAttendance(sysStaff, Collections.emptyList(), null);
|
||||
//餐饮统计
|
||||
createRestaurantStatistics(sysStaff);
|
||||
}
|
||||
@ -851,7 +728,7 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
if(i < 1){
|
||||
return AjaxResult.error();
|
||||
}
|
||||
createRzAttendance(sysStaff, getMonthAndDays());
|
||||
rzAttendanceStatisticalService.createRzAttendance(sysStaff, Collections.emptyList(), null);
|
||||
//餐饮统计
|
||||
createRestaurantStatistics(sysStaff);
|
||||
}
|
||||
@ -890,13 +767,14 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
|
||||
public void autoCreateAttendanceData(){
|
||||
//获取在职员工数据
|
||||
List<SysStaff> params_list = getBaseMapper().selectSysStaffListAll();
|
||||
List<String> dayList = getMonthAndDays();
|
||||
List<String> dayList = DateUtils.getCurrentMonthAndDays();
|
||||
//循环在职员工生成考勤统计
|
||||
for (SysStaff sysStaff : params_list) {
|
||||
createRzAttendance(sysStaff, dayList);
|
||||
rzAttendanceStatisticalService.createRzAttendance(sysStaff, dayList, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 每天计算转正,离职日期
|
||||
*/
|
||||
|
||||
@ -1,10 +1,14 @@
|
||||
package com.evo.utils;
|
||||
|
||||
import com.evo.personnelMatters.domain.RzHoliday;
|
||||
import com.evo.common.utils.Collections;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.ParamUtils;
|
||||
import com.evo.personnelMatters.mapper.RzHolidayMapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -28,61 +32,36 @@ public class DateUtil {
|
||||
* 计算俩个时间之间的小时数
|
||||
* @param beginTime 请假开始时间
|
||||
* @param endTime 请假结束时间
|
||||
* @param flag 假期类型
|
||||
* @return
|
||||
*/
|
||||
public Long autoLeavehoursForCount(Date beginTime, Date endTime,String flag){
|
||||
public Long autoLeaveHoursForCount(Date beginTime, Date endTime,Long fl){
|
||||
SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat sdfh = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
//根据时间计算时间差 ,小时
|
||||
Long xsc = 0l;
|
||||
Long ts = DateUtils.getBetweenDays(beginTime, endTime);
|
||||
try{
|
||||
Date b_time = sdfh.parse(sdfd.format(beginTime) +" 08:30:00");
|
||||
Date e_time = sdfh.parse(sdfd.format(endTime) +" 17:30:00");
|
||||
if(beginTime.before(b_time) && endTime.after(e_time)){
|
||||
xsc = (e_time.getTime() - b_time.getTime())/1000/60/60;
|
||||
}else{
|
||||
if(endTime.after(e_time)){
|
||||
xsc = (e_time.getTime() - beginTime.getTime())/1000/60/60;
|
||||
}
|
||||
if(beginTime.before(b_time)){
|
||||
xsc = (endTime.getTime() - b_time.getTime())/1000/60/60;
|
||||
//记录假期日期
|
||||
List<String> holidayDates = Collections.emptyList();
|
||||
while (beginTime.compareTo(endTime) <= 0){
|
||||
holidayDates.add(sdfd.format(beginTime));
|
||||
beginTime = DateUtils.addDays(beginTime,1);
|
||||
}
|
||||
String flag = String.valueOf(fl);
|
||||
//请假类型及不包含法休, 也不包含公休
|
||||
if(ParamUtils.getLeaveTypeNotIncludedFaXiuAndPublicHoliday().contains(flag)){
|
||||
//获取结果当中的假期时间
|
||||
List<String> holidays = Collections.findDuplicatesList(ParamUtils.getHoliddayList(Integer.valueOf(holidayDates.get(0).substring(0,4)), 0), holidayDates);
|
||||
ts = new BigDecimal(ts).subtract(new BigDecimal(holidays.size())).longValue();
|
||||
}else
|
||||
//请假类型不包含法休
|
||||
if(ParamUtils.getLeaveTypeNotIncludedFaXiu().contains(flag)){
|
||||
List<String> holidays = Collections.findDuplicatesList(ParamUtils.getHoliddayList(Integer.valueOf(holidayDates.get(0).substring(0,4)), 1), holidayDates);
|
||||
ts = new BigDecimal(ts).subtract(new BigDecimal(holidays.size())).longValue();
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
//计算天数
|
||||
Long ts = xsc/24;
|
||||
//假期类型为婚嫁,产假,陪产假计算周日和节假日,其他的假期都不算周日和节假日
|
||||
if(!"6".equals(flag) && !"7".equals(flag) && !"8".equals(flag)){
|
||||
//判断是否有周日 ,有周日减去
|
||||
int zr = isWeeked(beginTime,endTime,1);
|
||||
ts = ts - zr;
|
||||
//查询节假日, 判断是否节假日
|
||||
List<RzHoliday> h_list = rzHolidayMapper.selectRzHolidayList(null);
|
||||
for (RzHoliday rzHoliday : h_list) {
|
||||
if(rzHoliday.getHoliday().before(endTime) && rzHoliday.getHoliday().after(beginTime)){
|
||||
//判断周日上班时间
|
||||
if("1".equals(rzHoliday.getSpecialFlag())){
|
||||
ts = ts + 1;
|
||||
}else{
|
||||
ts = ts - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//请假结果小时数
|
||||
Long res = ts * 8;
|
||||
//小时余数
|
||||
Long xsys = xsc%24;
|
||||
//判断剩余小时数大于4小时,则请假为一天
|
||||
if(xsys > 4){
|
||||
res = res + 8;
|
||||
}else if(xsys > 0){
|
||||
res = res + 4;
|
||||
}
|
||||
return res;
|
||||
return (ts * 8);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -6,7 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<resultMap type="RzHoliday" id="RzHolidayResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="holiday" column="holiday" />
|
||||
<!-- <result property="holiday" column="holiday" />-->
|
||||
<result property="remarks" column="remarks" />
|
||||
<result property="specialFlag" column="special_flag" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectRzHolidayVo"/>
|
||||
<where>
|
||||
del_flag = '0'
|
||||
<if test="holiday != null "> and holiday = #{holiday}</if>
|
||||
<!-- <if test="holiday != null "> and holiday = #{holiday}</if> -->
|
||||
<if test="remarks != null "> and remarks = #{remarks}</if>
|
||||
<if test="specialFlag != null "> and special_flag = #{specialFlag}</if>
|
||||
</where>
|
||||
@ -75,4 +75,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@ -31,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="leaveId != null "> and leave_id = #{leaveId}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectRzLeaveDetailById" parameterType="Long" resultMap="RzLeaveDetailResult">
|
||||
|
||||
@ -9,7 +9,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="leaveDate" column="leave_date" />
|
||||
<result property="sickHours" column="sick_hours" />
|
||||
<result property="absenceHours" column="absence_hours" />
|
||||
<result property="compensatoryHours" column="compensatory_hours" />
|
||||
@ -27,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRzLeaveVo">
|
||||
select id, user_id, dept_id, name, leave_date, sick_hours, absence_hours, compensatory_hours, marriage_hours, annual_hours, maternity_hours, paternity_hours, funeral_hours, work_hours, del_flag, create_by, create_time, update_by, update_time from rz_leave d
|
||||
select id, user_id, dept_id, name, sick_hours, absence_hours, compensatory_hours, marriage_hours, annual_hours, maternity_hours, paternity_hours, funeral_hours, work_hours, del_flag, create_by, create_time, update_by, update_time from rz_leave d
|
||||
</sql>
|
||||
|
||||
<select id="selectRzLeaveList" parameterType="RzLeave" resultMap="RzLeaveResult">
|
||||
@ -37,12 +36,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="name != null and name != ''"> and name like concat('%',#{name},'%')</if>
|
||||
<if test="userId != null"> and user_id = #{userId}</if>
|
||||
<if test="deptId != null "> and d.dept_id = #{deptId}</if>
|
||||
<choose>
|
||||
<when test="leaveDate != null">and DATE_FORMAT( d.leave_date, '%Y%m' ) = DATE_FORMAT( #{leaveDate} , '%Y%m' )</when>
|
||||
<otherwise>
|
||||
and DATE_FORMAT( d.leave_date, '%Y%m' ) = DATE_FORMAT(NOW() , '%Y%m' )
|
||||
</otherwise>
|
||||
</choose>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
</select>
|
||||
@ -58,7 +51,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="leaveDate != null">leave_date,</if>
|
||||
<if test="sickHours != null">sick_hours,</if>
|
||||
<if test="absenceHours != null">absence_hours,</if>
|
||||
<if test="compensatoryHours != null">compensatory_hours,</if>
|
||||
@ -78,7 +70,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="leaveDate != null">#{leaveDate},</if>
|
||||
<if test="sickHours != null">#{sickHours},</if>
|
||||
<if test="absenceHours != null">#{absenceHours},</if>
|
||||
<if test="compensatoryHours != null">#{compensatoryHours},</if>
|
||||
@ -102,7 +93,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="leaveDate != null">leave_date = #{leaveDate},</if>
|
||||
<if test="sickHours != null">sick_hours = #{sickHours},</if>
|
||||
<if test="absenceHours != null">absence_hours = #{absenceHours},</if>
|
||||
<if test="compensatoryHours != null">compensatory_hours = #{compensatoryHours},</if>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user