From e0d4820e2eb6499d69730cff379b421b2a8a0db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 9 Jan 2024 10:53:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GetDeclareTaxResultFeedbackResponse.java | 2 - .../service/TaxDeclarationValueService.java | 3 +- .../impl/TaxDeclarationValueServiceImpl.java | 168 +++++++++--------- .../salary/web/TaxDeclarationController.java | 15 +- .../wrapper/TaxDeclareRecordWrapper.java | 12 +- 5 files changed, 105 insertions(+), 95 deletions(-) diff --git a/src/com/engine/salary/remote/tax/response/employee/GetDeclareTaxResultFeedbackResponse.java b/src/com/engine/salary/remote/tax/response/employee/GetDeclareTaxResultFeedbackResponse.java index 93d834590..9949402a4 100644 --- a/src/com/engine/salary/remote/tax/response/employee/GetDeclareTaxResultFeedbackResponse.java +++ b/src/com/engine/salary/remote/tax/response/employee/GetDeclareTaxResultFeedbackResponse.java @@ -478,8 +478,6 @@ public class GetDeclareTaxResultFeedbackResponse extends BaseResponse { /** * 累计专项附加扣除额 必填:null 专项附加合计 */ - @SalaryTableColumn(text = "累计专项附加扣除额", width = "10%", column = "ljzxfjkce") - @ExcelHead(title = "累计专项附加扣除额", dataIndex = "ljzxfjkce") private BigDecimal ljzxfjkce; /** diff --git a/src/com/engine/salary/service/TaxDeclarationValueService.java b/src/com/engine/salary/service/TaxDeclarationValueService.java index 773b6b9e9..bee04130e 100644 --- a/src/com/engine/salary/service/TaxDeclarationValueService.java +++ b/src/com/engine/salary/service/TaxDeclarationValueService.java @@ -10,6 +10,7 @@ import com.engine.salary.util.page.PageInfo; import java.util.Collection; import java.util.List; +import java.util.Map; /** * 个税申报表明细 @@ -90,7 +91,7 @@ public interface TaxDeclarationValueService { * 对比 * @param taxDeclareRecordId */ - void contrast(Long taxDeclareRecordId); + Map contrast(Long taxDeclareRecordId); } diff --git a/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java index 2e67d8973..94d00a6b2 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java @@ -31,7 +31,6 @@ import com.engine.salary.util.JsonUtil; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryEnumUtil; import com.engine.salary.util.db.MapperProxyFactory; -import com.engine.salary.util.excel.ExcelUtil; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; @@ -334,51 +333,21 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar } @Override - public void contrast(Long taxDeclareRecordId) { - TaxDeclareRecordPO taxDeclareRecordPO = getTaxDeclareRecordMapper().getById(taxDeclareRecordId); + public Map contrast(Long taxDeclarationId) { + + + TaxDeclarationPO taxDeclaration = getTaxDeclarationService(user).getById(taxDeclarationId); + if (taxDeclaration == null) { + throw new SalaryRunTimeException("无申报表"); + } + + TaxDeclareRecordPO taxDeclareRecordPO = getTaxDeclareRecordMapper().getById(taxDeclaration.getTaxDeclareRecordId()); if (taxDeclareRecordPO == null) { throw new SalaryRunTimeException("申报记录不存在!"); } - List taxDeclarations = getTaxDeclarationService(user).listByTaxDeclareRecordId(taxDeclareRecordId); - if (CollectionUtils.isEmpty(taxDeclarations)) { - throw new SalaryRunTimeException("无申报表"); - } - - Map>> localData = new HashMap<>(); - for (TaxDeclarationPO taxDeclaration : taxDeclarations) { - List taxDeclarationValues = listByTaxDeclarationId(taxDeclaration.getId()); - - // 查询个税申报表表头 - IncomeCategoryEnum incomeCategoryEnum = SalaryEnumUtil.enumMatchByValue(taxDeclaration.getIncomeCategory(), IncomeCategoryEnum.class); - List taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(incomeCategoryEnum); - // 人员id - Set employeeIds = SalaryEntityUtil.properties(taxDeclarationValues, TaxDeclarationValuePO::getEmployeeId); - // 查询报送的人员 - List employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentIdAndEmployeeIds(taxDeclaration.getTaxCycle(), taxDeclaration.getTaxAgentId(), employeeIds); - // 查询人员信息 - List simpleEmployeeIds = taxDeclarationValues.stream() - .filter(taxDeclarationValue -> taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) - .map(TaxDeclarationValuePO::getEmployeeId) - .distinct() - .collect(Collectors.toList()); - List simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds); - // 查询人员薪资(身份证号码等) - List simpleUserInfos = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds); - // 查询外部人员 - List extEmployeeIds = taxDeclarationValues.stream() - .filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue())) - .map(TaxDeclarationValuePO::getEmployeeId) - .collect(Collectors.toList()); - List extEmployees = getExtEmpService(user).getExtEmpByIds(extEmployeeIds); - - // 列表数据 - List> data = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues, - employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees, true); - - localData.put(incomeCategoryEnum.getDefaultLabel(), data); - } + //线上数据 DeclareClient declareClient = new DeclareClient(taxDeclareRecordPO.getTaxAgentId()); GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse = declareClient.getDeclareTaxResultFeedback(taxDeclareRecordPO.getDeclareRequestId()); @@ -386,51 +355,88 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar List list = getTaxDeclarationService(user).listByTaxDeclareRecordId(taxDeclareRecordPO.getId()); list.stream().map(TaxDeclarationPO::getIncomeCategory).map(IncomeCategoryEnum::parseByValue).forEach(e -> e.parseGetDeclareTaxResultFeedbackResponse(onlineDataMap, declareTaxResultFeedbackResponse)); - for (String incomeCategory : localData.keySet()) { - List> localList = localData.get(incomeCategory); + Map resultList = new HashMap<>(); + List taxDeclarationValues = listByTaxDeclarationId(taxDeclaration.getId()); - Map> localMap = new HashMap<>(); - for (Map map : localList) { - String no = map.getOrDefault("证件号码", "").toString(); - localMap.put(no, map); - } + // 查询个税申报表表头 + IncomeCategoryEnum incomeCategoryEnum = SalaryEnumUtil.enumMatchByValue(taxDeclaration.getIncomeCategory(), IncomeCategoryEnum.class); + List taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(incomeCategoryEnum); + List columns = SalaryEntityUtil.properties(taxReportColumns, TaxReportColumnPO::getReportColumnName, Collectors.toList()); + // 人员id + Set employeeIds = SalaryEntityUtil.properties(taxDeclarationValues, TaxDeclarationValuePO::getEmployeeId); + // 查询报送的人员 + List employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentIdAndEmployeeIds(taxDeclaration.getTaxCycle(), taxDeclaration.getTaxAgentId(), employeeIds); + // 查询人员信息 + List simpleEmployeeIds = taxDeclarationValues.stream() + .filter(taxDeclarationValue -> taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) + .map(TaxDeclarationValuePO::getEmployeeId) + .distinct() + .collect(Collectors.toList()); + List simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds); + // 查询人员薪资(身份证号码等) + List simpleUserInfos = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds); + // 查询外部人员 + List extEmployeeIds = taxDeclarationValues.stream() + .filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue())) + .map(TaxDeclarationValuePO::getEmployeeId) + .collect(Collectors.toList()); + List extEmployees = getExtEmpService(user).getExtEmpByIds(extEmployeeIds); - List> onlineData = onlineDataMap.get(incomeCategory); - List heads = onlineData.get(0); - List> data = onlineData.subList(1, onlineData.size()); - List> onlineMap = new ArrayList<>(); - for (int i = 0; i < data.size(); i++) { - List row = data.get(i); - Map m = new HashMap<>(); - for (int j = 0; j < heads.size(); j++) { - String key = heads.get(j).toString(); - m.put(key, row.get(j)); - } - onlineMap.add(m); - } - - Map> onlineNoMap = new HashMap<>(); - for (Map map : onlineMap) { - String no = map.getOrDefault("证件号码", "").toString(); - onlineNoMap.put(no, map); - } - - Map> header = ExcelUtil.getHeader(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class); - List list1 = header.get(header); - List> resultList = new ArrayList<>(); - - - - for (Map map : localList) { - String no = map.getOrDefault("证件号码", "").toString(); - Map d1 = localMap.get(no); - Map d2 = onlineNoMap.get(no); - - - } + // 列表数据 + List> localList = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues, + employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees, true); + Map> localMap = new HashMap<>(); + for (Map map : localList) { + String no = map.getOrDefault("证件号码", "").toString(); + localMap.put(no, map); } + + List> onlineData = onlineDataMap.get(incomeCategoryEnum.getDefaultLabel()); + List heads = onlineData.get(0); + List> data = onlineData.subList(1, onlineData.size()); + List> onlineMap = new ArrayList<>(); + for (int i = 0; i < data.size(); i++) { + List row = data.get(i); + Map m = new HashMap<>(); + for (int j = 0; j < heads.size(); j++) { + String key = heads.get(j).toString(); + m.put(key, row.get(j)); + } + onlineMap.add(m); + } + + Map> onlineNoMap = new HashMap<>(); + for (Map map : onlineMap) { + String no = map.getOrDefault("证件号码", "").toString(); + onlineNoMap.put(no, map); + } + + List> oneResultList = new ArrayList<>(); + for (Map local : localList) { + Map result = new HashMap<>(); + result.put("姓名", local.get("姓名")); + result.put("证件类型", local.get("证件类型")); + result.put("证件号码", local.get("证件号码")); + String no = local.getOrDefault("证件号码", "").toString(); + Map online = onlineNoMap.get(no); + + taxReportColumns.stream().forEach(col -> { + Map temp = Maps.newHashMap(); + // 系统值 + Object localValue = local.getOrDefault(col.getReportColumnName(), ""); + // 线下值 + Object onlineValue = online.getOrDefault(col.getReportColumnName(), ""); + temp.put("local", localValue); + temp.put("online", onlineValue); + result.put(col.getReportColumnName(), temp); + }); + oneResultList.add(result); + } + resultList.put("columns", columns); + resultList.put("data", oneResultList); + return resultList; } public static void main(String[] args) { diff --git a/src/com/engine/salary/web/TaxDeclarationController.java b/src/com/engine/salary/web/TaxDeclarationController.java index 694c7f679..c028ca7e2 100644 --- a/src/com/engine/salary/web/TaxDeclarationController.java +++ b/src/com/engine/salary/web/TaxDeclarationController.java @@ -184,13 +184,14 @@ public class TaxDeclarationController { @POST @Path("/addTaxDeclaration") @Produces(MediaType.APPLICATION_JSON) - public String addTaxDeclarationTab(@Context HttpServletRequest request, @Context HttpServletResponse response,TaxDeclarationAddParam param) { + public String addTaxDeclarationTab(@Context HttpServletRequest request, @Context HttpServletResponse response, TaxDeclarationAddParam param) { User user = HrmUserVarify.getUser(request, response); return new ResponseResult(user).run(getTaxDeclareRecordWrapper(user)::addTaxDeclaration, param); } /** * 删除申报表 + * * @param request * @param response * @param param @@ -199,7 +200,7 @@ public class TaxDeclarationController { @POST @Path("/deleteTaxDeclaration") @Produces(MediaType.APPLICATION_JSON) - public String deleteTaxDeclaration(@Context HttpServletRequest request, @Context HttpServletResponse response,TaxDeclarationDeleteParam param) { + public String deleteTaxDeclaration(@Context HttpServletRequest request, @Context HttpServletResponse response, TaxDeclarationDeleteParam param) { User user = HrmUserVarify.getUser(request, response); return new ResponseResult(user).run(getTaxDeclareRecordWrapper(user)::deleteTaxDeclaration, param); } @@ -281,17 +282,18 @@ public class TaxDeclarationController { /** * 对比算税过程 + * * @param request * @param response - * @param taxDeclareRecordParam + * @param taxDeclarationId * @return */ - @POST + @GET @Path("/contrast") @Produces(MediaType.APPLICATION_JSON) - public String contrast(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclareRecordParam taxDeclareRecordParam) { + public String contrast(@Context HttpServletRequest request, @Context HttpServletResponse response,@QueryParam(value = "taxDeclarationId") Long taxDeclarationId) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult(user).run(getTaxDeclareRecordWrapper(user)::contrast, taxDeclareRecordParam.getTaxDeclareRecordId()); + return new ResponseResult>(user).run(getTaxDeclareRecordWrapper(user)::contrast, taxDeclarationId); } @@ -380,7 +382,6 @@ public class TaxDeclarationController { } - /** * 刷新数据 * diff --git a/src/com/engine/salary/wrapper/TaxDeclareRecordWrapper.java b/src/com/engine/salary/wrapper/TaxDeclareRecordWrapper.java index b822db00f..a1dfa6579 100644 --- a/src/com/engine/salary/wrapper/TaxDeclareRecordWrapper.java +++ b/src/com/engine/salary/wrapper/TaxDeclareRecordWrapper.java @@ -312,6 +312,7 @@ public class TaxDeclareRecordWrapper extends Service { /** * 新增申报表 + * * @param param */ public void addTaxDeclaration(TaxDeclarationAddParam param) { @@ -638,10 +639,11 @@ public class TaxDeclareRecordWrapper extends Service { /** * 对比算税结果 + * * @param id */ - public void contrast(Long id) { - getTaxDeclarationValueService(user).contrast(id); + public Map contrast(Long id) { + return getTaxDeclarationValueService(user).contrast(id); } /** @@ -724,6 +726,7 @@ public class TaxDeclareRecordWrapper extends Service { /** * 新增表单 + * * @param param * @return */ @@ -735,7 +738,7 @@ public class TaxDeclareRecordWrapper extends Service { } // 查询个税申报表列 - List taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.parseByValue(taxDeclaration.getIncomeCategory()),0); + List taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.parseByValue(taxDeclaration.getIncomeCategory()), 0); //当前税款所属期报送成功且状态正常的人员 List employeeDeclarePOS = getEmployeeDeclareService(user).listByParam( EmployeeDeclareListQueryParam @@ -780,6 +783,7 @@ public class TaxDeclareRecordWrapper extends Service { /** * 详细信息 + * * @param id * @return */ @@ -801,7 +805,7 @@ public class TaxDeclareRecordWrapper extends Service { } EmployeeDeclarePO employeeDeclarePO = employeeDeclarePOS.get(0); // 查询个税申报表列 - List taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.parseByValue(taxDeclarationPO.getIncomeCategory()),0); + List taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.parseByValue(taxDeclarationPO.getIncomeCategory()), 0); return TaxDeclareRecordDetailFormDTO .builder() .id(id)