档案项目默认生效时间取起始缴纳日期

This commit is contained in:
钱涛 2022-11-03 19:32:51 +08:00
parent 25d87c3480
commit f1f8ae53af
4 changed files with 49 additions and 18 deletions

View File

@ -7,7 +7,6 @@ import com.engine.salary.entity.hrm.SubCompanyInfo;
import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
import com.engine.salary.mapper.datacollection.EmployMapper;
import com.google.common.collect.Lists;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
@ -113,7 +112,12 @@ public class EmployBiz extends BaseBean {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.listByParams(includeQueryParams);
List<DataCollectionEmployee> emps = new ArrayList<>();
List<List<SalarySobRangeEmpQueryParam>> partition = Lists.partition(includeQueryParams, 100);
partition.forEach(list->{
emps.addAll(mapper.listByParams(list));
});
return emps;
} finally {
sqlSession.close();
}

View File

@ -396,6 +396,14 @@ public class SalaryArchiveExcelBO extends Service {
Long taxAgentId = optionalTaxAgent.map(TaxAgentManageRangeEmployeeDTO::getTaxAgentId).orElse(null);
List<Long> finalEmployeeSameIds = employeeSameIds;
if (!optionalTaxAgent.isPresent()) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowindex + "个税扣缴义务人不存在");
excelComments.add(errorMessageMap);
// SalaryArchiveExcelBO.createExcelComment(excelComments, taxAgentRangeMsg, errorCount + 1, errorCount + 1, 0, 0);
isError = true;
return isError;
}
Optional<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> optionalTaxAgentEmp = optionalTaxAgent.get().getEmployeeList().stream().filter(f -> finalEmployeeSameIds.contains(f.getEmployeeId())).findFirst();
if (!optionalTaxAgentEmp.isPresent()) {
Map<String, String> errorMessageMap = Maps.newHashMap();
@ -428,6 +436,10 @@ public class SalaryArchiveExcelBO extends Service {
map.put(payStartDateI18n, payStartDateCellVal);
map.put("payStartDate", payStartDateCellVal);
Date payStartDate = SalaryDateUtil.checkDay(payStartDateCellVal) ? SalaryDateUtil.dateStrToLocalDate(payStartDateCellVal) : null;
//生效日期默认取起始发薪日期
if (effectiveTime == null) {
effectiveTime = payStartDate;
}
// 6.最后发薪日期
String payEndDateCellVal = Optional.ofNullable(map.get(payEndDateI18n)).orElse("").toString().replaceAll(" 00:00:00", "");
// 免得失败后会追加 00:00:00

View File

@ -486,7 +486,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
// salaryEmployees = salaryEmployees.stream().filter(salaryEmployee -> employeeIdsInTaxAgent.contains(salaryEmployee.getEmployeeId())).collect(Collectors.toList());
// 查询薪资档案获取人员的个税扣缴义务人
Set<Long> employeeIds = SalaryEntityUtil.properties(salaryEmployees, DataCollectionEmployee::getEmployeeId);
List<Long> employeeIds = SalaryEntityUtil.properties(salaryEmployees, DataCollectionEmployee::getEmployeeId,Collectors.toList());
List<SalaryArchiveDataDTO> salaryArchiveDataDTOS = getSalaryArchiveService(user).getSalaryArchiveTaxAgentData(salarySobCycleDTO.getSalaryCycle(), employeeIds, taxAgentId);
// 转换成薪资核算人员po
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = SalaryAcctEmployeeBO.convert2EmployeePO(employeeIds, salaryAcctRecordPO, salaryArchiveDataDTOS, (long) user.getUID());
@ -507,7 +507,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) {
return;
}
Set<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId);
List<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId,Collectors.toList());
// 查询薪资核算记录
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(salaryAcctRecordId);
if (Objects.isNull(salaryAcctRecordPO)) {

View File

@ -130,6 +130,28 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
@Override
public List<SalaryArchivePO> listSome(SalaryArchivePO po) {
Collection<Long> ids = po.getIds();
if(CollectionUtils.isNotEmpty(ids)){
List<SalaryArchivePO> list = new ArrayList<>();
List<List<Long>> partition = Lists.partition((List<Long>) ids, 1000);
partition.forEach(idss->{
po.setIds(idss);
list.addAll(getSalaryArchiveMapper().listSome(po));
});
return list;
}
Collection<Long> employeeIds = po.getEmployeeIds();
if(CollectionUtils.isNotEmpty(employeeIds)){
List<SalaryArchivePO> list = new ArrayList<>();
List<List<Long>> partition = Lists.partition((List<Long>) employeeIds, 1000);
partition.forEach(emps->{
po.setEmployeeIds(emps);
list.addAll(getSalaryArchiveMapper().listSome(po));
});
return list;
}
// 获取薪资档案数据
return getSalaryArchiveMapper().listSome(po);
}
@ -698,7 +720,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
*/
private List<SalaryArchiveDataDTO> getSalaryArchiveData(LocalDateRange localDateRange, Collection<Long> employeeIds, Long taxAgentId, boolean isOnlyTaxAgent) {
// 获取薪资档案数据
List<SalaryArchivePO> salaryArchiveList = getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().runStatusList(Arrays.asList(SalaryArchiveStatusEnum.FIXED.getValue(), SalaryArchiveStatusEnum.SUSPEND.getValue())).employeeIds(employeeIds).taxAgentId(taxAgentId).build());
List<SalaryArchivePO> salaryArchiveList = listSome(SalaryArchivePO.builder().runStatusList(Arrays.asList(SalaryArchiveStatusEnum.FIXED.getValue(), SalaryArchiveStatusEnum.SUSPEND.getValue())).employeeIds(employeeIds).taxAgentId(taxAgentId).build());
List<Long> allEmployeeIds = salaryArchiveList.stream().map(SalaryArchivePO::getEmployeeId).distinct().collect(Collectors.toList());
// 获取所有可被引用的薪资项目
@ -1084,8 +1106,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
}
List<SalaryArchivePO> oldList = getSalaryArchiveMapper()
.listSome(SalaryArchivePO.builder()
List<SalaryArchivePO> oldList = listSome(SalaryArchivePO.builder()
.ids(ids)
.runStatus(SalaryArchiveStatusEnum.PENDING.getValue())
.build());
@ -1107,12 +1128,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录"));
}
List<SalaryArchivePO> salaryArchiveList = new ArrayList<>();
List<Long> salaryArchivesIds = (List<Long>) ids;
List<List<Long>> partition = Lists.partition(salaryArchivesIds, 1000);
partition.forEach(list -> {
salaryArchiveList.addAll(getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().ids(list).runStatus(SalaryArchiveStatusEnum.PENDING.getValue()).build()));
});
List<SalaryArchivePO> salaryArchiveList = listSome(SalaryArchivePO.builder().ids(ids).runStatus(SalaryArchiveStatusEnum.PENDING.getValue()).build());
if (CollectionUtils.isEmpty(salaryArchiveList)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "档案不存在!"));
@ -1128,6 +1144,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
}
// 从待定薪到定薪
List<List<Long>> partition = Lists.partition((List<Long>) ids, 1000);
partition.forEach(getSalaryArchiveMapper()::gotoFixed);
// 获取所有可被引用的薪资项目
@ -1174,8 +1191,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
if (CollectionUtils.isEmpty(ids)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录"));
}
List<SalaryArchivePO> oldList = getSalaryArchiveMapper()
.listSome(SalaryArchivePO.builder()
List<SalaryArchivePO> oldList = listSome(SalaryArchivePO.builder()
.ids(ids)
.runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue())
.build());
@ -1224,8 +1240,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
}
List<SalaryArchivePO> oldList = getSalaryArchiveMapper()
.listSome(SalaryArchivePO.builder()
List<SalaryArchivePO> oldList = listSome(SalaryArchivePO.builder()
.ids(ids)
.runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue())
.build());
@ -1245,7 +1260,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
}
List<SalaryArchivePO> oldList = getSalaryArchiveMapper().listSome(
List<SalaryArchivePO> oldList = listSome(
SalaryArchivePO.builder()
.ids(ids)
.runStatusList(Arrays.asList(SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue(), SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue()))