备份
This commit is contained in:
@@ -6,7 +6,9 @@ import com.ruoyi.oa.domain.bo.OaSalaryBo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -20,7 +22,7 @@ public interface IOaSalaryService {
|
||||
/**
|
||||
* 查询薪资管理
|
||||
*/
|
||||
OaSalaryVo queryById(Long salaryId);
|
||||
OaSalaryVo queryById(Long salaryId, @NotBlank Date payTime);
|
||||
|
||||
/**
|
||||
* 查询薪资管理列表
|
||||
@@ -61,4 +63,6 @@ public interface IOaSalaryService {
|
||||
* @return
|
||||
*/
|
||||
R<Void> importSalaryUser();
|
||||
|
||||
TableDataInfo<OaSalaryVo> listWorker(OaSalaryBo bo, PageQuery pageQuery);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
@@ -14,6 +15,7 @@ import com.ruoyi.oa.domain.vo.SysOaHolidayVo;
|
||||
import com.ruoyi.oa.mapper.OaSalaryItemMapper;
|
||||
import com.ruoyi.oa.service.ISysOaHolidayService;
|
||||
import com.ruoyi.oa.utils.OwnHttpUtils;
|
||||
import com.ruoyi.system.mapper.SysUserRoleMapper;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.workflow.mapper.WfDeployFormMapper;
|
||||
import com.ruoyi.workflow.service.IWfTaskService;
|
||||
@@ -34,6 +36,7 @@ import com.ruoyi.oa.mapper.OaSalaryMapper;
|
||||
import com.ruoyi.oa.service.IOaSalaryService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.*;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@@ -75,12 +78,15 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
||||
@Autowired
|
||||
private OaSalaryItemMapper salaryItemMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserRoleMapper sysUserRoleMapper;
|
||||
|
||||
/**
|
||||
* 查询薪资管理
|
||||
*/
|
||||
@Override
|
||||
public OaSalaryVo queryById(Long salaryId){
|
||||
return baseMapper.selectVoById(salaryId);
|
||||
public OaSalaryVo queryById(Long salaryId,Date payTime){
|
||||
return baseMapper.selectVoAndItemVoById(salaryId,payTime);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,14 +94,28 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<OaSalaryVo> queryPageList(OaSalaryBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<OaSalary> lqw = buildQueryWrapper(bo);
|
||||
Page<OaSalaryVo> result = baseMapper.selectStaffVoPage(pageQuery.build(), lqw);
|
||||
|
||||
List<Long> userIds = sysUserRoleMapper.selectUserIdsByNotRoleId(1852970465740505090L);
|
||||
QueryWrapper<OaSalary> lqw = new QueryWrapper<>();
|
||||
lqw.in("os.user_id",userIds);
|
||||
Page<OaSalaryVo> result = baseMapper.selectStaffVoPage(pageQuery.build(), lqw,bo.getPayTime());
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TableDataInfo<OaSalaryVo> listWorker(OaSalaryBo bo, PageQuery pageQuery) {
|
||||
List<Long> userIds = sysUserRoleMapper.selectUserIdsByRoleId(1852970465740505090L);
|
||||
QueryWrapper<OaSalary> lqw = new QueryWrapper<>();
|
||||
lqw.in("os.user_id",userIds);
|
||||
Page<OaSalaryVo> result = baseMapper.selectStaffVoPage(pageQuery.build(), lqw,bo.getPayTime());
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Void> importSalaryUser() {
|
||||
List<SysUser> sysUsers = userService.selectUserList2();
|
||||
baseMapper.delByPayTime(new Date());
|
||||
for (SysUser user : sysUsers) {
|
||||
if(Objects.nonNull(user)){
|
||||
OaSalary oaSalary = new OaSalary();
|
||||
@@ -107,6 +127,8 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询薪资管理列表
|
||||
*/
|
||||
@@ -120,9 +142,6 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<OaSalary> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getUserId() != null, OaSalary::getUserId, bo.getUserId());
|
||||
lqw.eq(bo.getRealSalary() != null, OaSalary::getRealSalary, bo.getRealSalary());
|
||||
lqw.eq(bo.getPayTime() != null, OaSalary::getPayTime, bo.getPayTime());
|
||||
lqw.eq(bo.getBaseSalary() != null, OaSalary::getBaseSalary, bo.getBaseSalary());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@@ -214,10 +233,9 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
||||
Long endTimeItem = (Long) processVariables.get("endTimeItem");
|
||||
}
|
||||
// 计算缺席的某天是否请假或者出差
|
||||
List<String> absentDates = res.getAbsentDates();
|
||||
List<String> realDates = new ArrayList<>();
|
||||
List<String> real05Dates = new ArrayList<>();
|
||||
for (String absentDate : absentDates) {
|
||||
for (String absentDate : res.getAbsentDates()) {
|
||||
// 形如2024-11-01
|
||||
String fullDate = combineYearMonthAndDay(bo.getMonthStr(), absentDate);
|
||||
boolean contains = timeRange.contains(fullDate);
|
||||
@@ -226,16 +244,18 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
||||
realDates.add(fullDate);
|
||||
}
|
||||
}
|
||||
for (String real05Date : real05Dates) {
|
||||
for (String real05Date : res.getAbsent05Dates()) {
|
||||
String fullDate = combineYearMonthAndDay(bo.getMonthStr(), real05Date);
|
||||
boolean contains = timeRange.contains(fullDate);
|
||||
if (!contains) {
|
||||
real05Dates.add(fullDate);
|
||||
}
|
||||
}
|
||||
res.setAbsentDates(realDates);
|
||||
res.setAbsent05Dates(real05Dates);
|
||||
// 这次已经将缺勤拿出来了 现在还要判断今天是否为节假日
|
||||
List<String> realDate2 =new ArrayList<>();
|
||||
for (String realDate : realDates) {
|
||||
for (String realDate : res.getAbsentDates()) {
|
||||
SysOaHolidayVo sysOaHolidayVo = holidayService.queryHolidayByDate(StringToDate(realDate));
|
||||
if (sysOaHolidayVo != null && sysOaHolidayVo.getType()!=0 ) {
|
||||
// 如果不为节假日则加入进去
|
||||
@@ -243,7 +263,7 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
||||
}
|
||||
}
|
||||
List<String> real05Date2 =new ArrayList<>();
|
||||
for (String real05Date : real05Dates) {
|
||||
for (String real05Date : res.getAbsent05Dates()) {
|
||||
SysOaHolidayVo sysOaHolidayVo = holidayService.queryHolidayByDate(StringToDate(real05Date));
|
||||
if (sysOaHolidayVo != null && sysOaHolidayVo.getType()!=0 ) {
|
||||
// 如果不为节假日则加入进去
|
||||
@@ -251,63 +271,80 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
||||
}
|
||||
|
||||
}
|
||||
buildItemAbsent(realDate2, salary,1.0,yearMonth);
|
||||
buildItemAbsent(real05Date2, salary,0.5,yearMonth);
|
||||
res.setAbsentDates(realDate2);
|
||||
res.setAbsent05Dates(real05Date2);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
buildItemAbsent(res.getAbsentDates(), salary,1.0,yearMonth);
|
||||
buildItemAbsent(res.getAbsent05Dates(), salary,0.5,yearMonth);
|
||||
|
||||
// 3.4创建其他的item包括了好多罚金
|
||||
// 3.4.1 迟到罚金
|
||||
StringBuilder sb= new StringBuilder();
|
||||
for (String lateDate : res.getLateDates()) {
|
||||
sb.append(lateDate);
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append("迟到日期");
|
||||
OaSalaryItem oaSalaryItem = new OaSalaryItem();
|
||||
oaSalaryItem.setSalaryId(salary.getSalaryId());
|
||||
oaSalaryItem.setPrice(Double.valueOf(res.getLateFee()));
|
||||
oaSalaryItem.setType(4L);
|
||||
oaSalaryItem.setFlag(0L);
|
||||
oaSalaryItem.setReason(sb.toString());
|
||||
oaSalaryItem.setSignTime(yearMonth);
|
||||
salaryItemMapper.insert(oaSalaryItem);
|
||||
StringBuilder sb= new StringBuilder();
|
||||
if (!res.getLateDates().isEmpty()) {
|
||||
for (String lateDate : res.getLateDates()) {
|
||||
sb.append(lateDate);
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append("迟到");
|
||||
|
||||
oaSalaryItem.setSalaryId(salary.getSalaryId());
|
||||
oaSalaryItem.setPrice(Double.valueOf(res.getLateFee()));
|
||||
oaSalaryItem.setType(4L);
|
||||
oaSalaryItem.setFlag(0L);
|
||||
oaSalaryItem.setReason(sb.toString());
|
||||
oaSalaryItem.setSignTime(yearMonth);
|
||||
salaryItemMapper.insert(oaSalaryItem);
|
||||
}
|
||||
|
||||
// 3.4.2 早退罚金
|
||||
sb= new StringBuilder();
|
||||
for (String lateDate : res.getLeaveEarly10Dates()) {
|
||||
sb.append(lateDate);
|
||||
sb.append(",");
|
||||
if (!res.getLeaveEarly10Dates().isEmpty()) {
|
||||
for (String lateDate : res.getLeaveEarly10Dates()) {
|
||||
sb.append(lateDate);
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append("以上为早退十分钟日期");
|
||||
}
|
||||
sb.append("早退日期十分钟");
|
||||
for (String lateDate : res.getLeaveEarly30Dates()) {
|
||||
sb.append(lateDate);
|
||||
sb.append(",");
|
||||
|
||||
if (!res.getLeaveEarly30Dates().isEmpty()) {
|
||||
for (String lateDate : res.getLeaveEarly30Dates()) {
|
||||
sb.append(lateDate);
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append("以上为早退三十分钟日期");
|
||||
}
|
||||
|
||||
if (!res.getLeaveEarly30Dates().isEmpty() || !res.getLeaveEarly10Dates().isEmpty()) {
|
||||
oaSalaryItem = new OaSalaryItem();
|
||||
oaSalaryItem.setSalaryId(salary.getSalaryId());
|
||||
oaSalaryItem.setPrice(Double.valueOf(res.getLeaveEarlyFee()));
|
||||
oaSalaryItem.setType(5L);
|
||||
oaSalaryItem.setFlag(0L);
|
||||
oaSalaryItem.setReason(sb.toString());
|
||||
oaSalaryItem.setSignTime(yearMonth);
|
||||
salaryItemMapper.insert(oaSalaryItem);
|
||||
}
|
||||
sb.append("早退日期三十分钟");
|
||||
oaSalaryItem = new OaSalaryItem();
|
||||
oaSalaryItem.setSalaryId(salary.getSalaryId());
|
||||
oaSalaryItem.setPrice(Double.valueOf(res.getLeaveEarlyFee()));
|
||||
oaSalaryItem.setType(5L);
|
||||
oaSalaryItem.setFlag(0L);
|
||||
oaSalaryItem.setReason(sb.toString());
|
||||
oaSalaryItem.setSignTime(yearMonth);
|
||||
salaryItemMapper.insert(oaSalaryItem);
|
||||
// 3.4.3 打卡罚金
|
||||
sb= new StringBuilder();
|
||||
for (String lateDate : res.getLateDates()) {
|
||||
sb.append(lateDate);
|
||||
sb.append(",");
|
||||
if (!res.getLateDates().isEmpty()){
|
||||
sb= new StringBuilder();
|
||||
for (String lateDate : res.getLateDates()) {
|
||||
sb.append(lateDate);
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append("未打卡");
|
||||
oaSalaryItem = new OaSalaryItem();
|
||||
oaSalaryItem.setSalaryId(salary.getSalaryId());
|
||||
oaSalaryItem.setPrice(Double.valueOf(res.getNotAttendanceFee()));
|
||||
oaSalaryItem.setType(6L);
|
||||
oaSalaryItem.setFlag(0L);
|
||||
oaSalaryItem.setReason(sb.toString());
|
||||
oaSalaryItem.setSignTime(yearMonth);
|
||||
salaryItemMapper.insert(oaSalaryItem);
|
||||
}
|
||||
sb.append("未打卡");
|
||||
oaSalaryItem = new OaSalaryItem();
|
||||
oaSalaryItem.setSalaryId(salary.getSalaryId());
|
||||
oaSalaryItem.setPrice(Double.valueOf(res.getNotAttendanceFee()));
|
||||
oaSalaryItem.setType(6L);
|
||||
oaSalaryItem.setFlag(0L);
|
||||
oaSalaryItem.setReason(sb.toString());
|
||||
oaSalaryItem.setSignTime(yearMonth);
|
||||
salaryItemMapper.insert(oaSalaryItem);
|
||||
}
|
||||
|
||||
return "计算成功";
|
||||
@@ -317,6 +354,9 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
||||
|
||||
private void buildItemAbsent(List<String> realDate2, OaSalary salary,Double flag,Date yearMonth) {
|
||||
// 最终这个为缺勤日期
|
||||
if (realDate2.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
OaSalaryItem oaSalaryItem = new OaSalaryItem();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// 接下来将他拼接成一个字符串为扣款原因矿工问题
|
||||
|
||||
Reference in New Issue
Block a user