薪酬系统-多语言,优化涉及多语言的pageInfo方法

This commit is contained in:
sy 2023-08-03 18:01:19 +08:00
parent 7c374a58f7
commit 059d3982cc
19 changed files with 54 additions and 28 deletions

View File

@ -861,7 +861,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
queryParam.setOrderRule(orderRule);
List<AddUpDeductionDTO> list = getAddUpDeductionMapper().list(queryParam);
PageInfo<AddUpDeductionDTO> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, AddUpDeductionDTO.class);
PageInfo<AddUpDeductionDTO> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, AddUpDeductionDTO.class, user);
encryptUtil.decryptList(pageInfo.getList(), AddUpDeductionDTO.class, user);
return pageInfo;
}
@ -874,14 +874,14 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
if (needAuth) {
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
return new PageInfo<>(AddUpDeductionRecordDTO.class);
return new PageInfo<>(AddUpDeductionRecordDTO.class, user);
}
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
}
List<AddUpDeductionRecordDTO> list = getAddUpDeductionMapper().recordList(queryParam);
PageInfo<AddUpDeductionRecordDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
list, AddUpDeductionRecordDTO.class);
list, AddUpDeductionRecordDTO.class, user);
encryptUtil.decryptList(page.getList(), AddUpDeductionRecordDTO.class, user);
return page;
}

View File

@ -200,7 +200,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
}
List<AddUpSituationDTO> list = getAddUpSituationMapper().list(queryParam);
PageInfo<AddUpSituationDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, AddUpSituationDTO.class);
PageInfo<AddUpSituationDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, AddUpSituationDTO.class, user);
encryptUtil.decryptList(page.getList(), AddUpSituationDTO.class, user);
return page;
@ -214,7 +214,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
if (needAuth) {
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
return new PageInfo<>(AddUpSituationRecordDTO.class);
return new PageInfo<>(AddUpSituationRecordDTO.class, user);
}
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
}
@ -222,7 +222,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
List<AddUpSituationRecordDTO> list = getAddUpSituationMapper().recordList(queryParam);
PageInfo<AddUpSituationRecordDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
list, AddUpSituationRecordDTO.class);
list, AddUpSituationRecordDTO.class, user);
encryptUtil.decryptList(page.getList(), AddUpSituationRecordDTO.class, user);
return page;
}

View File

@ -93,7 +93,7 @@ public class AttendQuoteServiceImpl extends Service implements AttendQuoteServic
// list.stream().forEach(DTO -> DTO.setCanDelete( !archivedRecords.contains( (SalaryDateUtil.getFormatYearMonth(DTO.getSalaryYearMonth()) + DTO.getSalarySobId().toString()) ) ));
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
list, AttendQuoteListDTO.class);
list, AttendQuoteListDTO.class, user);
}
@Override

View File

@ -54,7 +54,7 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService {
@Override
public PageInfo<ExtEmpPO> listPage(ExtEmpQueryParam param) {
List<ExtEmpPO> extEmpPOS = list(param);
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), extEmpPOS, ExtEmpPO.class);
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), extEmpPOS, ExtEmpPO.class, user);
}

View File

@ -118,7 +118,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
}
List<OtherDeductionListDTO> list = getOtherDeductionMapper().list(queryParam);
PageInfo<OtherDeductionListDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
list, OtherDeductionListDTO.class);
list, OtherDeductionListDTO.class, user);
encryptUtil.decryptList(page.getList(), OtherDeductionListDTO.class, user);
return page;
}
@ -138,13 +138,13 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
if (needAuth) {
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
return new PageInfo<>(OtherDeductionRecordDTO.class);
return new PageInfo<>(OtherDeductionRecordDTO.class, user);
}
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
}
List<OtherDeductionRecordDTO> list = getOtherDeductionMapper().recordList(queryParam);
PageInfo<OtherDeductionRecordDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
list, OtherDeductionRecordDTO.class);
list, OtherDeductionRecordDTO.class, user);
encryptUtil.decryptList(page.getList(), OtherDeductionRecordDTO.class, user);
return page;
}

View File

@ -215,7 +215,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
insuranceSchemePOS = getInsuranceSchemeMapper().listByWelfareType(queryParam.getWelfareTypeEnum().getValue());
}
PageInfo<InsuranceSchemeListDTO> dtoPage = new PageInfo<>(InsuranceSchemeListDTO.class);
PageInfo<InsuranceSchemeListDTO> dtoPage = new PageInfo<>(InsuranceSchemeListDTO.class, user);
dtoPage.setPageNum(queryParam.getCurrent());
dtoPage.setPageSize(queryParam.getPageSize());
dtoPage.setTotal(insuranceSchemePOS.size());

View File

@ -116,7 +116,7 @@ public class SalarySobExtRangeServiceImpl extends Service implements SalarySobEx
@Override
public PageInfo<SalarySobExtRangePO> listPage4Ext(SalarySobRangeQueryParam param) {
List<SalarySobExtRangePO> salarySobRangePOS = getSalarySobExtRangeMapper().listPage4Ext(SalarySobExtRangePO.builder().salarySobId(param.getSalarySobId()).build());
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), salarySobRangePOS, SalarySobExtRangePO.class);
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), salarySobRangePOS, SalarySobExtRangePO.class, user);
}

View File

@ -156,7 +156,7 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
.collect(Collectors.toList());
}
// 填充总数和当页数据
PageInfo<SalarySobRangeListDTO> pageInfo = new PageInfo<SalarySobRangeListDTO>(salarySobRangeListDTOS, SalarySobRangeListDTO.class);
PageInfo<SalarySobRangeListDTO> pageInfo = new PageInfo<SalarySobRangeListDTO>(salarySobRangeListDTOS, SalarySobRangeListDTO.class, user);
pageInfo.setTotal(salarySobRangeListDTOS.size());
pageInfo.setList(SalaryPageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), salarySobRangeListDTOS));
pageInfo.setPageNum(queryParam.getCurrent());

View File

@ -340,7 +340,7 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
.name(queryParam.getName())
.salarySobIds(salarySobIds).build());
} else {
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), salaryTemplateDTOList, SalaryTemplateListDTO.class);
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), salaryTemplateDTOList, SalaryTemplateListDTO.class, user);
}
}else{
// 查询
@ -348,7 +348,7 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
}
// 分页参数
PageInfo<SalaryTemplateListDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), salaryTemplateDTOList, SalaryTemplateListDTO.class);
PageInfo<SalaryTemplateListDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), salaryTemplateDTOList, SalaryTemplateListDTO.class, user);
return page;
}

View File

@ -104,7 +104,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
}
List<SpecialAddDeductionListDTO> list = getSpecialAddDeductionMapper().listByParam(queryParam);
PageInfo<SpecialAddDeductionListDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
list, SpecialAddDeductionListDTO.class);
list, SpecialAddDeductionListDTO.class, user);
encryptUtil.decryptList(page.getList(), SpecialAddDeductionListDTO.class, user);
return page;
}
@ -119,7 +119,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
}
List<SpecialAddDeductionRecordDTO> list = getSpecialAddDeductionMapper().listDtoByParam(queryParam);
PageInfo<SpecialAddDeductionRecordDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
list, SpecialAddDeductionRecordDTO.class);
list, SpecialAddDeductionRecordDTO.class, user);
encryptUtil.decryptList(page.getList(), SpecialAddDeductionRecordDTO.class, user);
return page;
}

View File

@ -255,7 +255,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
List<Long> positionIds = taxAgentManageRanges.stream().filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.POSITION.getValue())).map(TaxAgentManageRangePO::getTargetId).collect(Collectors.toList());
List<PositionInfo> positionComInfos = getSalaryEmployeeService().listPositionInfo(positionIds);
// 分页参数
PageInfo<TaxAgentManageRangeListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxAgentManageRangeListDTO.class);
PageInfo<TaxAgentManageRangeListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxAgentManageRangeListDTO.class, user);
// 查询人员状态
// List<HrmStatus> hrmStatusList = hrmCommonHrmStatusService.list();
// List<HrmStatus> hrmStatusList = UserStatusEnum.getHrmStatusList();
@ -566,7 +566,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
}
List<TaxAgentExtRangePO> taxAgentExtRangePOS = getTaxAgentExtRangeMapper().list(TaxAgentExtRangePO.builder().taxAgentId(param.getTaxAgentId()).build());
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), taxAgentExtRangePOS, TaxAgentExtRangePO.class);
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), taxAgentExtRangePOS, TaxAgentExtRangePO.class, user);
}
@Override

View File

@ -131,7 +131,7 @@ public class TaxDeclarationDetailServiceImpl extends Service implements TaxDecla
}
// 查询个税申报表明细的人员
PageInfo<TaxDeclarationEmployeeDTO> employeeIdPage = listPage4EmployeeIdByParam(queryParam);
PageInfo<TaxDeclarationLaborListDTO> dtoPage = new PageInfo<>(TaxDeclarationLaborListDTO.class);
PageInfo<TaxDeclarationLaborListDTO> dtoPage = new PageInfo<>(TaxDeclarationLaborListDTO.class, user);
dtoPage.setPageSize(employeeIdPage.getPageSize());
dtoPage.setPageNum(employeeIdPage.getPageNum());
dtoPage.setTotal(employeeIdPage.getTotal());
@ -155,7 +155,7 @@ public class TaxDeclarationDetailServiceImpl extends Service implements TaxDecla
}
// 查询个税申报表明细的人员
PageInfo<TaxDeclarationEmployeeDTO> employeeIdPage = listPage4EmployeeIdByParam(queryParam);
PageInfo<TaxDeclarationAnnualListDTO> dtoPage = new PageInfo<>(TaxDeclarationAnnualListDTO.class);
PageInfo<TaxDeclarationAnnualListDTO> dtoPage = new PageInfo<>(TaxDeclarationAnnualListDTO.class, user);
dtoPage.setPageSize(employeeIdPage.getPageSize());
dtoPage.setPageNum(employeeIdPage.getPageNum());
dtoPage.setTotal(employeeIdPage.getTotal());
@ -265,7 +265,7 @@ public class TaxDeclarationDetailServiceImpl extends Service implements TaxDecla
// } else {
employeeIdPage = listPage4EmployeeIdByParam(queryParam);
// }
PageInfo<TaxDeclarationWageListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxDeclarationWageListDTO.class);
PageInfo<TaxDeclarationWageListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxDeclarationWageListDTO.class, user);
dtoPage.setTotal(employeeIdPage.getTotal());
if (CollectionUtils.isNotEmpty(employeeIdPage.getList())) {
List<TaxDeclarationEmployeeDTO> list = employeeIdPage.getList();

View File

@ -40,6 +40,11 @@ public class PageInfo<T> extends com.github.pagehelper.PageInfo<T> {
this.columns = buildColumns();
}
public PageInfo(Class<T> clazz, User user) {
this.clazz = clazz;
this.columns = buildColumns(user);
}
public PageInfo(List<T> list, Class<T> clazz, User user) {
super(list);
this.clazz = clazz;

View File

@ -2,6 +2,7 @@ package com.engine.salary.util.page;
import com.github.pagehelper.PageHelper;
import org.apache.commons.collections4.CollectionUtils;
import weaver.hrm.User;
import java.util.ArrayList;
import java.util.Collections;
@ -37,6 +38,16 @@ public class SalaryPageUtil {
return pageInfo;
}
public static <T> PageInfo<T> buildPage(Integer pageNo, Integer pageSize, Class<T> clazz, User user) {
pageNo = pageNo == null || pageNo <= 0 ? 1 : pageNo;
pageSize = pageSize == null || pageSize <= 0 ? 10 : pageSize;
PageInfo<T> pageInfo = new PageInfo<>(clazz, user);
pageInfo.setPageNum(pageNo);
pageInfo.setPageSize(pageSize);
pageInfo.setList(new ArrayList<>());
return pageInfo;
}
public static <T> PageInfo<T> buildPage(Integer pageNo, Integer pageSize,List<T> totalCollection) {
PageInfo<T> pageInfo = new PageInfo<>();
pageInfo.setTotal(totalCollection.size());
@ -68,6 +79,16 @@ public class SalaryPageUtil {
return pageInfo;
}
public static <T> PageInfo<T> buildPage(Integer pageNo, Integer pageSize, List<T> source, Class<T> clazz, User user) {
pageNo = pageNo == null || pageNo <= 0 ? 1 : pageNo;
pageSize = pageSize == null || pageSize <= 0 ? 10 : pageSize;
PageInfo<T> pageInfo = new PageInfo<>(clazz, user);
pageInfo.setPageNum(pageNo);
pageInfo.setPageSize(pageSize);
pageInfo.setTotal(source == null ? 0 : source.size());
pageInfo.setList(subList(pageNo, pageSize, source));
return pageInfo;
}
/**
* 分页

View File

@ -113,7 +113,7 @@ public class SalaryAcctEmployeeWrapper extends Service {
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds);
// 转换成列表dto
List<SalaryAccEmployeeListDTO> salaryAccEmployeeListDTOS = SalaryAcctEmployeeBO.convert2EmployeeListDTO(list, taxAgentPOS, simpleEmployees, user);
PageInfo<SalaryAccEmployeeListDTO> pageInfo = new PageInfo<SalaryAccEmployeeListDTO>(salaryAccEmployeeListDTOS, SalaryAccEmployeeListDTO.class);
PageInfo<SalaryAccEmployeeListDTO> pageInfo = new PageInfo<SalaryAccEmployeeListDTO>(salaryAccEmployeeListDTOS, SalaryAccEmployeeListDTO.class, user);
pageInfo.setTotal(page.getTotal());
pageInfo.setPageSize(page.getPageSize());
pageInfo.setPageNum(page.getPageNum());

View File

@ -73,7 +73,7 @@ public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecord
getSalarySendService(user).handleHistory();
// 查询薪资核算记录分页
PageInfo<SalaryAcctRecordPO> page = getSalaryAcctRecordService(user).listPageByParam(queryParam);
PageInfo<SalaryAcctRecordListDTO> dtoPage = new PageInfo<SalaryAcctRecordListDTO>(SalaryAcctRecordListDTO.class);
PageInfo<SalaryAcctRecordListDTO> dtoPage = new PageInfo<SalaryAcctRecordListDTO>(SalaryAcctRecordListDTO.class, user);
dtoPage.setPageNum(queryParam.getCurrent());
dtoPage.setPageSize(queryParam.getPageSize());
dtoPage.setTotal(page.getTotal());

View File

@ -91,7 +91,7 @@ public class SalaryItemWrapper extends Service {
List<SalaryItemPO> salaryItemList = page.getList();
//最终返回的分页对象
PageInfo<SalaryItemListDTO> salaryItemListDTOPage = new PageInfo<>(SalaryItemListDTO.class);
PageInfo<SalaryItemListDTO> salaryItemListDTOPage = new PageInfo<>(SalaryItemListDTO.class, user);
salaryItemListDTOPage.setPageSize(page.getPageSize());
salaryItemListDTOPage.setPageNum(page.getPageNum());
salaryItemListDTOPage.setTotal(page.getTotal());

View File

@ -84,7 +84,7 @@ public class SalarySobWrapper extends Service {
Map<Long, String> taxAgentIdTONameMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgentPO::getId, TaxAgentPO::getName);
List<SalarySobListDTO> salarySobListDTOS = SalarySobBO.convert2ListDTO(page.getList(),taxAgentIdTONameMap, user);
PageInfo<SalarySobListDTO> dtoPage = new PageInfo<>(salarySobListDTOS, SalarySobListDTO.class);
PageInfo<SalarySobListDTO> dtoPage = new PageInfo<>(salarySobListDTOS, SalarySobListDTO.class, user);
dtoPage.setTotal(page.getTotal());
dtoPage.setPageNum(page.getPageNum());
dtoPage.setPageSize(page.getPageSize());

View File

@ -63,7 +63,7 @@ public class TaxDeclarationWrapper extends Service {
public PageInfo listPage(TaxDeclarationListQueryParam queryParam) {
// 询个税申报表分页
PageInfo<TaxDeclarationPO> page = getTaxDeclarationService(user).listPageByParam(queryParam);
PageInfo<TaxDeclarationListDTO> dtoPage = new PageInfo<TaxDeclarationListDTO>(TaxDeclarationListDTO.class);
PageInfo<TaxDeclarationListDTO> dtoPage = new PageInfo<TaxDeclarationListDTO>(TaxDeclarationListDTO.class, user);
dtoPage.setPageNum(queryParam.getCurrent());
dtoPage.setPageSize(queryParam.getPageSize());
dtoPage.setTotal(page.getTotal());