京贵投资二开 - 可配置薪资核算记录 某些员工不可删除

This commit is contained in:
Harryxzy 2024-11-11 18:14:32 +08:00
parent bb7d21eb25
commit 9b8920af21
5 changed files with 10 additions and 24 deletions

View File

@ -15,7 +15,6 @@ import com.google.common.collect.Sets;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.general.BaseBean;
import weaver.general.Util;
import java.util.*;
@ -47,11 +46,6 @@ public class SalaryAcctEmployeeBO {
}
Map<Long, String> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName);
Map<Long, DataCollectionEmployee> simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId);
BaseBean baseBean = new BaseBean();
// 京贵投资二开 - 人员确认页面不能删除的人
String cannotDeleteEmpIdStr = baseBean.getPropValue("jgtzSalaryAcct", "cannot_delete_emp_ids");
List<Long> cannotDeleteEmpIds = Arrays.stream(cannotDeleteEmpIdStr.split(",")).filter(NumberUtils::isCreatable).map(Long::valueOf).collect(Collectors.toList());
return salaryAccountingEmployees.stream()
.map(e -> {
DataCollectionEmployee simpleEmployee = simpleEmployeeMap.get(e.getEmployeeId());
@ -76,7 +70,6 @@ public class SalaryAcctEmployeeBO {
.jobNum(simpleEmployee.getWorkcode())
.hireDate(simpleEmployee.getCompanystartdate())
.dismissDate(simpleEmployee.getDismissdate())
.canDelete(!cannotDeleteEmpIds.contains(e.getEmployeeId()))
.build();
}).collect(Collectors.toList());
}

View File

@ -19,6 +19,8 @@ import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.general.BaseBean;
import weaver.hrm.User;
import java.util.*;
import java.util.stream.Collectors;
@ -47,7 +49,8 @@ public class SalaryAcctRecordBO {
List<DataCollectionEmployee> employeeComInfos,
List<SalaryAcctEmployeeCountDTO> salaryAcctEmployeeCountDTOS,
List<SalarySendCheckDTO> salarySendCheckResult,
List<TaxAgentPO> taxAgentPOS) {
List<TaxAgentPO> taxAgentPOS,
User user) {
if (CollectionUtils.isEmpty(salaryAcctRecordPOS)) {
return Collections.emptyList();
}
@ -56,6 +59,10 @@ public class SalaryAcctRecordBO {
Map<Long, Long> empSizeMap = SalaryEntityUtil.convert2Map(salaryAcctEmployeeCountDTOS, SalaryAcctEmployeeCountDTO::getSalaryAcctRecordId, SalaryAcctEmployeeCountDTO::getCountBySalaryAcctRecordId);
Map<Long, Boolean> salarySendMap = SalaryEntityUtil.convert2Map(salarySendCheckResult, SalarySendCheckDTO::getSalaryAcctId, SalarySendCheckDTO::isSendFinished);
Map<Long, String> taxAgentMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgentPO::getId, TaxAgentPO::getName);
BaseBean baseBean = new BaseBean();
// 京贵投资二开 - 人员确认页面不能删除的人
String cannotDeleteEmpIdStr = baseBean.getPropValue("jgtzSalaryAcct", "cannot_delete_emp_ids");
List<Integer> cannotDeleteEmpIds = Arrays.stream(cannotDeleteEmpIdStr.split(",")).filter(NumberUtils::isCreatable).map(Integer::valueOf).collect(Collectors.toList());
return salaryAcctRecordPOS.stream()
.map(salaryAcctRecordPO -> {
SalarySobPO salarySobPO = salarySobMap.get(salaryAcctRecordPO.getSalarySobId());
@ -66,7 +73,7 @@ public class SalaryAcctRecordBO {
List<WeaTableOperate> btnList = new ArrayList<>();
if (SalaryAcctRecordStatusEnum.NOT_ARCHIVED == salaryAcctRecordStatusEnum) {
btnList.add(new WeaTableOperate("核算", null, "0"));
if(!Objects.equals(salaryAcctRecordPO.getBackCalcStatus(),NumberUtils.INTEGER_ONE)){
if(!Objects.equals(salaryAcctRecordPO.getBackCalcStatus(),NumberUtils.INTEGER_ONE) && !cannotDeleteEmpIds.contains(user.getUID())){
btnList.add(new WeaTableOperate("删除", null, "1"));
}
btnList.add(new WeaTableOperate("归档", null, "2"));

View File

@ -68,7 +68,4 @@ public class SalaryAccEmployeeListDTO {
//离职日期
// @TableTitle(title = "离职日期", dataIndex = "dismissDate", key = "dismissDate")
private String dismissDate;
// 是否可删除
private Boolean canDelete;
}

View File

@ -43,9 +43,7 @@ import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.BeanUtils;
import weaver.general.BaseBean;
import weaver.hrm.User;
import java.util.*;
@ -499,15 +497,6 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98830, "薪资核算人员不存在或已被删除"));
}
// 京贵投资二开 - 人员确认页面不能删除的人
BaseBean baseBean = new BaseBean();
String cannotDeleteEmpIdStr = baseBean.getPropValue("jgtzSalaryAcct", "cannot_delete_emp_ids");
List<Long> cannotDeleteEmpIds = Arrays.stream(cannotDeleteEmpIdStr.split(",")).filter(NumberUtils::isCreatable).map(Long::valueOf).collect(Collectors.toList());
Optional<SalaryAcctEmployeePO> cannotDeleteOptional = salaryAcctEmployeePOS.stream().filter(acctEmp -> cannotDeleteEmpIds.contains(acctEmp.getEmployeeId())).findFirst();
if (cannotDeleteOptional.isPresent()) {
throw new SalaryRunTimeException("删除失败!存在不可删除的核算人员");
}
// 删除薪资核算人员
Set<Long> ids = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId);
deleteByIds(ids);

View File

@ -115,7 +115,7 @@ public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecord
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds);
// 转换成列表dto
List<SalaryAcctRecordListDTO> salaryAcctRecordListDTOS = SalaryAcctRecordBO.convert2ListDTO(list, salarySobPOS, employeeComInfos, salaryAcctEmployeeCountDTOS, salarySendCheckResult, taxAgentPOS);
List<SalaryAcctRecordListDTO> salaryAcctRecordListDTOS = SalaryAcctRecordBO.convert2ListDTO(list, salarySobPOS, employeeComInfos, salaryAcctEmployeeCountDTOS, salarySendCheckResult, taxAgentPOS, user);
dtoPage.setList(salaryAcctRecordListDTOS);
}
// WeaTable<SalaryAcctRecordListDTO> weaTable = SalaryFormatUtil.<SalaryAcctRecordListDTO>getInstance().buildTable(SalaryAcctRecordListDTO.class, dtoPage);