weaver-hrm-salary/src/com/engine/salary/biz/EmployBiz.java

248 lines
8.7 KiB
Java
Raw Normal View History

2022-03-10 17:57:46 +08:00
package com.engine.salary.biz;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
2022-05-24 09:14:26 +08:00
import com.engine.salary.entity.hrm.DeptInfo;
2022-03-23 18:41:38 +08:00
import com.engine.salary.entity.hrm.PositionInfo;
2022-05-24 09:14:26 +08:00
import com.engine.salary.entity.hrm.SubCompanyInfo;
2022-04-07 16:54:10 +08:00
import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
2022-03-10 17:57:46 +08:00
import com.engine.salary.mapper.datacollection.EmployMapper;
2022-08-02 17:57:29 +08:00
import com.google.common.collect.Lists;
2022-08-02 10:59:12 +08:00
import org.apache.commons.collections4.CollectionUtils;
2022-03-10 17:57:46 +08:00
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import weaver.general.BaseBean;
2022-08-02 17:57:29 +08:00
import java.util.ArrayList;
2024-03-22 15:23:03 +08:00
import java.util.Collections;
2022-03-10 17:57:46 +08:00
import java.util.List;
public class EmployBiz extends BaseBean {
2023-04-12 15:27:35 +08:00
public List<DataCollectionEmployee> listAll(){
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.listAll();
} finally {
sqlSession.close();
}
}
2022-03-10 17:57:46 +08:00
/**
* 查询人员列表
*
* @return
*/
public List<DataCollectionEmployee> listEmployee() {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.listEmployee();
} finally {
sqlSession.close();
}
}
public List<DataCollectionEmployee> getEmployeeByIds(List<Long> list) {
2022-08-02 10:59:12 +08:00
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
2022-03-10 17:57:46 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
2022-08-02 17:57:29 +08:00
List<DataCollectionEmployee> dataList = new ArrayList<>();
2022-03-10 17:57:46 +08:00
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
2022-08-02 17:57:29 +08:00
List<List<Long>> partition = Lists.partition(list, 1000);
for (List<Long> longs : partition) {
dataList.addAll(mapper.getEmployeeByIds(longs));
}
return dataList;
2022-03-10 17:57:46 +08:00
} finally {
sqlSession.close();
}
}
2022-03-15 17:39:19 +08:00
2024-06-26 11:33:12 +08:00
public List<DataCollectionEmployee> getEmployeeByIdsIncludeAccountType(List<Long> list) {
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
List<DataCollectionEmployee> dataList = new ArrayList<>();
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
List<List<Long>> partition = Lists.partition(list, 1000);
for (List<Long> longs : partition) {
dataList.addAll(mapper.getEmployeeByIdsIncludeAccountType(longs));
}
return dataList;
} finally {
sqlSession.close();
}
}
2022-03-15 17:39:19 +08:00
public List<DataCollectionEmployee> getEmployeeByIdsAll(List<Long> list) {
2022-08-02 10:59:12 +08:00
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
2022-03-15 17:39:19 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
2022-08-02 17:57:29 +08:00
List<DataCollectionEmployee> employeeList = new ArrayList<>();
2022-03-15 17:39:19 +08:00
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
2022-08-02 17:57:29 +08:00
List<List<Long>> partition = Lists.partition(list, 1000);
2022-08-02 10:59:12 +08:00
partition.forEach(e->{
List<DataCollectionEmployee> employeeByIdsAll = mapper.getEmployeeByIdsAll(e);
employeeList.addAll(employeeByIdsAll);
});
2022-08-02 17:57:29 +08:00
return employeeList;
2022-03-15 17:39:19 +08:00
} finally {
sqlSession.close();
}
}
2022-03-23 18:41:38 +08:00
/**
* 岗位信息
2022-08-02 10:59:12 +08:00
*
2022-03-23 18:41:38 +08:00
* @param list
* @return
*/
public List<PositionInfo> listPositionInfo(List<Long> list) {
2022-08-02 10:59:12 +08:00
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
2022-03-23 18:41:38 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.listPositionInfo(list);
} finally {
sqlSession.close();
}
}
2022-04-07 16:54:10 +08:00
2024-07-25 14:04:14 +08:00
public PositionInfo getPositionInfoById(Long positionId) {
if (positionId == null) {
return null;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.getPositionInfoById(positionId);
} finally {
sqlSession.close();
}
}
2022-04-07 16:54:10 +08:00
public List<DataCollectionEmployee> listByParams(List<SalarySobRangeEmpQueryParam> includeQueryParams) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
List<DataCollectionEmployee> emps = new ArrayList<>();
List<List<SalarySobRangeEmpQueryParam>> partition = Lists.partition(includeQueryParams, 100);
partition.forEach(list->{
emps.addAll(mapper.listByParams(list));
});
return emps;
2022-04-07 16:54:10 +08:00
} finally {
2024-03-22 15:23:03 +08:00
sqlSession.close();
}
}
public List<DataCollectionEmployee> listByVirtualParams(List<SalarySobRangeEmpQueryParam> virtualQueryParams) {
if (CollectionUtils.isEmpty(virtualQueryParams)) {
return Collections.emptyList();
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
List<DataCollectionEmployee> emps = new ArrayList<>();
List<List<SalarySobRangeEmpQueryParam>> partition = Lists.partition(virtualQueryParams, 100);
partition.forEach(list->{
emps.addAll(mapper.listByVirtualParams(list));
});
return emps;
} finally {
2022-04-07 16:54:10 +08:00
sqlSession.close();
}
}
2022-04-08 19:08:59 +08:00
public DataCollectionEmployee getEmployeeById(Long employeeId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.getEmployeeById(employeeId);
} finally {
sqlSession.close();
}
}
2022-05-24 09:14:26 +08:00
2022-08-02 10:59:12 +08:00
public List<DeptInfo> getDeptInfoList(List<Long> list) {
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
2022-05-24 09:14:26 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
2022-08-02 10:59:12 +08:00
return mapper.getDeptInfoList(list);
2022-05-24 09:14:26 +08:00
} finally {
sqlSession.close();
}
}
2022-08-02 10:59:12 +08:00
public List<SubCompanyInfo> getSubCompanyInfoList(List<Long> list) {
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
2022-05-24 09:14:26 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
2022-08-02 10:59:12 +08:00
return mapper.getSubCompanyInfoList(list);
2022-05-24 09:14:26 +08:00
} finally {
sqlSession.close();
}
}
2023-04-12 15:27:35 +08:00
2024-07-25 14:04:14 +08:00
public SubCompanyInfo getSubCompanyInfoById(Long subCompanyId) {
if (subCompanyId == null) {
return null;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.getSubCompanyInfoById(subCompanyId);
} finally {
sqlSession.close();
}
}
2023-04-12 15:27:35 +08:00
public List<DataCollectionEmployee> listAllForReport() {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.listAllForReport();
} finally {
sqlSession.close();
}
}
2023-08-30 10:41:00 +08:00
public List<DataCollectionEmployee> listByDismissDate(String dismissDate) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.listByDismissDate(dismissDate);
} finally {
sqlSession.close();
}
}
2024-07-25 14:04:14 +08:00
public DeptInfo getDeptInfoById(Long departmentId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.getDeptInfoById(departmentId);
} finally {
sqlSession.close();
}
}
2022-03-10 17:57:46 +08:00
}