档案列表显示扣缴义务人

This commit is contained in:
钱涛 2022-07-14 14:32:59 +08:00
parent 01bd6fefd4
commit c8aa08fc9f
3 changed files with 42 additions and 32 deletions

View File

@ -44,7 +44,7 @@ public class SalaryArchiveListDTO {
*/
@TableTitle(title = "个税扣缴义务人", dataIndex = "taxAgentName", key = "taxAgentName")
private String taxAgentName;
private String taxAgentId;
private Long taxAgentId;
/**
* 部门

View File

@ -82,6 +82,10 @@
#{id}
</foreach>
</if>
<!-- 个税扣缴义务人 -->
<if test="param.taxAgentId != null">
AND t1.employee_id = #{param.taxAgentId}
</if>
<!-- 姓名 -->
<if test="param.username != null and param.username != ''">
AND e.lastname like CONCAT('%',#{param.username},'%')
@ -114,12 +118,7 @@
<select id="list" resultType="com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO" databaseId="oracle">
SELECT
t1.id,
t1.employee_id,
e.mobile,
e.lastname as username,
e.status AS employeeStatus,
d.departmentname AS departmentName
<include refid="salaryArchiveColumn"/>
FROM
hrsa_salary_archive t1
@ -134,6 +133,10 @@
#{id}
</foreach>
</if>
<!-- 个税扣缴义务人 -->
<if test="param.taxAgentId != null">
AND t1.employee_id = #{param.taxAgentId}
</if>
<if test="param.username != null and param.username != ''">
AND e.lastname like '%'||#{param.username}||'%'
</if>
@ -165,12 +168,7 @@
databaseId="sqlserver">
SELECT
t1.id,
t1.employee_id,
e.mobile,
e.lastname as username,
e.status AS employeeStatus,
d.departmentname AS departmentName
<include refid="salaryArchiveColumn"/>
FROM
hrsa_salary_archive t1
@ -185,7 +183,10 @@
#{id}
</foreach>
</if>
<!-- 个税扣缴义务人 -->
<if test="param.taxAgentId != null">
AND t1.employee_id = #{param.taxAgentId}
</if>
<if test="param.username != null and param.username != ''">
AND e.lastname like '%'+#{param.username}+'%'
</if>

View File

@ -98,6 +98,10 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
public PageInfo<SalaryArchiveListDTO> listPage(SalaryArchiveQueryParam queryParam) {
long currentEmployeeId = user.getUID();
// 1.历史数据处理
handleHistory(currentEmployeeId);
Boolean needAuth = getTaxAgentService(user).isNeedAuth(currentEmployeeId);
if (needAuth) {
@ -213,16 +217,17 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
return map;
}).collect(Collectors.toList());
//2.获取薪资档案所对应的当前生效的个税扣缴义务人列表
List<SalaryArchiveTaxAgentPO> taxAgentList = getCurrentEffectiveTaxAgentList(ids);
List<Map<String, Object>> taxAgentData = taxAgentList.stream().map(m -> {
Map<String, Object> map = Maps.newHashMap();
map.put("salaryArchiveId", m.getSalaryArchiveId());
map.put("taxAgentId", m.getTaxAgentId());
Optional<TaxAgentPO> optional = taxAgentLists.stream().filter(f -> f.getId().equals(m.getTaxAgentId())).findFirst();
map.put("taxAgentName", optional.isPresent() ? optional.get().getName() : "");
map.put("taxAgentEffectiveTime", m.getEffectiveTime());
return map;
}).collect(Collectors.toList());
// List<SalaryArchiveTaxAgentPO> taxAgentList = getCurrentEffectiveTaxAgentList(ids);
// List<Map<String, Object>> taxAgentData = taxAgentList.stream().map(m -> {
// Map<String, Object> map = Maps.newHashMap();
// map.put("salaryArchiveId", m.getSalaryArchiveId());
// map.put("taxAgentId", m.getTaxAgentId());
// Optional<TaxAgentPO> optional = taxAgentLists.stream().filter(f -> f.getId().equals(m.getTaxAgentId())).findFirst();
// map.put("taxAgentName", optional.isPresent() ? optional.get().getName() : "");
// map.put("taxAgentEffectiveTime", m.getEffectiveTime());
// return map;
// }).collect(Collectors.toList());
Map<Long, TaxAgentPO> longTaxAgentPOMap = SalaryEntityUtil.convert2Map(taxAgentLists, TaxAgentPO::getId);
// 3.组装数据
List<Map<String, Object>> listMaps = new ArrayList<>();
salaryArchives.forEach(e -> {
@ -233,10 +238,11 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
map.put("username", e.getUsername());
map.put("employeeId", e.getEmployeeId());
Optional<Map<String, Object>> optionalTaxAgent = taxAgentData.stream().filter(f -> f.get("salaryArchiveId").toString().equals(e.getId().toString())).findFirst();
map.put("taxAgentName", optionalTaxAgent.isPresent() ? optionalTaxAgent.get().get("taxAgentName").toString() : "");
map.put("taxAgentId", optionalTaxAgent.isPresent() ? optionalTaxAgent.get().get("taxAgentId").toString() : "");
map.put("taxAgentEffectiveTime", optionalTaxAgent.isPresent() ? optionalTaxAgent.get().get("taxAgentEffectiveTime") : "");
// Optional<Map<String, Object>> optionalTaxAgent = taxAgentData.stream().filter(f -> f.get("salaryArchiveId").toString().equals(e.getId().toString())).findFirst();
TaxAgentPO taxAgentPO = longTaxAgentPOMap.get(e.getTaxAgentId());
map.put("taxAgentName", taxAgentPO.getName());
map.put("taxAgentId", taxAgentPO.getId());
// map.put("taxAgentEffectiveTime", optionalTaxAgent.isPresent() ? optionalTaxAgent.get().get("taxAgentEffectiveTime") : "");
map.put("departmentName", e.getDepartmentName());
map.put("mobile", e.getMobile());
@ -828,9 +834,10 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
// 4.调整原因[薪资项目]
adjustReason = SalaryArchiveItemAdjustReasonEnum.getValueByDefaultLabel(Optional.ofNullable(map.get(adjustReasonI18n)).orElse("").toString());
}
// 构建薪资档案
SalaryArchivePO finalSalaryArchive = buildSalaryArchive(isInit, employeeId, importHandleParam);
// 构建薪资档案
SalaryArchivePO finalSalaryArchive = buildSalaryArchive(isInit, employeeId, taxAgentId, importHandleParam);
for (int j = 0; j < headers.size(); j++) {
String key = headers.get(j);
@ -921,8 +928,8 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
return isError;
}
private SalaryArchivePO buildSalaryArchive(boolean isInit, Long employeeId, SalaryArchiveImportHandleParam importHandleParam) {
Optional<SalaryArchiveListDTO> optionalSA = importHandleParam.getSalaryArchives().stream().filter(p -> p.getEmployeeId().toString().equals(employeeId != null ? employeeId.toString() : "")).findFirst();
private SalaryArchivePO buildSalaryArchive(boolean isInit, Long employeeId, Long taxAgentId, SalaryArchiveImportHandleParam importHandleParam) {
Optional<SalaryArchiveListDTO> optionalSA = importHandleParam.getSalaryArchives().stream().filter(p -> p.getEmployeeId().equals(employeeId) && p.getTaxAgentId().equals(taxAgentId)).findFirst();
SalaryArchivePO salaryArchive = null;
if (optionalSA.isPresent()) {
// 修改档案
@ -930,11 +937,13 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
salaryArchive = new SalaryArchivePO();
salaryArchive.setId(sa.getId());
salaryArchive.setEmployeeId(sa.getEmployeeId());
salaryArchive.setTaxAgentId(sa.getTaxAgentId());
} else if (employeeId != null && isInit) {
// 新增档案
salaryArchive = SalaryArchivePO.builder()
.id(IdGenerator.generate())
.employeeId(employeeId)
.taxAgentId(taxAgentId)
.createTime(importHandleParam.getNowTime())
.updateTime(importHandleParam.getNowTime())
.creator((long) user.getUID())