diff --git a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctRecordBO.java b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctRecordBO.java index 55a69af74..ad98f4ad7 100644 --- a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctRecordBO.java +++ b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctRecordBO.java @@ -47,7 +47,10 @@ public class SalaryAcctRecordBO { List employeeComInfos, List salaryAcctEmployeeCountDTOS, List salarySendCheckResult, - List taxAgentPOS) { + List taxAgentPOS, + List 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()) diff --git a/src/com/engine/salary/mapper/salaryacct/SalaryAcctRecordMapper.xml b/src/com/engine/salary/mapper/salaryacct/SalaryAcctRecordMapper.xml index 8131f7759..00507de99 100644 --- a/src/com/engine/salary/mapper/salaryacct/SalaryAcctRecordMapper.xml +++ b/src/com/engine/salary/mapper/salaryacct/SalaryAcctRecordMapper.xml @@ -37,6 +37,7 @@ , t.back_calc_status , t.lock_salary_item_ids , t.approval_status + , t.approval_id diff --git a/src/com/engine/salary/sys/constant/SalarySysConstant.java b/src/com/engine/salary/sys/constant/SalarySysConstant.java index ff055b89e..02fcf2590 100644 --- a/src/com/engine/salary/sys/constant/SalarySysConstant.java +++ b/src/com/engine/salary/sys/constant/SalarySysConstant.java @@ -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"; } diff --git a/src/com/engine/salary/wrapper/SalaryAcctRecordWrapper.java b/src/com/engine/salary/wrapper/SalaryAcctRecordWrapper.java index a42f6d5cf..0e95a70b7 100644 --- a/src/com/engine/salary/wrapper/SalaryAcctRecordWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryAcctRecordWrapper.java @@ -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 listPage(SalaryAcctRecordQueryParam queryParam) { @@ -93,9 +101,14 @@ public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecord // 查询薪资账套 Set salarySobIds = SalaryEntityUtil.properties(list, SalaryAcctRecordPO::getSalarySobId); List salarySobPOS = getSalarySobService(user).listByIds(salarySobIds); - // 获取这些账套中是否有开启薪资审批的 - List salaryApprovalRules = getSalaryApprovalRuleService(user).listBySalarySobIds(salarySobIds); - Optional existApproval = salaryApprovalRules.stream().filter(po -> po.getOpenApproval().equals(1)).findFirst(); + // 规则设置中是否开启薪资审批按钮,默认关闭 + SalarySysConfPO salaryApprovalStatusConf = getSalarySysConfService(user).getOneByCode(SalarySysConstant.SALARY_APPROVAL_STATUS); + List needApprovalSalarySobIds = new ArrayList<>(); + if (salaryApprovalStatusConf != null && salaryApprovalStatusConf.getConfValue().equals("1")) { + // 开启了薪资审批,获取这开启审批的账套id + List salaryApprovalRules = getSalaryApprovalRuleService(user).listBySalarySobIds(salarySobIds); + needApprovalSalarySobIds = salaryApprovalRules.stream().filter(po -> po.getOpenApproval().equals(1)).map(SalaryApprovalRulePO::getSalarySobId).collect(Collectors.toList()); + } // 查询薪资核算记录的创建人员的人员信息 List employeeIds = SalaryEntityUtil.properties(list, SalaryAcctRecordPO::getCreator, Collectors.toList()); List employeeComInfos = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds); @@ -108,15 +121,21 @@ public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecord Set taxAgentIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getTaxAgentId); List 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 salaryAcctRecordListDTOS = SalaryAcctRecordBO.convert2ListDTO(list, salarySobPOS, employeeComInfos, salaryAcctEmployeeCountDTOS, salarySendCheckResult, taxAgentPOS); + List salaryAcctRecordListDTOS = SalaryAcctRecordBO.convert2ListDTO(list, salarySobPOS, employeeComInfos, salaryAcctEmployeeCountDTOS, salarySendCheckResult, taxAgentPOS, needApprovalSalarySobIds, approvalCanFile, approvalCanReCalc); dtoPage.setList(salaryAcctRecordListDTOS); - if (!existApproval.isPresent()) { + // 规则设置中是否开启审批功能,默认关闭 + if (CollectionUtils.isEmpty(needApprovalSalarySobIds)) { // 没有开启审批的 List columnList = dtoPage.getColumns().stream().filter(col -> !col.getKey().equals("approvalStatus")).collect(Collectors.toList()); dtoPage.clearAndSetColumns(columnList); } - } // WeaTable weaTable = SalaryFormatUtil.getInstance().buildTable(SalaryAcctRecordListDTO.class, dtoPage); // 只有未归档时可以"核算"、"删除"、"归档"