对比功能添加筛选是否显示差异人员和差异项

This commit is contained in:
钱涛 2024-01-23 11:23:50 +08:00
parent a168aeef53
commit ce5c106845
4 changed files with 55 additions and 12 deletions

View File

@ -0,0 +1,20 @@
package com.engine.salary.entity.taxdeclaration.dto;
import lombok.Data;
/**
* 个税申报表详情列表劳务报酬所得
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
public class ContrastListDTO {
private String local;
private String online;
private Object diff;
}

View File

@ -19,4 +19,13 @@ public class ContrastQueryParam extends BaseQueryParam {
*/
private Long taxDeclarationId;
/**
* 是否只显示差异人员
*/
private boolean onlyShowDiffEmp;
/**
* 是否只显示差异项
*/
private boolean onlyShowDiffItem;
}

View File

@ -10,6 +10,7 @@ import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
import com.engine.salary.entity.extemp.po.ExtEmpPO;
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationValueList;
import com.engine.salary.entity.taxdeclaration.dto.ContrastListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationValueListDTO;
import com.engine.salary.entity.taxdeclaration.param.ContrastQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationValueListQueryParam;
@ -45,6 +46,7 @@ import weaver.hrm.User;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
/**
@ -356,8 +358,10 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
onlineNoMap.put(no, map);
}
Set<String> onlyShowColumns = new HashSet<>();
List<Map<String, Object>> oneResultList = new ArrayList<>();
for (Map<String, Object> local : localList) {
AtomicBoolean hasDiff = new AtomicBoolean(false);
Map<String, Object> result = new HashMap<>();
result.put("姓名", local.get("姓名"));
result.put("证件类型", local.get("证件类型"));
@ -365,29 +369,39 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
String no = local.getOrDefault("证件号码", "").toString();
Map<String, Object> online = onlineNoMap.get(no);
taxReportColumns.forEach(col -> {
Map<String, Object> temp = Maps.newHashMap();
taxReportColumns.stream().map(TaxReportColumnPO::getReportColumnName).forEach(col -> {
ContrastListDTO dto = new ContrastListDTO();
// 系统值
String localValue = Util.null2String(local.get(col.getReportColumnName()));
String localValue = Util.null2String(local.get(col));
// 线上值
String onlineValue = Util.null2String(online.get(col.getReportColumnName()));
temp.put("local", localValue);
temp.put("online", onlineValue);
String onlineValue = Util.null2String(online.get(col));
dto.setLocal(localValue);
dto.setOnline(onlineValue);
if (NumberUtil.isNumber(localValue) && NumberUtil.isNumber(onlineValue)) {
BigDecimal diff = new BigDecimal(localValue).subtract(new BigDecimal(onlineValue));
if (diff.compareTo(new BigDecimal(0)) != 0) {
temp.put("diff", diff);
dto.setDiff(diff);
onlyShowColumns.add(col);
hasDiff.set(true);
}
} else {
if (!Objects.equals(localValue, onlineValue)) {
temp.put("diff", localValue);
dto.setDiff(localValue);
onlyShowColumns.add(col);
hasDiff.set(true);
}
}
result.put(col.getReportColumnName(), temp);
result.put(col, dto);
});
oneResultList.add(result);
if (param.isOnlyShowDiffEmp()) {
if (hasDiff.get()) {
oneResultList.add(result);
}
} else {
oneResultList.add(result);
}
}
resultList.put("columns", columns);
resultList.put("columns", param.isOnlyShowDiffItem() ? onlyShowColumns : columns);
resultList.put("pageInfo", SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), oneResultList));
return resultList;
}

View File

@ -285,7 +285,7 @@ public class TaxDeclarationController {
*
* @param request
* @param response
* @param ContrastQueryParam
* @param param
* @return
*/
@POST