2022-07-04 19:21:44 +08:00
|
|
|
package com.engine.salary.service.impl;
|
|
|
|
|
|
2022-11-07 11:31:21 +08:00
|
|
|
import com.engine.common.util.ServiceUtil;
|
2022-07-04 19:21:44 +08:00
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.salary.encrypt.AESEncryptUtil;
|
2022-12-13 13:34:22 +08:00
|
|
|
import com.engine.salary.encrypt.EncryptUtil;
|
2022-07-11 17:31:33 +08:00
|
|
|
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
|
|
|
|
|
import com.engine.salary.mapper.report.SalaryAcctResultReportMapper;
|
2022-07-04 19:21:44 +08:00
|
|
|
import com.engine.salary.service.SalaryAcctReportService;
|
2022-11-07 11:31:21 +08:00
|
|
|
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
|
|
|
|
import com.engine.salary.sys.enums.OpenEnum;
|
|
|
|
|
import com.engine.salary.sys.service.SalarySysConfService;
|
|
|
|
|
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
2022-07-11 17:31:33 +08:00
|
|
|
import com.engine.salary.util.db.MapperProxyFactory;
|
2023-11-20 10:56:03 +08:00
|
|
|
import com.google.common.collect.Lists;
|
2022-07-11 17:31:33 +08:00
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
2022-11-07 11:31:21 +08:00
|
|
|
import weaver.hrm.User;
|
2022-07-04 19:21:44 +08:00
|
|
|
|
2022-12-13 13:34:22 +08:00
|
|
|
import java.util.ArrayList;
|
2022-07-11 17:31:33 +08:00
|
|
|
import java.util.Collection;
|
2022-07-04 19:21:44 +08:00
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
2022-11-07 11:31:21 +08:00
|
|
|
import static com.engine.salary.sys.constant.SalarySysConstant.DISPLAY_EMP_INFO_REPORT;
|
|
|
|
|
|
2022-07-04 19:21:44 +08:00
|
|
|
/**
|
2022-07-05 15:04:00 +08:00
|
|
|
* 薪资报表
|
2022-07-04 19:21:44 +08:00
|
|
|
* <p>Copyright: Copyright (c) 2022</p>
|
|
|
|
|
* <p>Company: 泛微软件</p>
|
|
|
|
|
*
|
|
|
|
|
* @author qiantao
|
|
|
|
|
* @version 1.0
|
|
|
|
|
**/
|
2022-07-05 15:04:00 +08:00
|
|
|
public class SalaryAcctReportServiceImpl extends Service implements SalaryAcctReportService {
|
2022-12-13 13:34:22 +08:00
|
|
|
private EncryptUtil encryptUtil = new EncryptUtil();
|
2022-07-11 17:31:33 +08:00
|
|
|
private SalaryAcctResultReportMapper getSalaryAcctResultReportMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(SalaryAcctResultReportMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-07 11:31:21 +08:00
|
|
|
|
|
|
|
|
private SalarySysConfService getSalarySysConfService(User user) {
|
|
|
|
|
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-11 17:31:33 +08:00
|
|
|
/**
|
|
|
|
|
* 保存核算报表数据
|
|
|
|
|
*
|
|
|
|
|
* @param pos
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void batchSave(Collection<SalaryAcctResultReportPO> pos) {
|
|
|
|
|
if (CollectionUtils.isNotEmpty(pos)) {
|
2022-11-07 11:31:21 +08:00
|
|
|
SalarySysConfPO disPlay = getSalarySysConfService(user).getOneByCode(DISPLAY_EMP_INFO_REPORT);
|
|
|
|
|
//默认不显示,关闭状态
|
|
|
|
|
if (disPlay == null || OpenEnum.OFF.getValue().equals(disPlay.getConfValue())) {
|
2022-12-13 13:34:22 +08:00
|
|
|
pos = encryptUtil.encryptList(new ArrayList<>(pos), SalaryAcctResultReportPO.class);
|
2022-11-07 11:31:21 +08:00
|
|
|
}
|
2022-08-16 10:39:45 +08:00
|
|
|
// List<List<SalaryAcctResultReportPO>> partition = Lists.partition((List) pos, 100);
|
|
|
|
|
// partition.forEach(getSalaryAcctResultReportMapper()::batchInsert);
|
|
|
|
|
|
|
|
|
|
pos.forEach(getSalaryAcctResultReportMapper()::insertIgnoreNull);
|
2022-07-11 17:31:33 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void deleteBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds) {
|
|
|
|
|
if (CollectionUtils.isNotEmpty(salaryAcctRecordIds)) {
|
2022-07-11 18:24:12 +08:00
|
|
|
getSalaryAcctResultReportMapper().deleteBySalaryAcctRecordIds(salaryAcctRecordIds);
|
2022-07-11 17:31:33 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void deleteBySalaryAcctRecordId(Long salaryAcctRecordId) {
|
|
|
|
|
getSalaryAcctResultReportMapper().deleteBySalaryAcctRecordId(salaryAcctRecordId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void deleteBySalaryAcctEmpIds(Collection<Long> salaryAcctEmpIds) {
|
|
|
|
|
if (CollectionUtils.isNotEmpty(salaryAcctEmpIds)) {
|
|
|
|
|
List<String> collect = salaryAcctEmpIds.stream().map(e -> AESEncryptUtil.encrypt(e.toString())).collect(Collectors.toList());
|
|
|
|
|
getSalaryAcctResultReportMapper().deleteBySalaryAcctEmpIds(collect);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2023-11-20 10:56:03 +08:00
|
|
|
public void deleteByAcctEmployeeIdsAndSalaryItemIds(List<Long> salaryAcctEmployeeIds, Collection<Long> salaryItemIds) {
|
2022-07-11 17:31:33 +08:00
|
|
|
if (CollectionUtils.isNotEmpty(salaryAcctEmployeeIds) && CollectionUtils.isNotEmpty(salaryItemIds)) {
|
|
|
|
|
List<String> salaryAcctEmployeeIdsStr = salaryAcctEmployeeIds.stream().map(e -> AESEncryptUtil.encrypt(e.toString())).collect(Collectors.toList());
|
2023-11-20 10:56:03 +08:00
|
|
|
List<List<String>> partition = Lists.partition(salaryAcctEmployeeIdsStr, 300);
|
|
|
|
|
partition.forEach(part -> getSalaryAcctResultReportMapper().deleteByAcctEmpIdsAndSalaryItemIds(part, salaryItemIds));
|
2022-07-11 17:31:33 +08:00
|
|
|
}
|
|
|
|
|
}
|
2022-07-04 19:21:44 +08:00
|
|
|
}
|