工资单审批,增加规则配置

This commit is contained in:
Harryxzy 2024-04-28 16:58:33 +08:00
parent 4f391a2159
commit d7de02696d
4 changed files with 62 additions and 10 deletions

View File

@ -47,7 +47,10 @@ public class SalaryAcctRecordBO {
List<DataCollectionEmployee> employeeComInfos,
List<SalaryAcctEmployeeCountDTO> salaryAcctEmployeeCountDTOS,
List<SalarySendCheckDTO> salarySendCheckResult,
List<TaxAgentPO> taxAgentPOS) {
List<TaxAgentPO> taxAgentPOS,
List<Long> needApprovalSalarySobIds,
boolean approvalCanFile,
boolean approvalCanReCalc) {
if (CollectionUtils.isEmpty(salaryAcctRecordPOS)) {
return Collections.emptyList();
}
@ -69,16 +72,22 @@ public class SalaryAcctRecordBO {
if(!Objects.equals(salaryAcctRecordPO.getBackCalcStatus(),NumberUtils.INTEGER_ONE)){
btnList.add(new WeaTableOperate("删除", null, "1"));
}
btnList.add(new WeaTableOperate("归档", null, "2"));
if (approvalCanFile || !needApprovalSalarySobIds.contains(salaryAcctRecordPO.getSalarySobId())) {
btnList.add(new WeaTableOperate("归档", null, "2"));
}
} else if (SalaryAcctRecordStatusEnum.ARCHIVED == salaryAcctRecordStatusEnum && ( salarySendMap.get(salaryAcctRecordPO.getId()) ==Boolean.TRUE ) ){
btnList.add(new WeaTableOperate("查看", null, "3"));
btnList.add(new WeaTableOperate("重新核算", null, "4"));
if (approvalCanReCalc || !needApprovalSalarySobIds.contains(salaryAcctRecordPO.getSalarySobId())) {
btnList.add(new WeaTableOperate("重新核算", null, "4"));
}
if(salaryAcctRecordPO.getBackCalcStatus() == null || salaryAcctRecordPO.getBackCalcStatus() == NumberUtils.INTEGER_ZERO) {
btnList.add(new WeaTableOperate("回算", null, "5"));
}
} else {
btnList.add(new WeaTableOperate("查看", null, "3"));
btnList.add(new WeaTableOperate("重新核算", null, "4"));
if (approvalCanReCalc || !needApprovalSalarySobIds.contains(salaryAcctRecordPO.getSalarySobId())) {
btnList.add(new WeaTableOperate("重新核算", null, "4"));
}
}
return SalaryAcctRecordListDTO.builder()
.id(salaryAcctRecordPO.getId())

View File

@ -37,6 +37,7 @@
, t.back_calc_status
, t.lock_salary_item_ids
, t.approval_status
, t.approval_id
</sql>
<!-- 查询全部 -->

View File

@ -145,4 +145,27 @@ public class SalarySysConstant {
* 我的薪资福利工资单个税扣缴义务人显示状态
*/
public static final String TAX_AGENT_SHOW_STATUS = "taxAgentShowStatus";
/**
* 开启核算记录审批功能
*/
public static final String SALARY_APPROVAL_STATUS = "SALARY_APPROVAL_STATUS";
/**
* 开启审批的核算记录允许手动归档
*/
public static final String APPROVAL_CAN_MANUAL_FILE_STATUS = "APPROVAL_CAN_MANUAL_FILE_STATUS";
/**
* 开启审批的核算记录允许重新核算
*/
public static final String APPROVAL_CAN_RE_CALC_STATUS = "APPROVAL_CAN_RE_CALC_STATUS";
/**
* 审批流程发起后允许修改核算数据
*/
public static final String APPROVAL_CAN_EDIT_RESULT_STATUS = "APPROVAL_CAN_EDIT_RESULT_STATUS";
}

View File

@ -18,6 +18,10 @@ import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.*;
import com.engine.salary.service.impl.*;
import com.engine.salary.sys.constant.SalarySysConstant;
import com.engine.salary.sys.entity.po.SalarySysConfPO;
import com.engine.salary.sys.service.SalarySysConfService;
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
@ -74,6 +78,10 @@ public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecord
return ServiceUtil.getService(SalaryApprovalRuleServiceImpl.class, user);
}
private SalarySysConfService getSalarySysConfService(User user) {
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
}
// private ComInfoCache comInfoCache;
public PageInfo<SalaryAcctRecordListDTO> listPage(SalaryAcctRecordQueryParam queryParam) {
@ -93,9 +101,14 @@ public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecord
// 查询薪资账套
Set<Long> salarySobIds = SalaryEntityUtil.properties(list, SalaryAcctRecordPO::getSalarySobId);
List<SalarySobPO> salarySobPOS = getSalarySobService(user).listByIds(salarySobIds);
// 获取这些账套中是否有开启薪资审批的
List<SalaryApprovalRulePO> salaryApprovalRules = getSalaryApprovalRuleService(user).listBySalarySobIds(salarySobIds);
Optional<SalaryApprovalRulePO> existApproval = salaryApprovalRules.stream().filter(po -> po.getOpenApproval().equals(1)).findFirst();
// 规则设置中是否开启薪资审批按钮默认关闭
SalarySysConfPO salaryApprovalStatusConf = getSalarySysConfService(user).getOneByCode(SalarySysConstant.SALARY_APPROVAL_STATUS);
List<Long> needApprovalSalarySobIds = new ArrayList<>();
if (salaryApprovalStatusConf != null && salaryApprovalStatusConf.getConfValue().equals("1")) {
// 开启了薪资审批获取这开启审批的账套id
List<SalaryApprovalRulePO> salaryApprovalRules = getSalaryApprovalRuleService(user).listBySalarySobIds(salarySobIds);
needApprovalSalarySobIds = salaryApprovalRules.stream().filter(po -> po.getOpenApproval().equals(1)).map(SalaryApprovalRulePO::getSalarySobId).collect(Collectors.toList());
}
// 查询薪资核算记录的创建人员的人员信息
List<Long> employeeIds = SalaryEntityUtil.properties(list, SalaryAcctRecordPO::getCreator, Collectors.toList());
List<DataCollectionEmployee> employeeComInfos = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds);
@ -108,15 +121,21 @@ public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecord
Set<Long> taxAgentIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getTaxAgentId);
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds);
// 获取 开启审批的核算记录允许重新核算设置默认开启
SalarySysConfPO approvalCanReCalcFileStatusPO = getSalarySysConfService(user).getOneByCode(SalarySysConstant.APPROVAL_CAN_RE_CALC_STATUS);
boolean approvalCanReCalc = approvalCanReCalcFileStatusPO == null ? true : approvalCanReCalcFileStatusPO.getConfValue().equals("1");
// 获取 开启审批的核算记录允许手动归档默认开启
SalarySysConfPO approvalCanManualFileStatusPO = getSalarySysConfService(user).getOneByCode(SalarySysConstant.APPROVAL_CAN_MANUAL_FILE_STATUS);
boolean approvalCanFile = approvalCanManualFileStatusPO == null ? true : approvalCanManualFileStatusPO.getConfValue().equals("1");
// 转换成列表dto
List<SalaryAcctRecordListDTO> salaryAcctRecordListDTOS = SalaryAcctRecordBO.convert2ListDTO(list, salarySobPOS, employeeComInfos, salaryAcctEmployeeCountDTOS, salarySendCheckResult, taxAgentPOS);
List<SalaryAcctRecordListDTO> salaryAcctRecordListDTOS = SalaryAcctRecordBO.convert2ListDTO(list, salarySobPOS, employeeComInfos, salaryAcctEmployeeCountDTOS, salarySendCheckResult, taxAgentPOS, needApprovalSalarySobIds, approvalCanFile, approvalCanReCalc);
dtoPage.setList(salaryAcctRecordListDTOS);
if (!existApproval.isPresent()) {
// 规则设置中是否开启审批功能默认关闭
if (CollectionUtils.isEmpty(needApprovalSalarySobIds)) {
// 没有开启审批的
List<Column> columnList = dtoPage.getColumns().stream().filter(col -> !col.getKey().equals("approvalStatus")).collect(Collectors.toList());
dtoPage.clearAndSetColumns(columnList);
}
}
// WeaTable<SalaryAcctRecordListDTO> weaTable = SalaryFormatUtil.<SalaryAcctRecordListDTO>getInstance().buildTable(SalaryAcctRecordListDTO.class, dtoPage);
// 只有未归档时可以"核算""删除""归档"