备份
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
package com.ruoyi.oa.service;
|
||||
|
||||
import com.ruoyi.oa.domain.vo.EmployeeFilesVo;
|
||||
import com.ruoyi.oa.domain.bo.EmployeeFilesBo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.oa.domain.vo.FileUser;
|
||||
import com.ruoyi.oa.domain.vo.UserFilesVo;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文件档案管理Service接口
|
||||
*
|
||||
* @author hdka
|
||||
* @date 2025-03-08
|
||||
*/
|
||||
public interface IEmployeeFilesService {
|
||||
|
||||
/**
|
||||
* 查询文件档案管理
|
||||
*/
|
||||
EmployeeFilesVo queryById(Long fileId);
|
||||
|
||||
/**
|
||||
* 查询文件档案管理列表
|
||||
*/
|
||||
TableDataInfo<FileUser> queryPageList(EmployeeFilesBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询文件档案管理列表
|
||||
*/
|
||||
List<EmployeeFilesVo> queryList(EmployeeFilesBo bo);
|
||||
|
||||
/**
|
||||
* 新增文件档案管理
|
||||
*/
|
||||
Boolean insertByBo(UserFilesVo userFilesVo);
|
||||
|
||||
/**
|
||||
* 修改文件档案管理
|
||||
*/
|
||||
Boolean updateByBo(EmployeeFilesBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除文件档案管理信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 查询此用户的大概信息和文件列表
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
UserFilesVo queryUserFilesVoByUserId(@NotNull(message = "主键不能为空") Long userId);
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.oa.domain.bo.EmployeeOnboardingBo;
|
||||
import com.ruoyi.oa.domain.vo.EmployeeOnboardingVo;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@@ -46,4 +47,11 @@ public interface IEmployeeOnboardingService {
|
||||
* 校验并批量删除入职管理信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 查询入职信息
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
EmployeeOnboardingVo queryByUserId(@NotNull(message = "主键不能为空") Long userId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.ruoyi.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.oa.domain.vo.FileUser;
|
||||
import com.ruoyi.oa.domain.vo.UserFilesVo;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import liquibase.pro.packaged.A;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.oa.domain.bo.EmployeeFilesBo;
|
||||
import com.ruoyi.oa.domain.vo.EmployeeFilesVo;
|
||||
import com.ruoyi.oa.domain.EmployeeFiles;
|
||||
import com.ruoyi.oa.mapper.EmployeeFilesMapper;
|
||||
import com.ruoyi.oa.service.IEmployeeFilesService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 文件档案管理Service业务层处理
|
||||
*
|
||||
* @author hdka
|
||||
* @date 2025-03-08
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class EmployeeFilesServiceImpl implements IEmployeeFilesService {
|
||||
|
||||
private final EmployeeFilesMapper baseMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
/**
|
||||
* 查询文件档案管理
|
||||
*/
|
||||
@Override
|
||||
public EmployeeFilesVo queryById(Long fileId){
|
||||
return baseMapper.selectVoById(fileId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文件档案管理列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<FileUser> queryPageList(EmployeeFilesBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysUser> userLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userLambdaQueryWrapper.like(bo.getNickName() != null, SysUser::getNickName, bo.getNickName());
|
||||
Page<FileUser> result = baseMapper.selectFileUserVoPage(pageQuery.build(), userLambdaQueryWrapper);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文件档案管理列表
|
||||
*/
|
||||
@Override
|
||||
public List<EmployeeFilesVo> queryList(EmployeeFilesBo bo) {
|
||||
LambdaQueryWrapper<EmployeeFiles> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<EmployeeFiles> buildQueryWrapper(EmployeeFilesBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<EmployeeFiles> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getUserId() != null, EmployeeFiles::getUserId, bo.getUserId());
|
||||
lqw.eq(bo.getFileType() != null, EmployeeFiles::getFileType, bo.getFileType());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getFileName()), EmployeeFiles::getFileName, bo.getFileName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFilePath()), EmployeeFiles::getFilePath, bo.getFilePath());
|
||||
lqw.eq(bo.getUploadTime() != null, EmployeeFiles::getUploadTime, bo.getUploadTime());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文件档案管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(UserFilesVo userFilesVo) {
|
||||
// 删除该用户所有的文件,重新填入
|
||||
baseMapper.deleteByUserId(userFilesVo.getUserId());
|
||||
List<EmployeeFilesVo> fileList = userFilesVo.getFileList();
|
||||
fileList.forEach(file -> {
|
||||
EmployeeFiles employeeFiles = BeanUtil.toBean(file, EmployeeFiles.class);
|
||||
employeeFiles.setUserId(userFilesVo.getUserId());
|
||||
baseMapper.insert(employeeFiles);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文件档案管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(EmployeeFilesBo bo) {
|
||||
EmployeeFiles update = BeanUtil.toBean(bo, EmployeeFiles.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(EmployeeFiles entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除文件档案管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserFilesVo queryUserFilesVoByUserId(Long userId) {
|
||||
UserFilesVo userFilesVo = new UserFilesVo();
|
||||
SysUser sysUser = userService.selectUserById(userId);
|
||||
userFilesVo.setUserId(sysUser.getUserId());
|
||||
userFilesVo.setNickName(sysUser.getNickName());
|
||||
userFilesVo.setPhonenumber(sysUser.getPhonenumber());
|
||||
EmployeeFilesBo employeeFilesBo = new EmployeeFilesBo();
|
||||
employeeFilesBo.setUserId(userId);
|
||||
LambdaQueryWrapper<EmployeeFiles> employeeFilesLambdaQueryWrapper = buildQueryWrapper(employeeFilesBo);
|
||||
List<EmployeeFilesVo> list = baseMapper.selectVoList(employeeFilesLambdaQueryWrapper);
|
||||
userFilesVo.setFileList(list);
|
||||
return userFilesVo;
|
||||
}
|
||||
}
|
||||
@@ -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.entity.SysUser;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
@@ -60,12 +61,8 @@ public class EmployeeOnboardingServiceImpl implements IEmployeeOnboardingService
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EmployeeOnboardingVo> queryPageList(EmployeeOnboardingBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EmployeeOnboarding> lqw = buildQueryWrapper(bo);
|
||||
Page<EmployeeOnboardingVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
result.getRecords().forEach(employeeOnboardingVo -> {
|
||||
SysUser sysUser = userService.selectUserByIdAndNotDelFlag(employeeOnboardingVo.getUserId());
|
||||
employeeOnboardingVo.setNickName(sysUser.getNickName());
|
||||
});
|
||||
QueryWrapper<EmployeeOnboarding> lqw = buildQueryWrapper(bo);
|
||||
Page<EmployeeOnboardingVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@@ -74,16 +71,16 @@ public class EmployeeOnboardingServiceImpl implements IEmployeeOnboardingService
|
||||
*/
|
||||
@Override
|
||||
public List<EmployeeOnboardingVo> queryList(EmployeeOnboardingBo bo) {
|
||||
LambdaQueryWrapper<EmployeeOnboarding> lqw = buildQueryWrapper(bo);
|
||||
QueryWrapper<EmployeeOnboarding> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<EmployeeOnboarding> buildQueryWrapper(EmployeeOnboardingBo bo) {
|
||||
private QueryWrapper<EmployeeOnboarding> buildQueryWrapper(EmployeeOnboardingBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<EmployeeOnboarding> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getUserId() != null, EmployeeOnboarding::getUserId, bo.getUserId());
|
||||
lqw.eq(bo.getJoiningDate() != null, EmployeeOnboarding::getJoiningDate, bo.getJoiningDate());
|
||||
lqw.eq(bo.getManagerId() != null, EmployeeOnboarding::getManagerId, bo.getManagerId());
|
||||
QueryWrapper<EmployeeOnboarding> lqw =new QueryWrapper<EmployeeOnboarding>();
|
||||
lqw.eq(bo.getUserId() != null, "eo.user_id", bo.getUserId());
|
||||
lqw.eq(bo.getJoiningDate() != null, "eo.joining_date", bo.getJoiningDate());
|
||||
lqw.like(bo.getNickName()!=null,"su.nick_name",bo.getNickName());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@@ -129,4 +126,10 @@ public class EmployeeOnboardingServiceImpl implements IEmployeeOnboardingService
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmployeeOnboardingVo queryByUserId(Long userId) {
|
||||
|
||||
return baseMapper.selectVoById(userId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user