package io.github.sliverkiss.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.github.sliverkiss.constants.UserContants;
import io.github.sliverkiss.controller.DTO.EmployeeQueryDTO;
import io.github.sliverkiss.dao.*;
import io.github.sliverkiss.dao.RBAC.UserDao;
import io.github.sliverkiss.domain.ResponseResult;
import io.github.sliverkiss.domain.entity.*;
import io.github.sliverkiss.domain.entity.RBAC.User;
import io.github.sliverkiss.domain.entity.assess.AssessApproval;
import io.github.sliverkiss.domain.entity.assess.AssessDeclare;
import io.github.sliverkiss.domain.entity.assess.AssessStaff;
import io.github.sliverkiss.domain.vo.ContractVo;
import io.github.sliverkiss.domain.vo.EmployeeVo;
import io.github.sliverkiss.enums.AppHttpCodeEnum;
import io.github.sliverkiss.exception.SystemException;
import io.github.sliverkiss.service.EmployeeService;
import io.github.sliverkiss.utils.BeanCopyUtils;
import io.github.sliverkiss.utils.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import xin.altitude.cms.common.util.EntityUtils;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import static io.github.sliverkiss.utils.CheckUtil.checkInt;
import static io.github.sliverkiss.utils.CheckUtil.checkStr;
/**
* 员工表(Employee)表服务实现类
*
* @author tistzach
* @since 2023-07-05 11:45:06
*/
@Service("employeeService")
@Slf4j
public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, Employee> implements EmployeeService {
@Autowired
private EmployeeDao employeeDao;
@Resource
private PersonalDao personalDao;
@Resource
private DepartmentDao departmentDao;
@Autowired
private UserDao userDao;
@Autowired
private SalaryDao salaryDao;
@Autowired
private RenewalDao renewalDao;
@Autowired
private TransferDao transferDao;
@Autowired
private ReinstatementDao reinstatementDao;
@Autowired
private ResignationDao resignationDao;
@Autowired
private AssessStaffDao staffDao;
@Autowired
private AssessDeclareDao declareDao;
@Autowired
private TrainningRecordDao recordDao;
@Autowired
private AssessApprovalDao approvalDao;
/**
* 员工检索,实现员工信息的多方位检索,包活员工编号、入职日期、部门、岗位和姓名检索
*
* @return {@link ResponseResult}
*/
@Override
public ResponseResult selectEmployeePage(EmployeeQueryDTO employeeQueryDTO) {
// 数据校验
Integer currentPage = employeeQueryDTO.getCurrentPage ();
Integer pageSize = employeeQueryDTO.getPageSize ();
String name = employeeQueryDTO.getName ();
String employeeId = employeeQueryDTO.getEmployeeId ();
Integer departmentId = employeeQueryDTO.getDepartmentId ();
String post = employeeQueryDTO.getPost ();
String hireDate = employeeQueryDTO.getHireDate ();
Integer userId = employeeQueryDTO.getUserId ();
Integer role = employeeQueryDTO.getUserRole ();
if (currentPage == null || pageSize <= 0 || pageSize == null || pageSize < 1) {
throw new SystemException ( AppHttpCodeEnum.SYSTEM_ERROR );
}
Page<Employee> page = new Page<> ( currentPage, pageSize );
// 如果员工名不为空,则按姓名模糊查询
List<Integer> personalIds = personalDao.selectList ( Wrappers.lambdaQuery ( Personal.class )
.like ( StringUtils.isNotBlank ( name ), Personal::getName, name ) )
.stream ().map ( Personal::getId ).collect ( Collectors.toList () );
// 获取查询到的部门信息
List<Department> departmentList = departmentDao
.selectList ( Wrappers.lambdaQuery ( Department.class )
.in ( Department::getId, departmentId ) );
// 数据校检,防止产生报错
if (checkStr ( name, personalIds ) || checkInt ( departmentId, departmentList )) {
return ResponseResult.errorResult ( AppHttpCodeEnum.FIND_NOT_FOUND );
} else {
// 如果 员工编号不为空,则按员工编号模糊查询
try {
LambdaQueryWrapper<Employee> employeeWrapper = Wrappers.lambdaQuery ( Employee.class )
.like ( StringUtils.isNotBlank ( employeeId ), Employee::getId, employeeId )
.like ( StringUtils.isNotBlank ( post ), Employee::getPost, post )
.in ( personalIds.size () > 0, Employee::getPersonalId, personalIds )
.eq ( departmentList.size () > 0, Employee::getDepartmentId, departmentId )
.like ( StringUtils.isNotBlank ( hireDate ), Employee::getId, hireDate );
// 判断用户角色,筛选信息
if (role.equals ( UserContants.ROLE_USER )) {
User user = userDao.selectById ( userId );
Employee employee = this.getById ( user.getEmployeeId () );
if (employee == null) {
throw new SystemException ( AppHttpCodeEnum.FIND_NOT_FOUND );
}
employeeWrapper.eq ( Employee::getId, employee.getId () );
}
// 将 条件查询结果用page包装起来
Page<Employee> employeePage = this.page ( page, employeeWrapper );
IPage<EmployeeVo> employeeVoIPage = EntityUtils.toPage ( employeePage, EmployeeVo::new );
// 分页模糊查询
// 注入personal属性
this.employeeInnerJoinPersonal ( employeeVoIPage );
// 注入department属性
this.employeeInnerJoinDepartment ( employeeVoIPage );
return ResponseResult.okResult ( employeeVoIPage );
} catch (SystemException e) {
throw new SystemException ( AppHttpCodeEnum.FIND_NOT_FOUND );
}
}
}
/**
* 员工工作表连接员工信息表查询
*
* @param employeeVoIPage 员工资料视图
*/
public void employeeInnerJoinPersonal(IPage<EmployeeVo> employeeVoIPage) {
List<Integer> personalIds = EntityUtils.toList ( employeeVoIPage.getRecords (), EmployeeVo::getPersonalId );
if (personalIds.size () > 0) {
LambdaQueryWrapper<Personal> wrapper = Wrappers.lambdaQuery ( Personal.class ).in ( Personal::getId, personalIds );
List<Personal> personalList = personalDao.selectList ( wrapper );
Map<Integer, Personal> map = EntityUtils.toMap ( personalList, Personal::getId, e -> e );
// 将employee填入employeeVo
employeeVoIPage.getRecords ().forEach ( employeeVo -> {
Personal personal = map.get ( employeeVo.getPersonalId () );
Optional.ofNullable ( personal ).ifPresent ( e -> employeeVo.addPersonalInfo ( personal ) );
} );
}
}
/**
* 员工工作表连接部门表查询
*
* @param employeeVoIPage 员工资料视图
*/
public void employeeInnerJoinDepartment(IPage<EmployeeVo> employeeVoIPage) {
Set<Integer> departmentIds = EntityUtils.toSet ( employeeVoIPage.getRecords (), EmployeeVo::getDepartmentId );
if (departmentIds.size () > 0) {
// 将部门名称填入employeeVo
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
毕业设计,基于SpringBoot+Vue+MySql开发的前后端分离的美术馆人事管理系统,内含Java完整源代码,数据库脚本 毕业设计-基于SpringBoot+mybatis-plus+Redis+Vue3的美术馆人事管理系统的设计与实现 人事管理系统,属于ERP的一个部分。它单指汇集成功企业先进的人力资源管理理念、人力资源管理实践、人力资源信息化系统建设的经验,以信息技术实现对企业人力资源信息的高度集成化管理,为中国企业使用的人力资源管理解决方案。核心价值在于将人力资源工作者从繁重的日常琐碎事务中解放出来,将更多的精力用于企业的人力资源职能管理和管理决策,保持企业的持续高效运营。 集中记录、监测和分析所有劳动力的技能和资格,提供决策分析。提高企业整体的科技含量与管理效率,加快企业的信息化建设。
资源推荐
资源详情
资源评论
收起资源包目录
毕业设计,基于SpringBoot+Vue+MySql开发的前后端分离的美术馆人事管理系统,内含Java完整源代码,数据库脚本 (1542个子文件)
$PROJECT_FILE$ 364B
009f8074039e656261aae9859fee60777fd644c1 226B
009f8074039e656261aae9859fee60777fd644c1 0B
0195a89cfff9c00ec4fd3cf70936ef0cfd955940 0B
0195a89cfff9c00ec4fd3cf70936ef0cfd955940 0B
024597d4272aad1e27c777f435985f6a04478148 1KB
024597d4272aad1e27c777f435985f6a04478148 0B
0398ccd0f49298b10a3d76a47800d2ebecd49859 0B
0398ccd0f49298b10a3d76a47800d2ebecd49859 0B
05af3adb503186738f2d91114b4400f377096a2a 0B
05af3adb503186738f2d91114b4400f377096a2a 0B
061864cc8ed9e6950f44b6e32d4419a0e50b7752 0B
061864cc8ed9e6950f44b6e32d4419a0e50b7752 0B
06cc3f151613f32c540e57de9bdbbe227db1968c 0B
06cc3f151613f32c540e57de9bdbbe227db1968c 0B
0795a2d600ac4f50df08e9b7384ce77ad8235015 0B
0795a2d600ac4f50df08e9b7384ce77ad8235015 0B
092a2765b0148a1cb84537485e84740c21a38775 0B
092a2765b0148a1cb84537485e84740c21a38775 0B
0969173bf5f430a660cf407a7ddf8a0774183e45 0B
0969173bf5f430a660cf407a7ddf8a0774183e45 0B
09e4861d1308a33ebcbe441cfedb6c04c0afd36f 0B
09e4861d1308a33ebcbe441cfedb6c04c0afd36f 0B
0a5ed679ae10db1d9ac021639adf32a1fdbf1992 0B
0a5ed679ae10db1d9ac021639adf32a1fdbf1992 0B
0abc8656feb22deb21be9b35660069b4489b05cc 0B
0abc8656feb22deb21be9b35660069b4489b05cc 0B
0abedd3ccf78ec7cc01b713cea715223f28e84b3 0B
0abedd3ccf78ec7cc01b713cea715223f28e84b3 0B
0ac24518ba2037f777eab9d7e86a8ce2a5486332 964B
0ac24518ba2037f777eab9d7e86a8ce2a5486332 0B
0bf5f448ba9706195891162324bf4190916b2c64 0B
0bf5f448ba9706195891162324bf4190916b2c64 0B
0c82b98eb03a64341c2e8e4de828a541f5d3db8d 0B
0c82b98eb03a64341c2e8e4de828a541f5d3db8d 0B
0cdee6cef059d15149270cfd657f6fddf3fbcb2e 0B
0cdee6cef059d15149270cfd657f6fddf3fbcb2e 0B
0db84228f59db2a2c9654723793992aa023ee07f 0B
0db84228f59db2a2c9654723793992aa023ee07f 0B
0de017af9a2c10fd05be7a1341dac6683255359d 125B
0de017af9a2c10fd05be7a1341dac6683255359d 0B
0e9c12ee775c510e5520d349d6719e89dcb1fe09 0B
0e9c12ee775c510e5520d349d6719e89dcb1fe09 0B
0ed96ded91338cbe1af37d9deba2aef25e731851 0B
0ed96ded91338cbe1af37d9deba2aef25e731851 0B
0f359d75daf1a3d78dab1217efaf7d3dff4a3bce 0B
0f359d75daf1a3d78dab1217efaf7d3dff4a3bce 0B
0ffbdd2e05c5eec2a5f1f4852e9dce00f685cb2d 112B
0ffbdd2e05c5eec2a5f1f4852e9dce00f685cb2d 0B
109c38e71a80f57af2910d6eae66694c9f051baf 0B
109c38e71a80f57af2910d6eae66694c9f051baf 0B
10a03f31c4dce92cb371e761ce9429428bb6c176 0B
10a03f31c4dce92cb371e761ce9429428bb6c176 0B
10a171783479cefb0ab100505c24266598b4b425 112B
10a171783479cefb0ab100505c24266598b4b425 0B
12ab2c3e5faf544961acb81bf7dbb1fe48c536cf 0B
12ab2c3e5faf544961acb81bf7dbb1fe48c536cf 0B
12e962a1ca3254064e0905af0c4f430dac377be2 83B
12e962a1ca3254064e0905af0c4f430dac377be2 0B
12f4b8a7cc1aee13dd9fa824327d5f029730eb34 0B
12f4b8a7cc1aee13dd9fa824327d5f029730eb34 0B
13d58ee82f109abfd3f032074335c0968dd0b59a 4KB
13d58ee82f109abfd3f032074335c0968dd0b59a 0B
13fa70ecfff256b1aa123327c916a8514f90b297 0B
13fa70ecfff256b1aa123327c916a8514f90b297 0B
14474598ac8fddfeab7d8efd6ba7d0adb5d34326 0B
14474598ac8fddfeab7d8efd6ba7d0adb5d34326 0B
146a9276be7f2024afd0ca78152fab769cebd206 0B
146a9276be7f2024afd0ca78152fab769cebd206 0B
14d4fb0c97d8aa532852812e0c31548aeb5b4378 0B
14d4fb0c97d8aa532852812e0c31548aeb5b4378 0B
14f9163762036e1f5cd6f4b31ba7574ddb8c19ef 181B
14f9163762036e1f5cd6f4b31ba7574ddb8c19ef 0B
153d95987d111df3e89e51c443501e2ad9a8dd22 311B
153d95987d111df3e89e51c443501e2ad9a8dd22 0B
15815944264a6a4269db4a93c4053b89bc349eeb 142B
15815944264a6a4269db4a93c4053b89bc349eeb 0B
16421d337257f499cf14f81de319e3625f43b48a 0B
16421d337257f499cf14f81de319e3625f43b48a 0B
1654c224984ae81e70be6b65af74736fca5211cc 0B
1654c224984ae81e70be6b65af74736fca5211cc 0B
16b20eac43b9acec40a0e129ee6220c54b7d6b43 0B
16b20eac43b9acec40a0e129ee6220c54b7d6b43 0B
17c1ca57a04610794a7f47a52813e3e0d4bfbf65 0B
17c1ca57a04610794a7f47a52813e3e0d4bfbf65 0B
17fe689feb350cab41505a03beb69a36d2587b53 0B
17fe689feb350cab41505a03beb69a36d2587b53 0B
188871be5d40eb8728171b34910eb134b35f7d2e 0B
188871be5d40eb8728171b34910eb134b35f7d2e 0B
192d9785bbd4b1dca528e98f6bb7fb69e6b4294d 0B
192d9785bbd4b1dca528e98f6bb7fb69e6b4294d 0B
192e62f5517c1de24025e56ae7d4f9eee7d156e3 0B
199dba1290fbb8149da16f96ebf76dff9dd19543 0B
199dba1290fbb8149da16f96ebf76dff9dd19543 0B
19ef7f6fe85fc6d1ed47bc907c288297d1e7b580 0B
19ef7f6fe85fc6d1ed47bc907c288297d1e7b580 0B
1a0d45d83b82c024a7ec99f868ede9c0b3516064 0B
1a0d45d83b82c024a7ec99f868ede9c0b3516064 0B
1a24bc5224ce38fd18589721322892720faea5ed 541B
1a24bc5224ce38fd18589721322892720faea5ed 0B
共 1542 条
- 1
- 2
- 3
- 4
- 5
- 6
- 16
资源评论
流华追梦
- 粉丝: 1w+
- 资源: 3852
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 022基于多目标灰狼算法的冷热电联供型微网低碳经济调度 matlab代码.rar
- Java毕设项目:基于spring+mybatis+maven+mysql实现的在线教学平台管理系统分前后台【含源码+数据库】
- 零基础学习模拟电路,看懂电阻电容电感的工作原理
- 021基于两阶段鲁棒优化算法的微网多电源容量配置Matlab代码.rar
- 023电-气-热综合能源系统耦合调度、优化调度Matlab代码.rar
- 026-SVM用于分类时的参数优化,粒子群优化算法,用于优化核函数的c,g两个参数(SVM PSO) Matlab代码.rar
- 026SVM用于分类时的参数优化,粒子群优化算法,用于优化核函数的c,g两个参数(SVM PSO)Matlab代码.rar
- 027网架规划 Matlab代码.rar
- 029 基于YALMIP 的微网优化调度模型Matlab代码.rar
- 031基本算法智能微电网粒子群优化算法,微源:光伏、风机、发电机、储能等 matlab代码.rar
- 030 电负荷、热负荷数据Matlab代码.rar
- 032FuzzyMathematicalModel模糊数学模型 matlab代码.rar
- 033CellularAutomata元胞向量机 matlab代码.rar
- 034电力系统机组组合优化 不能运行.rar
- 037Matlab+YALMIP+CPLEX解决带储能的微电网优化调度问题Matlab代码.rar
- 035GoalProgramming(目标规划、多元分析与插值的相关例子) matlab代码.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功