人员明细列表展示账套和核算记录信息、自定义列功能

This commit is contained in:
钱涛 2023-05-26 11:17:25 +08:00
parent ecdfc0c957
commit fef828ef1d
6 changed files with 64 additions and 20 deletions

View File

@ -4,9 +4,12 @@ import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.mapper.salaryacct.SalaryAcctEmployeeMapper;
import com.engine.salary.report.common.constant.SalaryConstant;
import com.engine.salary.report.entity.bo.SalaryStatisticsEmployeeBO;
@ -62,6 +65,14 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
return ServiceUtil.getService(SalaryItemServiceImpl.class, user);
}
private SalarySobService getSalarySobService(User user) {
return ServiceUtil.getService(SalarySobServiceImpl.class, user);
}
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
}
// private ExtEmployeeMapper extEmployeeMapper;
@ -76,7 +87,7 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
@Override
public PageInfo<SalaryStatisticsEmployeeListDTO> listPage(SalaryStatisticsEmployeeQueryParam queryParam) {
List<SalaryStatisticsEmployeeListDTO> list = Collections.emptyList();
PageInfo<SalaryStatisticsEmployeeListDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list);
PageInfo<SalaryStatisticsEmployeeListDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, SalaryStatisticsEmployeeListDTO.class);
// 1.分权处理, 首先获取个税扣缴义务人参数
Collection<TaxAgentPO> taxAgentViews = getTaxAgentService(user).listAllTaxAgents((long) user.getUID());
@ -165,7 +176,7 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
// .in(ExtEmployeePO::getId, extEmployeeIdList)
// .list();
// Map<Long, ExtEmployeePO> extEmployeeMap = extEmployeeList.stream().collect(Collectors.toMap(ExtEmployeePO::getId, v -> v));
List<DataCollectionEmployee> simpleEmployeeList = getSalaryEmployeeService(user).getEmployeeByIds(employeeIds);
List<DataCollectionEmployee> simpleEmployeeList = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds);
Map<Long, DataCollectionEmployee> innerEmployeeMap = simpleEmployeeList.stream().collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, v -> v));
salaryStatisticsEmployeeListDTOs.forEach(e -> {
DataCollectionEmployee simpleEmployee = innerEmployeeMap.get(e.getId());
@ -173,7 +184,7 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
e.setSubCompany(simpleEmployee.getSubcompanyName());
e.setDepartment(simpleEmployee.getDepartmentName());
e.setPosition(simpleEmployee.getJobtitleName());
e.setStatus(simpleEmployee.getStatus());
e.setStatus(UserStatusEnum.getDefaultLabelByValue(Integer.parseInt(simpleEmployee.getStatus())));
e.setJobNum(simpleEmployee.getWorkcode());
e.setIdNo(simpleEmployee.getIdNo());
});
@ -229,6 +240,12 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
List<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAll();
Map<Long, String> taxAgentMap = SalaryEntityUtil.convert2Map(taxAgentList, TaxAgentPO::getId, TaxAgentPO::getName);
List<SalarySobPO> salarySobPOS = getSalarySobService(user).listAll();
Map<Long, String> SalarySobMap = SalaryEntityUtil.convert2Map(salarySobPOS, SalarySobPO::getId, SalarySobPO::getName);
List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).listAll();
Map<Long, Integer> salaryAcctRecordMap = SalaryEntityUtil.convert2Map(salaryAcctRecordPOS, SalaryAcctRecordPO::getId, SalaryAcctRecordPO::getAcctTimes);
Map<Long, List<SalaryAcctResultPO>> acctResultValueList = SalaryEntityUtil.group2Map(salaryStatisticsEmployeeDetailResult.getSalaryAcctResultValueList(), SalaryAcctResultPO::getSalaryAcctEmpId);
Map<Long, Map<String, String>> acctResultValueMap = new HashMap<>();
acctResultValueList.forEach((k, v) -> {
@ -250,8 +267,10 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
finalMap.put(k + SalaryConstant.DYNAMIC_SUFFIX, v);
});
map.put("id", se.getId().toString());
map.put("salaryMonth", se.getSalaryMonth());
map.put("salaryMonth", SalaryDateUtil.getFormatYearMonth(se.getSalaryMonth()));
map.put("taxAgent", taxAgentMap.get(se.getTaxAgentId()));
map.put("salarySob",SalarySobMap.get(se.getSalarySobId()));
map.put("acctTimes", salaryAcctRecordMap.get(se.getSalaryAcctRecordId()));
// IncomeCategoryEnum incomeCategoryEnum = IncomeCategoryEnum.parseByValue(Integer.parseInt(se.getIncomeCategory()));
// map.put("incomeCategory", Objects.isNull(incomeCategoryEnum) ? "" : SalaryI18nUtil.getI18nLabel(incomeCategoryEnum.getLabelId(), incomeCategoryEnum.getDefaultLabel()));
list.add(map);

View File

@ -1,6 +1,9 @@
package com.engine.salary.report.wrapper;
import com.cloudstore.eccom.constant.WeaBoolAttr;
import com.cloudstore.eccom.pc.table.WeaTable;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
@ -23,10 +26,7 @@ import org.apache.commons.lang3.math.NumberUtils;
import weaver.hrm.User;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
/**
* 薪酬统计员工明细
@ -41,6 +41,7 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
private SalaryStatisticsEmployeeService getSalaryStatisticsEmployeeService(User user) {
return ServiceUtil.getService(SalaryStatisticsEmployeeServiceImpl.class, user);
}
/**
* 员工列表
*
@ -48,8 +49,7 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
* @return
*/
public PageInfo<SalaryStatisticsEmployeeListDTO> list(SalaryStatisticsEmployeeQueryParam queryParam) {
PageInfo<SalaryStatisticsEmployeeListDTO> page = getSalaryStatisticsEmployeeService(user).listPage(queryParam);
return page;
return getSalaryStatisticsEmployeeService(user).listPage(queryParam);
}
/**
@ -64,10 +64,6 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
List<Map<String, Object>> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, queryParam);
Map<String, Object> countResultMap = Maps.newHashMap();
countResultMap.put("id", "1000000");
countResultMap.put("salaryMonth", "-");
countResultMap.put("taxAgent", "-");
countResultMap.put("incomeCategory", "-");
if (CollectionUtils.isNotEmpty(records)) {
List<SalaryItemPO> salaryItems = salaryStatisticsEmployeeDetailResult.getSalaryItemList();
for (SalaryItemPO item : salaryItems) {
@ -75,7 +71,7 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
String itemKey = item.getId() + SalaryConstant.DYNAMIC_SUFFIX;
for (Map<String, Object> record : records) {
if (record.containsKey(itemKey)) {
if (Objects.nonNull(record.get(itemKey)) && StringUtils.isNotEmpty(record.get(itemKey).toString())&& NumberUtils.isCreatable(record.get(itemKey).toString())) {
if (Objects.nonNull(record.get(itemKey)) && StringUtils.isNotEmpty(record.get(itemKey).toString()) && NumberUtils.isCreatable(record.get(itemKey).toString())) {
sumBigDecimal = sumBigDecimal.add(new BigDecimal(record.get(itemKey).toString()));
record.put(itemKey, ReportDataUtil.thousandthConvert(record.get(itemKey).toString()));
}
@ -89,21 +85,33 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
// 列表columns
List<WeaTableColumn> weaTableColumns = buildDetailTableColumns(salaryStatisticsEmployeeDetailResult);
WeaTable table = new WeaTable();
table.setPageUID(UUID.randomUUID().toString());
table.setColumns(weaTableColumns);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
// 结果
Map<String, Object> resultMap = Maps.newHashMap();
resultMap.put("columns", weaTableColumns);
// resultMap.put("columns", weaTableColumns);
resultMap.put("dataKey", result.getResultMap());
resultMap.put("pageInfo", pageInfo);
resultMap.put("countResult", countResultMap);
return resultMap;
}
private List<WeaTableColumn> buildDetailTableColumns(SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult) {
// 表格表头
List<WeaTableColumn> columns = new ArrayList<>();
columns.add(new WeaTableColumn(SalaryI18nUtil.getI18nLabel( 87614, "薪资所属月"), "salaryMonth", "100"));
columns.add(new WeaTableColumn(SalaryI18nUtil.getI18nLabel( 86184, "个税扣缴义务人"), "taxAgent", "150"));
columns.add(new WeaTableColumn(SalaryI18nUtil.getI18nLabel( 121908, "收入所得项目"), "incomeCategory", "150"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(87614, "薪资所属月"), "salaryMonth"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"), "taxAgent"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86184, "账套"), "salarySob"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86184, "次数"), "acctTimes").setDisplay(WeaBoolAttr.FALSE));
// columns.add(new WeaTableColumn("100px",SalaryI18nUtil.getI18nLabel( 121908, "收入所得项目"), "incomeCategory"));
salaryStatisticsEmployeeDetailResult.getSalaryItemList().forEach(item -> {
columns.add(new WeaTableColumn(item.getName(), item.getId() + SalaryConstant.DYNAMIC_SUFFIX, "100"));
columns.add(new WeaTableColumn("100px", item.getName(), item.getId() + SalaryConstant.DYNAMIC_SUFFIX));
});
return columns;
}

View File

@ -31,6 +31,8 @@ public interface SalaryAcctRecordService {
*/
SalaryAcctRecordPO getById(Long id);
List<SalaryAcctRecordPO> listAll();
/**
* 根据主键id查询薪资核算记录
*
@ -202,4 +204,7 @@ public interface SalaryAcctRecordService {
List<SalaryAcctRecordPO> getBackCalcRecordByIds(Set<Long> salaryAcctIds);
List<SalaryAcctResultPO> listBySalaryAcctEmpId(Long salaryAcctEmpId);
}

View File

@ -63,6 +63,8 @@ public interface SalarySobService {
*/
List<SalarySobPO> listByDisable(Integer disable);
List<SalarySobPO> listAll();
/**
* 获取拥有管理权限的账套
* @return

View File

@ -102,6 +102,11 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
return getSalaryAcctRecordMapper().getById(id);
}
@Override
public List<SalaryAcctRecordPO> listAll() {
return getSalaryAcctRecordMapper().listAll();
}
@Override
public List<SalaryAcctRecordPO> listByIds(Collection<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {

View File

@ -156,6 +156,11 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
return filterByAuthority(salarySobPOS);
}
@Override
public List<SalarySobPO> listAll() {
return salarySobMapper.listSome(SalarySobPO.builder().build());
}
@Override
public List<SalarySobPO> listByAdmin() {
List<SalarySobPO> salarySobPOS = salarySobMapper.listSome(SalarySobPO.builder().build());