备份
This commit is contained in:
@@ -53,7 +53,7 @@ public class OaSalaryController extends BaseController {
|
|||||||
@SaCheckPermission("oa:salary:list")
|
@SaCheckPermission("oa:salary:list")
|
||||||
@GetMapping("/list-worker")
|
@GetMapping("/list-worker")
|
||||||
public TableDataInfo<OaSalaryVo> listWorker(OaSalaryBo bo, PageQuery pageQuery) {
|
public TableDataInfo<OaSalaryVo> listWorker(OaSalaryBo bo, PageQuery pageQuery) {
|
||||||
return iOaSalaryService.queryPageList(bo, pageQuery);
|
return iOaSalaryService.listWorker(bo, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,13 +78,11 @@ public class OaSalaryController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 获取薪资管理详细信息
|
* 获取薪资管理详细信息
|
||||||
*
|
*
|
||||||
* @param salaryId 主键
|
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("oa:salary:query")
|
@SaCheckPermission("oa:salary:query")
|
||||||
@GetMapping("/{salaryId}")
|
@GetMapping("/detail")
|
||||||
public R<OaSalaryVo> getInfo(@NotNull(message = "主键不能为空")
|
public R<OaSalaryVo> getInfo(@RequestBody OaSalaryBo bo) {
|
||||||
@PathVariable Long salaryId) {
|
return R.ok(iOaSalaryService.queryById(bo.getSalaryId(),bo.getPayTime()));
|
||||||
return R.ok(iOaSalaryService.queryById(salaryId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import com.ruoyi.oa.domain.OaSalary;
|
|||||||
import com.ruoyi.oa.domain.bo.OaSalaryBo;
|
import com.ruoyi.oa.domain.bo.OaSalaryBo;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,4 +69,5 @@ public class OaSalaryVo extends OaSalary {
|
|||||||
@ExcelProperty(value = "备注")
|
@ExcelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
private List<OaSalaryItemVo> itemList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import com.ruoyi.oa.domain.vo.OaSalaryVo;
|
|||||||
import com.ruoyi.common.core.mapper.BaseMapperPlus;
|
import com.ruoyi.common.core.mapper.BaseMapperPlus;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 薪资管理Mapper接口
|
* 薪资管理Mapper接口
|
||||||
*
|
*
|
||||||
@@ -17,8 +19,12 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
*/
|
*/
|
||||||
public interface OaSalaryMapper extends BaseMapperPlus<OaSalaryMapper, OaSalary, OaSalaryVo> {
|
public interface OaSalaryMapper extends BaseMapperPlus<OaSalaryMapper, OaSalary, OaSalaryVo> {
|
||||||
|
|
||||||
Page<OaSalaryVo> selectStaffVoPage(Page<Object> build,@Param(Constants.WRAPPER) Wrapper<OaSalary> lqw);
|
Page<OaSalaryVo> selectStaffVoPage(Page<Object> build,@Param(Constants.WRAPPER) Wrapper<OaSalary> lqw,@Param("payTime") Date payTime);
|
||||||
|
|
||||||
|
|
||||||
OaSalary selectVoByUserId(Long userId);
|
OaSalary selectVoByUserId(Long userId);
|
||||||
|
|
||||||
|
OaSalaryVo selectVoAndItemVoById(@Param("salaryId")Long salaryId,@Param("payTime")Date payTime);
|
||||||
|
|
||||||
|
void delByPayTime(Date date);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import com.ruoyi.oa.domain.bo.OaSalaryBo;
|
|||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
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
|
* @return
|
||||||
*/
|
*/
|
||||||
R<Void> importSalaryUser();
|
R<Void> importSalaryUser();
|
||||||
|
|
||||||
|
TableDataInfo<OaSalaryVo> listWorker(OaSalaryBo bo, PageQuery pageQuery);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.oa.service.impl;
|
package com.ruoyi.oa.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
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.R;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
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.mapper.OaSalaryItemMapper;
|
||||||
import com.ruoyi.oa.service.ISysOaHolidayService;
|
import com.ruoyi.oa.service.ISysOaHolidayService;
|
||||||
import com.ruoyi.oa.utils.OwnHttpUtils;
|
import com.ruoyi.oa.utils.OwnHttpUtils;
|
||||||
|
import com.ruoyi.system.mapper.SysUserRoleMapper;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
import com.ruoyi.workflow.mapper.WfDeployFormMapper;
|
import com.ruoyi.workflow.mapper.WfDeployFormMapper;
|
||||||
import com.ruoyi.workflow.service.IWfTaskService;
|
import com.ruoyi.workflow.service.IWfTaskService;
|
||||||
@@ -34,6 +36,7 @@ import com.ruoyi.oa.mapper.OaSalaryMapper;
|
|||||||
import com.ruoyi.oa.service.IOaSalaryService;
|
import com.ruoyi.oa.service.IOaSalaryService;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.*;
|
import java.time.*;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
@@ -75,12 +78,15 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OaSalaryItemMapper salaryItemMapper;
|
private OaSalaryItemMapper salaryItemMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserRoleMapper sysUserRoleMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询薪资管理
|
* 查询薪资管理
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public OaSalaryVo queryById(Long salaryId){
|
public OaSalaryVo queryById(Long salaryId,Date payTime){
|
||||||
return baseMapper.selectVoById(salaryId);
|
return baseMapper.selectVoAndItemVoById(salaryId,payTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,14 +94,28 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<OaSalaryVo> queryPageList(OaSalaryBo bo, PageQuery pageQuery) {
|
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);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<Void> importSalaryUser() {
|
public R<Void> importSalaryUser() {
|
||||||
List<SysUser> sysUsers = userService.selectUserList2();
|
List<SysUser> sysUsers = userService.selectUserList2();
|
||||||
|
baseMapper.delByPayTime(new Date());
|
||||||
for (SysUser user : sysUsers) {
|
for (SysUser user : sysUsers) {
|
||||||
if(Objects.nonNull(user)){
|
if(Objects.nonNull(user)){
|
||||||
OaSalary oaSalary = new OaSalary();
|
OaSalary oaSalary = new OaSalary();
|
||||||
@@ -107,6 +127,8 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
|||||||
}
|
}
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询薪资管理列表
|
* 查询薪资管理列表
|
||||||
*/
|
*/
|
||||||
@@ -120,9 +142,6 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
|||||||
Map<String, Object> params = bo.getParams();
|
Map<String, Object> params = bo.getParams();
|
||||||
LambdaQueryWrapper<OaSalary> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<OaSalary> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.eq(bo.getUserId() != null, OaSalary::getUserId, bo.getUserId());
|
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;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,10 +233,9 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
|||||||
Long endTimeItem = (Long) processVariables.get("endTimeItem");
|
Long endTimeItem = (Long) processVariables.get("endTimeItem");
|
||||||
}
|
}
|
||||||
// 计算缺席的某天是否请假或者出差
|
// 计算缺席的某天是否请假或者出差
|
||||||
List<String> absentDates = res.getAbsentDates();
|
|
||||||
List<String> realDates = new ArrayList<>();
|
List<String> realDates = new ArrayList<>();
|
||||||
List<String> real05Dates = new ArrayList<>();
|
List<String> real05Dates = new ArrayList<>();
|
||||||
for (String absentDate : absentDates) {
|
for (String absentDate : res.getAbsentDates()) {
|
||||||
// 形如2024-11-01
|
// 形如2024-11-01
|
||||||
String fullDate = combineYearMonthAndDay(bo.getMonthStr(), absentDate);
|
String fullDate = combineYearMonthAndDay(bo.getMonthStr(), absentDate);
|
||||||
boolean contains = timeRange.contains(fullDate);
|
boolean contains = timeRange.contains(fullDate);
|
||||||
@@ -226,16 +244,18 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
|||||||
realDates.add(fullDate);
|
realDates.add(fullDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String real05Date : real05Dates) {
|
for (String real05Date : res.getAbsent05Dates()) {
|
||||||
String fullDate = combineYearMonthAndDay(bo.getMonthStr(), real05Date);
|
String fullDate = combineYearMonthAndDay(bo.getMonthStr(), real05Date);
|
||||||
boolean contains = timeRange.contains(fullDate);
|
boolean contains = timeRange.contains(fullDate);
|
||||||
if (!contains) {
|
if (!contains) {
|
||||||
real05Dates.add(fullDate);
|
real05Dates.add(fullDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
res.setAbsentDates(realDates);
|
||||||
|
res.setAbsent05Dates(real05Dates);
|
||||||
// 这次已经将缺勤拿出来了 现在还要判断今天是否为节假日
|
// 这次已经将缺勤拿出来了 现在还要判断今天是否为节假日
|
||||||
List<String> realDate2 =new ArrayList<>();
|
List<String> realDate2 =new ArrayList<>();
|
||||||
for (String realDate : realDates) {
|
for (String realDate : res.getAbsentDates()) {
|
||||||
SysOaHolidayVo sysOaHolidayVo = holidayService.queryHolidayByDate(StringToDate(realDate));
|
SysOaHolidayVo sysOaHolidayVo = holidayService.queryHolidayByDate(StringToDate(realDate));
|
||||||
if (sysOaHolidayVo != null && sysOaHolidayVo.getType()!=0 ) {
|
if (sysOaHolidayVo != null && sysOaHolidayVo.getType()!=0 ) {
|
||||||
// 如果不为节假日则加入进去
|
// 如果不为节假日则加入进去
|
||||||
@@ -243,7 +263,7 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<String> real05Date2 =new ArrayList<>();
|
List<String> real05Date2 =new ArrayList<>();
|
||||||
for (String real05Date : real05Dates) {
|
for (String real05Date : res.getAbsent05Dates()) {
|
||||||
SysOaHolidayVo sysOaHolidayVo = holidayService.queryHolidayByDate(StringToDate(real05Date));
|
SysOaHolidayVo sysOaHolidayVo = holidayService.queryHolidayByDate(StringToDate(real05Date));
|
||||||
if (sysOaHolidayVo != null && sysOaHolidayVo.getType()!=0 ) {
|
if (sysOaHolidayVo != null && sysOaHolidayVo.getType()!=0 ) {
|
||||||
// 如果不为节假日则加入进去
|
// 如果不为节假日则加入进去
|
||||||
@@ -251,63 +271,80 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
buildItemAbsent(realDate2, salary,1.0,yearMonth);
|
res.setAbsentDates(realDate2);
|
||||||
buildItemAbsent(real05Date2, salary,0.5,yearMonth);
|
res.setAbsent05Dates(real05Date2);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
buildItemAbsent(res.getAbsentDates(), salary,1.0,yearMonth);
|
||||||
|
buildItemAbsent(res.getAbsent05Dates(), salary,0.5,yearMonth);
|
||||||
|
|
||||||
// 3.4创建其他的item包括了好多罚金
|
// 3.4创建其他的item包括了好多罚金
|
||||||
// 3.4.1 迟到罚金
|
// 3.4.1 迟到罚金
|
||||||
StringBuilder sb= new StringBuilder();
|
|
||||||
for (String lateDate : res.getLateDates()) {
|
|
||||||
sb.append(lateDate);
|
|
||||||
sb.append(",");
|
|
||||||
}
|
|
||||||
sb.append("迟到日期");
|
|
||||||
OaSalaryItem oaSalaryItem = new OaSalaryItem();
|
OaSalaryItem oaSalaryItem = new OaSalaryItem();
|
||||||
oaSalaryItem.setSalaryId(salary.getSalaryId());
|
StringBuilder sb= new StringBuilder();
|
||||||
oaSalaryItem.setPrice(Double.valueOf(res.getLateFee()));
|
if (!res.getLateDates().isEmpty()) {
|
||||||
oaSalaryItem.setType(4L);
|
for (String lateDate : res.getLateDates()) {
|
||||||
oaSalaryItem.setFlag(0L);
|
sb.append(lateDate);
|
||||||
oaSalaryItem.setReason(sb.toString());
|
sb.append(",");
|
||||||
oaSalaryItem.setSignTime(yearMonth);
|
}
|
||||||
salaryItemMapper.insert(oaSalaryItem);
|
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 早退罚金
|
// 3.4.2 早退罚金
|
||||||
sb= new StringBuilder();
|
sb= new StringBuilder();
|
||||||
for (String lateDate : res.getLeaveEarly10Dates()) {
|
if (!res.getLeaveEarly10Dates().isEmpty()) {
|
||||||
sb.append(lateDate);
|
for (String lateDate : res.getLeaveEarly10Dates()) {
|
||||||
sb.append(",");
|
sb.append(lateDate);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.append("以上为早退十分钟日期");
|
||||||
}
|
}
|
||||||
sb.append("早退日期十分钟");
|
|
||||||
for (String lateDate : res.getLeaveEarly30Dates()) {
|
if (!res.getLeaveEarly30Dates().isEmpty()) {
|
||||||
sb.append(lateDate);
|
for (String lateDate : res.getLeaveEarly30Dates()) {
|
||||||
sb.append(",");
|
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 打卡罚金
|
// 3.4.3 打卡罚金
|
||||||
sb= new StringBuilder();
|
if (!res.getLateDates().isEmpty()){
|
||||||
for (String lateDate : res.getLateDates()) {
|
sb= new StringBuilder();
|
||||||
sb.append(lateDate);
|
for (String lateDate : res.getLateDates()) {
|
||||||
sb.append(",");
|
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 "计算成功";
|
return "计算成功";
|
||||||
@@ -317,6 +354,9 @@ public class OaSalaryServiceImpl implements IOaSalaryService {
|
|||||||
|
|
||||||
private void buildItemAbsent(List<String> realDate2, OaSalary salary,Double flag,Date yearMonth) {
|
private void buildItemAbsent(List<String> realDate2, OaSalary salary,Double flag,Date yearMonth) {
|
||||||
// 最终这个为缺勤日期
|
// 最终这个为缺勤日期
|
||||||
|
if (realDate2.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
OaSalaryItem oaSalaryItem = new OaSalaryItem();
|
OaSalaryItem oaSalaryItem = new OaSalaryItem();
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
// 接下来将他拼接成一个字符串为扣款原因矿工问题
|
// 接下来将他拼接成一个字符串为扣款原因矿工问题
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ import java.io.InputStreamReader;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.time.*;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class OwnHttpUtils {
|
public class OwnHttpUtils {
|
||||||
@@ -25,9 +28,10 @@ public class OwnHttpUtils {
|
|||||||
|
|
||||||
public static CalcResultVo getBaseCalc(String fileName, String personName) {
|
public static CalcResultVo getBaseCalc(String fileName, String personName) {
|
||||||
// 目标接口地址
|
// 目标接口地址
|
||||||
String jsonBody = String.format("{\"file_name\":\"%s\",\"person_name\":\"%s\"}", fileName, personName);
|
String jsonBody = String.format("{\"file_name\":%s,\"person_name\":\"%s\"}", fileName, personName);
|
||||||
jsonBody = getResult("get_person_info",jsonBody);
|
|
||||||
System.out.println(jsonBody);
|
System.out.println(jsonBody);
|
||||||
|
jsonBody = getResult("get_person_info",jsonBody);
|
||||||
|
|
||||||
// 1. 将 JSON 字符串解析成 JSONObject
|
// 1. 将 JSON 字符串解析成 JSONObject
|
||||||
JSONObject jsonObject = JSON.parseObject(jsonBody);
|
JSONObject jsonObject = JSON.parseObject(jsonBody);
|
||||||
|
|
||||||
@@ -107,12 +111,7 @@ public class OwnHttpUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String fileName = "/home/ubuntu/lyq/fad_oa_kqdeal/202411.json";
|
StringToDate("2025-03");
|
||||||
String personName = "丁苗松";
|
|
||||||
String jsonBody = String.format("{\"file_name\":\"%s\",\"person_name\":\"%s\"}", fileName, personName);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -164,4 +163,20 @@ public class OwnHttpUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Date StringToDate(String dateStr) {
|
||||||
|
|
||||||
|
// 1. 解析字符串到 YearMonth(只包含年和月)
|
||||||
|
YearMonth yearMonth = YearMonth.parse(dateStr, DateTimeFormatter.ofPattern("yyyy-MM"));
|
||||||
|
|
||||||
|
// 2. 在 YearMonth 基础上指定“日”为 1
|
||||||
|
LocalDate localDate = yearMonth.atDay(1);
|
||||||
|
|
||||||
|
// 3. 转成 Instant
|
||||||
|
Instant instant = localDate.atStartOfDay(ZoneId.systemDefault()).toInstant();
|
||||||
|
|
||||||
|
// 4. 转成旧版本 Date
|
||||||
|
return Date.from(instant);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,13 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
<delete id="delByPayTime" parameterType="Date">
|
||||||
|
DELETE FROM oa_salary
|
||||||
|
WHERE YEAR(pay_time) = YEAR(#{payTime})
|
||||||
|
AND MONTH(pay_time) = MONTH(#{payTime})
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
<select id="selectStaffVoPage" resultMap="OaSalaryResult">
|
<select id="selectStaffVoPage" resultMap="OaSalaryResult">
|
||||||
SELECT
|
SELECT
|
||||||
os.salary_id,
|
os.salary_id,
|
||||||
@@ -45,13 +52,10 @@
|
|||||||
AND YEAR(osi.sign_time) = YEAR(#{payTime})
|
AND YEAR(osi.sign_time) = YEAR(#{payTime})
|
||||||
AND MONTH(osi.sign_time) = MONTH(#{payTime})
|
AND MONTH(osi.sign_time) = MONTH(#{payTime})
|
||||||
LEFT JOIN sys_user su ON os.user_id = su.user_id
|
LEFT JOIN sys_user su ON os.user_id = su.user_id
|
||||||
<where>
|
${ew.customSqlSegment}
|
||||||
|
and
|
||||||
YEAR(os.pay_time) = YEAR(#{payTime})
|
YEAR(os.pay_time) = YEAR(#{payTime})
|
||||||
AND MONTH(os.pay_time) = MONTH(#{payTime})
|
AND MONTH(os.pay_time) = MONTH(#{payTime})
|
||||||
<if test="ew != null and ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
|
||||||
AND ${ew.customSqlSegment}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
GROUP BY
|
GROUP BY
|
||||||
os.salary_id,
|
os.salary_id,
|
||||||
os.user_id,
|
os.user_id,
|
||||||
@@ -69,5 +73,48 @@
|
|||||||
select * from oa_salary where user_id = #{userId}
|
select * from oa_salary where user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectVoAndItemVoById" resultType="com.ruoyi.oa.domain.vo.OaSalaryVo">
|
||||||
|
SELECT
|
||||||
|
os.salary_id,
|
||||||
|
os.user_id,
|
||||||
|
os.pay_time,
|
||||||
|
os.base_salary,
|
||||||
|
(
|
||||||
|
os.base_salary * DAY(LAST_DAY(#{payTime}))
|
||||||
|
+ COALESCE(SUM(
|
||||||
|
CASE
|
||||||
|
WHEN osi.flag = 1 THEN osi.price
|
||||||
|
WHEN osi.flag = 0 THEN -osi.price
|
||||||
|
ELSE 0
|
||||||
|
END
|
||||||
|
), 0)
|
||||||
|
) AS real_salary,
|
||||||
|
osi.salary_item_id,
|
||||||
|
osi.reason,
|
||||||
|
osi.price,
|
||||||
|
osi.sign_time,
|
||||||
|
su.nick_name
|
||||||
|
FROM oa_salary os
|
||||||
|
LEFT JOIN oa_salary_item osi
|
||||||
|
ON osi.salary_id = os.salary_id
|
||||||
|
AND YEAR(osi.sign_time) = YEAR(#{payTime})
|
||||||
|
AND MONTH(osi.sign_time) = MONTH(#{payTime})
|
||||||
|
LEFT JOIN sys_user su ON os.user_id = su.user_id
|
||||||
|
where os.salary_id = #{salaryId}
|
||||||
|
and
|
||||||
|
YEAR(os.pay_time) = YEAR(#{payTime})
|
||||||
|
AND MONTH(os.pay_time) = MONTH(#{payTime})
|
||||||
|
GROUP BY
|
||||||
|
os.salary_id,
|
||||||
|
os.user_id,
|
||||||
|
os.pay_time,
|
||||||
|
os.base_salary,
|
||||||
|
osi.salary_item_id,
|
||||||
|
osi.type,
|
||||||
|
osi.reason,
|
||||||
|
osi.price,
|
||||||
|
osi.sign_time
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ public interface SysUserRoleMapper extends BaseMapperPlus<SysUserRoleMapper, Sys
|
|||||||
|
|
||||||
List<Long> selectUserIdsByRoleId(Long roleId);
|
List<Long> selectUserIdsByRoleId(Long roleId);
|
||||||
|
|
||||||
|
List<Long> selectUserIdsByNotRoleId(Long roleId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,10 @@
|
|||||||
on u.user_id = sur.user_id and sur.role_id = #{roleId}
|
on u.user_id = sur.user_id and sur.role_id = #{roleId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUserIdsByNotRoleId" resultType="java.lang.Long">
|
||||||
|
select u.user_id from sys_user u
|
||||||
|
inner join sys_user_role sur
|
||||||
|
on u.user_id = sur.user_id and sur.role_id != #{roleId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据月份和文件计算工资
|
* 根据月份和文件计算工资
|
||||||
* @param {*} param0.monthStr: 月份
|
* @param {*} param0.monthStr: 月份
|
||||||
* @param {*} param0.filePath: 文件路径
|
* @param {*} param0.filePath: 文件路径
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function calculateSalary({ monthStr, filePath }) {
|
export function calculateSalary({ monthStr, filePath }) {
|
||||||
return request({
|
return request({
|
||||||
url: '/oa/salary/calc',
|
url: '/oa/salary/calc',
|
||||||
@@ -16,10 +16,18 @@ export function calculateSalary({ monthStr, filePath }) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 查询职工薪资列表
|
||||||
|
export function listStaff(query) {
|
||||||
|
return request({
|
||||||
|
url: '/oa/salary/list-staff',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* oss文件上传
|
* oss文件上传
|
||||||
*/
|
*/
|
||||||
export function uploadOssFile(data) {
|
export function uploadOssFile(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/oss/upload',
|
url: '/system/oss/upload',
|
||||||
@@ -29,4 +37,4 @@ export function uploadOssFile(data) {
|
|||||||
'Content-Type': 'multipart/form-data'
|
'Content-Type': 'multipart/form-data'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 上传弹窗 -->
|
<!-- 上传弹窗 -->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="薪资计算"
|
title="薪资计算"
|
||||||
:visible.sync="uploadVisible"
|
:visible.sync="uploadVisible"
|
||||||
width="30%"
|
width="30%"
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
:disabled="isUploading">
|
:disabled="isUploading">
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="薪资文件" required>
|
<el-form-item label="薪资文件" required>
|
||||||
<el-upload
|
<el-upload
|
||||||
class="upload-demo"
|
class="upload-demo"
|
||||||
@@ -38,15 +38,16 @@
|
|||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button @click="uploadVisible = false" :disabled="isUploading">取消</el-button>
|
<el-button @click="uploadVisible = false" :disabled="isUploading">取消</el-button>
|
||||||
<el-button @click="handleUpload" :disabled="fileList.length === 0">确认上传</el-button>
|
<el-button @click="handleUpload" :disabled="fileList.length === 0">确认上传</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="handleSubmit"
|
@click="handleSubmit"
|
||||||
:loading="isUploading"
|
:loading="isUploading"
|
||||||
:disabled="!filePath">
|
:disabled="isUploading"
|
||||||
|
>
|
||||||
{{ isUploading ? '计算中...' : '开始计算' }}
|
{{ isUploading ? '计算中...' : '开始计算' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
@@ -87,7 +88,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<div class="summary">
|
<div class="summary">
|
||||||
<span>合计人数:{{currentResult.length}} 人</span>
|
<span>合计人数:{{currentResult.length}} 人</span>
|
||||||
<span class="total-amount">总金额:¥ {{totalAmount}}</span>
|
<span class="total-amount">总金额:¥ {{totalAmount}}</span>
|
||||||
@@ -98,7 +99,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { calculateSalary, uploadOssFile } from '@/api/oa/salary'
|
import {calculateSalary, listStaff, uploadOssFile} from '@/api/oa/salary'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -112,6 +113,12 @@ export default {
|
|||||||
currentMonth: '',
|
currentMonth: '',
|
||||||
historyData: [],
|
historyData: [],
|
||||||
filePath: '',
|
filePath: '',
|
||||||
|
query:{
|
||||||
|
pageSize:10,
|
||||||
|
pageNum:1,
|
||||||
|
payTime:"2025-03-01"
|
||||||
|
},
|
||||||
|
StaffSalaryList:[]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -122,46 +129,55 @@ export default {
|
|||||||
return this.currentResult.reduce((sum, item) => sum + item.total, 0)
|
return this.currentResult.reduce((sum, item) => sum + item.total, 0)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
this.getStaffList()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getStaffList(){
|
||||||
|
listStaff(this.query).then(res => {
|
||||||
|
this.StaffSalaryList = res.rows
|
||||||
|
console.log(this.StaffSalaryList)
|
||||||
|
})
|
||||||
|
},
|
||||||
showUploadDialog() {
|
showUploadDialog() {
|
||||||
this.uploadVisible = true
|
this.uploadVisible = true
|
||||||
},
|
},
|
||||||
|
|
||||||
handleFileChange(file, fileList) {
|
handleFileChange(file, fileList) {
|
||||||
// 限制单个文件上传
|
// 限制单个文件上传
|
||||||
this.fileList = [fileList[fileList.length - 1]]
|
this.fileList = [fileList[fileList.length - 1]]
|
||||||
},
|
},
|
||||||
|
|
||||||
async handleSubmit() {
|
async handleSubmit() {
|
||||||
try {
|
try {
|
||||||
this.isUploading = true
|
this.isUploading = true
|
||||||
|
|
||||||
// 第一步:上传文件
|
// 第一步:上传文件
|
||||||
// const formData = new FormData()
|
// const formData = new FormData()
|
||||||
// formData.append('file', this.fileList[0].raw)
|
// formData.append('file', this.fileList[0].raw)
|
||||||
|
|
||||||
// const { data } = await uploadOssFile(formData)
|
// const { data } = await uploadOssFile(formData)
|
||||||
|
|
||||||
// const filePath = '/data' + data.url.split('/data')[1];
|
// const filePath = '/data' + data.url.split('/data')[1];
|
||||||
// console.log('上传成功,文件路径:', filePath, this.month)
|
// console.log('上传成功,文件路径:', filePath, this.month)
|
||||||
|
|
||||||
// 第二步:提交计算
|
// 第二步:提交计算
|
||||||
const { result } = await calculateSalary({
|
const { result } = await calculateSalary({
|
||||||
filePath: this.filePath,
|
filePath: this.filePath,
|
||||||
monthStr: this.month
|
monthStr: this.month
|
||||||
})
|
})
|
||||||
|
|
||||||
this.currentResult = result.details
|
this.currentResult = result.details
|
||||||
this.currentMonth = this.month
|
this.currentMonth = this.month
|
||||||
this.showCurrentResult = true
|
this.showCurrentResult = true
|
||||||
|
|
||||||
// 更新历史记录
|
// 更新历史记录
|
||||||
this.historyData.unshift({
|
this.historyData.unshift({
|
||||||
calcMonth: this.month,
|
calcMonth: this.month,
|
||||||
calcTime: new Date().toLocaleString(),
|
calcTime: new Date().toLocaleString(),
|
||||||
totalAmount: this.totalAmount
|
totalAmount: this.totalAmount
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$message.success('计算完成')
|
this.$message.success('计算完成')
|
||||||
this.uploadVisible = false
|
this.uploadVisible = false
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -170,12 +186,12 @@ export default {
|
|||||||
this.isUploading = false
|
this.isUploading = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 上传文件
|
// 上传文件
|
||||||
async handleUpload() {
|
async handleUpload() {
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
formData.append('file', this.fileList[0].raw)
|
formData.append('file', this.fileList[0].raw)
|
||||||
|
|
||||||
const { data } = await uploadOssFile(formData)
|
const { data } = await uploadOssFile(formData)
|
||||||
|
|
||||||
const filePath = '/data' + data.url.split('/data')[1];
|
const filePath = '/data' + data.url.split('/data')[1];
|
||||||
@@ -187,7 +203,7 @@ export default {
|
|||||||
this.fileList = []
|
this.fileList = []
|
||||||
this.month = ''
|
this.month = ''
|
||||||
},
|
},
|
||||||
|
|
||||||
showDetail(row) {
|
showDetail(row) {
|
||||||
// 查看历史详情逻辑
|
// 查看历史详情逻辑
|
||||||
console.log('查看详情', row)
|
console.log('查看详情', row)
|
||||||
@@ -243,4 +259,4 @@ export default {
|
|||||||
.upload-demo {
|
.upload-demo {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user