增加申报表导入时导出现有数据选项
This commit is contained in:
parent
483c368732
commit
8a49ea89f8
|
|
@ -57,7 +57,6 @@ public class TaxDeclarationValueList {
|
||||||
* @param taxReportColumns
|
* @param taxReportColumns
|
||||||
* @param taxDeclarationValues
|
* @param taxDeclarationValues
|
||||||
* @param simpleEmployees
|
* @param simpleEmployees
|
||||||
* @param simpleUserInfos
|
|
||||||
* @param extEmployees
|
* @param extEmployees
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -66,7 +65,6 @@ public class TaxDeclarationValueList {
|
||||||
List<TaxDeclarationValuePO> taxDeclarationValues,
|
List<TaxDeclarationValuePO> taxDeclarationValues,
|
||||||
List<EmployeeDeclarePO> employeeDeclares,
|
List<EmployeeDeclarePO> employeeDeclares,
|
||||||
List<DataCollectionEmployee> simpleEmployees,
|
List<DataCollectionEmployee> simpleEmployees,
|
||||||
List<DataCollectionEmployee> simpleUserInfos,
|
|
||||||
List<ExtEmpPO> extEmployees, boolean cnKey) {
|
List<ExtEmpPO> extEmployees, boolean cnKey) {
|
||||||
if (CollectionUtils.isEmpty(simpleEmployees)) {
|
if (CollectionUtils.isEmpty(simpleEmployees)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
@ -76,8 +74,6 @@ public class TaxDeclarationValueList {
|
||||||
Map<Long, DataCollectionEmployee> simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId);
|
Map<Long, DataCollectionEmployee> simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId);
|
||||||
// 员工报送信息按照人员id聚合分类
|
// 员工报送信息按照人员id聚合分类
|
||||||
Map<Long, EmployeeDeclarePO> employeeDeclareMap = SalaryEntityUtil.convert2Map(employeeDeclares, EmployeeDeclarePO::getEmployeeId);
|
Map<Long, EmployeeDeclarePO> employeeDeclareMap = SalaryEntityUtil.convert2Map(employeeDeclares, EmployeeDeclarePO::getEmployeeId);
|
||||||
// 员工个人信息按照人员id聚合分类
|
|
||||||
Map<Long, DataCollectionEmployee> simpleUserInfoMap = SalaryEntityUtil.convert2Map(simpleUserInfos, e -> e.getEmployeeId());
|
|
||||||
// 非系统员工按照人员id聚合分类
|
// 非系统员工按照人员id聚合分类
|
||||||
Map<Long, ExtEmpPO> extEmployeeMap = SalaryEntityUtil.convert2Map(extEmployees, ExtEmpPO::getId);
|
Map<Long, ExtEmpPO> extEmployeeMap = SalaryEntityUtil.convert2Map(extEmployees, ExtEmpPO::getId);
|
||||||
for (TaxDeclarationValuePO taxDeclarationValue : taxDeclarationValues) {
|
for (TaxDeclarationValuePO taxDeclarationValue : taxDeclarationValues) {
|
||||||
|
|
@ -90,23 +86,32 @@ public class TaxDeclarationValueList {
|
||||||
}
|
}
|
||||||
EmployeeDeclarePO employeeDeclare = employeeDeclareMap.get(taxDeclarationValue.getEmployeeId());
|
EmployeeDeclarePO employeeDeclare = employeeDeclareMap.get(taxDeclarationValue.getEmployeeId());
|
||||||
if (employeeDeclare != null) {
|
if (employeeDeclare != null) {
|
||||||
|
DataCollectionEmployee simpleUserInfo = simpleEmployeeMap.get(taxDeclarationValue.getEmployeeId());
|
||||||
dataMap.put(cnKey ? "工号" : "jobNum", employeeDeclare.getJobNum());
|
dataMap.put(cnKey ? "工号" : "jobNum", employeeDeclare.getJobNum());
|
||||||
dataMap.put(cnKey ? "姓名" : "username", employeeDeclare.getEmployeeName());
|
dataMap.put(cnKey ? "姓名" : "username", employeeDeclare.getEmployeeName());
|
||||||
dataMap.put(cnKey ? "证件类型" : "cardType",CardTypeEnum.getByValue(employeeDeclare.getCardType()).getDefaultLabel() );
|
dataMap.put(cnKey ? "证件类型" : "cardType",CardTypeEnum.getByValue(employeeDeclare.getCardType()).getDefaultLabel() );
|
||||||
dataMap.put(cnKey ? "证件号码" : "cardNum", employeeDeclare.getCardNum());
|
dataMap.put(cnKey ? "证件号码" : "cardNum", employeeDeclare.getCardNum());
|
||||||
|
dataMap.put(cnKey ? "部门" : "departmentName", simpleUserInfo == null ? "" : simpleUserInfo.getDepartmentName());
|
||||||
|
dataMap.put(cnKey ? "手机号" : "mobile", simpleUserInfo == null ? "" : simpleUserInfo.getMobile());
|
||||||
|
dataMap.put(cnKey ? "证件号码" : "idNo", simpleUserInfo == null ? "" : simpleUserInfo.getIdNo());
|
||||||
} else if (taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) {
|
} else if (taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) {
|
||||||
DataCollectionEmployee simpleEmployee = simpleEmployeeMap.get(taxDeclarationValue.getEmployeeId());
|
DataCollectionEmployee simpleEmployee = simpleEmployeeMap.get(taxDeclarationValue.getEmployeeId());
|
||||||
DataCollectionEmployee simpleUserInfo = simpleUserInfoMap.get(taxDeclarationValue.getEmployeeId());
|
|
||||||
dataMap.put(cnKey ? "工号" : "jobNum", simpleEmployee.getWorkcode());
|
dataMap.put(cnKey ? "工号" : "jobNum", simpleEmployee.getWorkcode());
|
||||||
dataMap.put(cnKey ? "姓名" : "username", simpleEmployee.getUsername());
|
dataMap.put(cnKey ? "姓名" : "username", simpleEmployee.getUsername());
|
||||||
dataMap.put(cnKey ? "证件类型" : "cardType", SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel()));
|
dataMap.put(cnKey ? "证件类型" : "cardType", SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel()));
|
||||||
dataMap.put(cnKey ? "证件号码" : "cardNum", simpleUserInfo == null ? "" : simpleUserInfo.getIdNo());
|
dataMap.put(cnKey ? "证件号码" : "cardNum", simpleEmployee.getIdNo());
|
||||||
|
dataMap.put(cnKey ? "部门" : "departmentName", simpleEmployee.getDepartmentName());
|
||||||
|
dataMap.put(cnKey ? "手机号" : "mobile", simpleEmployee.getMobile());
|
||||||
|
dataMap.put(cnKey ? "证件号码" : "idNo", simpleEmployee.getIdNo());
|
||||||
} else {
|
} else {
|
||||||
ExtEmpPO extEmployee = extEmployeeMap.get(taxDeclarationValue.getEmployeeId());
|
ExtEmpPO extEmployee = extEmployeeMap.get(taxDeclarationValue.getEmployeeId());
|
||||||
dataMap.put(cnKey ? "工号" : "jobNum", extEmployee.getWorkcode());
|
dataMap.put(cnKey ? "工号" : "jobNum", extEmployee.getWorkcode());
|
||||||
dataMap.put(cnKey ? "姓名" : "username", extEmployee.getUsername());
|
dataMap.put(cnKey ? "姓名" : "username", extEmployee.getUsername());
|
||||||
dataMap.put(cnKey ? "证件类型" : "cardType", SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel()));
|
dataMap.put(cnKey ? "证件类型" : "cardType", SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel()));
|
||||||
dataMap.put(cnKey ? "证件号码" : "cardNum", extEmployee.getIdNo());
|
dataMap.put(cnKey ? "证件号码" : "cardNum", extEmployee.getIdNo());
|
||||||
|
dataMap.put(cnKey ? "部门" : "departmentName", extEmployee == null ? "" : extEmployee.getDepartmentName());
|
||||||
|
dataMap.put(cnKey ? "手机号" : "mobile", extEmployee == null ? "" : extEmployee.getMobile());
|
||||||
|
dataMap.put(cnKey ? "证件号码" : "idNo", extEmployee == null ? "" : extEmployee.getIdNo());
|
||||||
}
|
}
|
||||||
tableDataList.add(dataMap);
|
tableDataList.add(dataMap);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,4 +23,8 @@ public class DownloadTemplateParam {
|
||||||
* 导入文件id
|
* 导入文件id
|
||||||
*/
|
*/
|
||||||
String imageId;
|
String imageId;
|
||||||
|
|
||||||
|
|
||||||
|
//下载模板时是否带出现有数据
|
||||||
|
private boolean hasData;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -225,6 +225,31 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar
|
||||||
|
|
||||||
List<List<Object>> rowList = new ArrayList<>();
|
List<List<Object>> rowList = new ArrayList<>();
|
||||||
rowList.add(heads);
|
rowList.add(heads);
|
||||||
|
|
||||||
|
if(param.isHasData()){
|
||||||
|
// 查询个税申报表明细
|
||||||
|
List<TaxDeclarationValuePO> taxDeclarationValues = getTaxDeclarationValueService(user).listByTaxDeclarationIds(Collections.singleton(param.getTaxDeclarationId()));
|
||||||
|
// 转成个税申报表明细
|
||||||
|
TaxDeclarationValueListDTO taxDeclarationValueListDTO = getTaxDeclarationValueService(user).convert2List(declarationPO, taxDeclarationValues);
|
||||||
|
|
||||||
|
List<String> dataIndexList = new ArrayList<>();
|
||||||
|
dataIndexList.add("username");
|
||||||
|
dataIndexList.add("departmentName");
|
||||||
|
dataIndexList.add("mobile");
|
||||||
|
dataIndexList.add("jobNum");
|
||||||
|
dataIndexList.add("idNo");
|
||||||
|
dataIndexList.addAll(SalaryEntityUtil.properties(taxReportColumnPOS, TaxReportColumnPO::getReportColumnDataIndex, Collectors.toList()));
|
||||||
|
|
||||||
|
// 解析表中数据
|
||||||
|
for (Map<String, Object> datum : taxDeclarationValueListDTO.getData()) {
|
||||||
|
List<Object> row = Lists.newArrayList();
|
||||||
|
for (String dataIndex : dataIndexList) {
|
||||||
|
row.add(Util.null2String(datum.get(dataIndex)));
|
||||||
|
}
|
||||||
|
rowList.add(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
XSSFWorkbook book = ExcelUtil.genWorkbookV2(rowList, incomeCategoryEnum.getDefaultLabel());
|
XSSFWorkbook book = ExcelUtil.genWorkbookV2(rowList, incomeCategoryEnum.getDefaultLabel());
|
||||||
return book;
|
return book;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,9 +146,7 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
|
||||||
List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentIdAndEmployeeIds(taxDeclaration.getTaxCycle(), taxDeclaration.getTaxAgentId(), employeeIds);
|
List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentIdAndEmployeeIds(taxDeclaration.getTaxCycle(), taxDeclaration.getTaxAgentId(), employeeIds);
|
||||||
// 查询人员信息
|
// 查询人员信息
|
||||||
List<Long> simpleEmployeeIds = taxDeclarationValues.stream().filter(taxDeclarationValue -> taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())).map(TaxDeclarationValuePO::getEmployeeId).distinct().collect(Collectors.toList());
|
List<Long> simpleEmployeeIds = taxDeclarationValues.stream().filter(taxDeclarationValue -> taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())).map(TaxDeclarationValuePO::getEmployeeId).distinct().collect(Collectors.toList());
|
||||||
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
|
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIdsAll(simpleEmployeeIds);
|
||||||
// 查询人员薪资(身份证号码等)
|
|
||||||
List<DataCollectionEmployee> simpleUserInfos = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
|
|
||||||
// 查询外部人员
|
// 查询外部人员
|
||||||
List<Long> extEmployeeIds = taxDeclarationValues.stream().filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue())).map(TaxDeclarationValuePO::getEmployeeId).collect(Collectors.toList());
|
List<Long> extEmployeeIds = taxDeclarationValues.stream().filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue())).map(TaxDeclarationValuePO::getEmployeeId).collect(Collectors.toList());
|
||||||
List<ExtEmpPO> extEmployees = getExtEmpService(user).getExtEmpByIds(extEmployeeIds);
|
List<ExtEmpPO> extEmployees = getExtEmpService(user).getExtEmpByIds(extEmployeeIds);
|
||||||
|
|
@ -156,7 +154,7 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
|
||||||
// 列表表头
|
// 列表表头
|
||||||
List<WeaTableColumn> weaTableColumns = TaxDeclarationValueList.buildTableColumns(taxReportColumns);
|
List<WeaTableColumn> weaTableColumns = TaxDeclarationValueList.buildTableColumns(taxReportColumns);
|
||||||
// 列表数据
|
// 列表数据
|
||||||
List<Map<String, Object>> data = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues, employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees, false);
|
List<Map<String, Object>> data = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues, employeeDeclares, simpleEmployees, extEmployees, false);
|
||||||
|
|
||||||
return new TaxDeclarationValueListDTO().setColumns(weaTableColumns).setData(data);
|
return new TaxDeclarationValueListDTO().setColumns(weaTableColumns).setData(data);
|
||||||
}
|
}
|
||||||
|
|
@ -382,15 +380,13 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
|
||||||
List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentIdAndEmployeeIds(taxDeclaration.getTaxCycle(), taxDeclaration.getTaxAgentId(), employeeIds);
|
List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentIdAndEmployeeIds(taxDeclaration.getTaxCycle(), taxDeclaration.getTaxAgentId(), employeeIds);
|
||||||
// 查询人员信息
|
// 查询人员信息
|
||||||
List<Long> simpleEmployeeIds = taxDeclarationValues.stream().filter(taxDeclarationValue -> taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())).map(TaxDeclarationValuePO::getEmployeeId).distinct().collect(Collectors.toList());
|
List<Long> simpleEmployeeIds = taxDeclarationValues.stream().filter(taxDeclarationValue -> taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())).map(TaxDeclarationValuePO::getEmployeeId).distinct().collect(Collectors.toList());
|
||||||
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
|
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIdsAll(simpleEmployeeIds);
|
||||||
// 查询人员薪资(身份证号码等)
|
|
||||||
List<DataCollectionEmployee> simpleUserInfos = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
|
|
||||||
// 查询外部人员
|
// 查询外部人员
|
||||||
List<Long> extEmployeeIds = taxDeclarationValues.stream().filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue())).map(TaxDeclarationValuePO::getEmployeeId).collect(Collectors.toList());
|
List<Long> extEmployeeIds = taxDeclarationValues.stream().filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue())).map(TaxDeclarationValuePO::getEmployeeId).collect(Collectors.toList());
|
||||||
List<ExtEmpPO> extEmployees = getExtEmpService(user).getExtEmpByIds(extEmployeeIds);
|
List<ExtEmpPO> extEmployees = getExtEmpService(user).getExtEmpByIds(extEmployeeIds);
|
||||||
|
|
||||||
// 列表数据
|
// 列表数据
|
||||||
List<Map<String, Object>> localList = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues, employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees, true);
|
List<Map<String, Object>> localList = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues, employeeDeclares, simpleEmployees, extEmployees, true);
|
||||||
|
|
||||||
|
|
||||||
Map<String, Map<String, Object>> localMap = new HashMap<>();
|
Map<String, Map<String, Object>> localMap = new HashMap<>();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue