From f3fa6c6f3222c42d1aa31bec30a94b1f1e6111b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Thu, 4 Jan 2024 15:35:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TaxDeclarationValueListQueryParam.java | 5 + .../taxdeclaration/po/TaxReportColumnPO.java | 70 ++++- .../taxdeclaration/TaxReportColumnMapper.java | 58 ---- .../taxdeclaration/TaxReportColumnMapper.xml | 296 +----------------- .../service/TaxDeclareRecordService.java | 20 +- .../service/TaxReportColumnService.java | 2 +- .../impl/TaxDeclarationExcelServiceImpl.java | 4 +- .../impl/TaxDeclarationValueServiceImpl.java | 24 +- .../impl/TaxDeclareRecordServiceImpl.java | 6 + .../impl/TaxReportColumnServiceImpl.java | 9 +- .../salary/web/TaxDeclarationController.java | 15 + .../wrapper/TaxDeclareRecordWrapper.java | 19 +- 12 files changed, 155 insertions(+), 373 deletions(-) diff --git a/src/com/engine/salary/entity/taxdeclaration/param/TaxDeclarationValueListQueryParam.java b/src/com/engine/salary/entity/taxdeclaration/param/TaxDeclarationValueListQueryParam.java index 864c4dac9..ff40cf181 100644 --- a/src/com/engine/salary/entity/taxdeclaration/param/TaxDeclarationValueListQueryParam.java +++ b/src/com/engine/salary/entity/taxdeclaration/param/TaxDeclarationValueListQueryParam.java @@ -26,4 +26,9 @@ public class TaxDeclarationValueListQueryParam extends BaseQueryParam { //导出excel时加密的密码") private String sharePassword; + + /** + * 姓名或者工号 + */ + private String keyword; } diff --git a/src/com/engine/salary/entity/taxdeclaration/po/TaxReportColumnPO.java b/src/com/engine/salary/entity/taxdeclaration/po/TaxReportColumnPO.java index a6591e714..f2b61a35e 100644 --- a/src/com/engine/salary/entity/taxdeclaration/po/TaxReportColumnPO.java +++ b/src/com/engine/salary/entity/taxdeclaration/po/TaxReportColumnPO.java @@ -23,32 +23,76 @@ import java.util.Date; //hrsa_tax_report_column public class TaxReportColumnPO { - //name = 主键id + /** + * 主键id + */ private Long id; - //name = 报表类型 + + /** + * 报表类型 + */ private String taxReportType; - //name = 所得项目 + + /** + * 所得项目 + */ private String incomeCategory; - //name = 申报表的列名 + + /** + * 申报表的列名 + */ private String reportColumnName; - //name = 申报表的列名多语言标签 + + /** + * 申报表的列名多语言标签 + */ private Integer reportColumnLabel; - //name = 申报表的列索引 + + /** + * 申报表的列索引 + */ private String reportColumnDataIndex; - //name = 数值类型 + + /** + * 数值类型 + */ private String dataType; - //name = 个税对接时的参数key + + /** + * 个税对接时的参数key + */ private String requestParamKey; - //name = 租户key + + /** + * 是否是对比字段,1是0否 + */ + private Integer contrastType; + + /** + * 租户key + */ private String tenantKey; - //name = 创建人id + + /** + * 创建人id + */ private Long creator; - //name = 是否删除 + + /** + * 是否删除 + */ private Integer deleteType; - //name = 创建时间 + + /** + * 创建时间 + */ private Date createTime; - //name = 更新时间 + + /** + * 更新时间 + */ private Date updateTime; Collection ids; + Collection contrastTypes; } diff --git a/src/com/engine/salary/mapper/taxdeclaration/TaxReportColumnMapper.java b/src/com/engine/salary/mapper/taxdeclaration/TaxReportColumnMapper.java index df8f8738a..1f767ca48 100644 --- a/src/com/engine/salary/mapper/taxdeclaration/TaxReportColumnMapper.java +++ b/src/com/engine/salary/mapper/taxdeclaration/TaxReportColumnMapper.java @@ -1,9 +1,7 @@ package com.engine.salary.mapper.taxdeclaration; import com.engine.salary.entity.taxdeclaration.po.TaxReportColumnPO; -import org.apache.ibatis.annotations.Param; -import java.util.Collection; import java.util.List; public interface TaxReportColumnMapper { @@ -21,60 +19,4 @@ public interface TaxReportColumnMapper { * @return 返回集合,没有返回空List */ List listSome(TaxReportColumnPO taxReportColumn); - - - /** - * 根据主键查询 - * - * @param id 主键 - * @return 返回记录,没有返回null - */ - TaxReportColumnPO getById(Long id); - - /** - * 新增,忽略null字段 - * - * @param taxReportColumn 新增的记录 - * @return 返回影响行数 - */ - int insertIgnoreNull(TaxReportColumnPO taxReportColumn); - - /** - * 批量插入 - * - * @param taxReportColumn - */ - void batchInsert(@Param("collection") List taxReportColumn); - - /** - * 修改,修改所有字段 - * - * @param taxReportColumn 修改的记录 - * @return 返回影响行数 - */ - int update(TaxReportColumnPO taxReportColumn); - - /** - * 修改,忽略null字段 - * - * @param taxReportColumn 修改的记录 - * @return 返回影响行数 - */ - int updateIgnoreNull(TaxReportColumnPO taxReportColumn); - - /** - * 删除记录 - * - * @param taxReportColumn 待删除的记录 - * @return 返回影响行数 - */ - int delete(TaxReportColumnPO taxReportColumn); - - /** - * 批量删除记录 - * - * @param ids 主键id集合 - */ - void deleteByIds(@Param("ids") Collection ids); - } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxdeclaration/TaxReportColumnMapper.xml b/src/com/engine/salary/mapper/taxdeclaration/TaxReportColumnMapper.xml index 1002208a0..7ce9c9fae 100644 --- a/src/com/engine/salary/mapper/taxdeclaration/TaxReportColumnMapper.xml +++ b/src/com/engine/salary/mapper/taxdeclaration/TaxReportColumnMapper.xml @@ -15,6 +15,7 @@ + @@ -34,6 +35,7 @@ , t.data_type , t.request_param_key , t.report_column_label + , t.contrast_type @@ -98,299 +100,23 @@ AND report_column_label = #{reportColumnLabel} + + AND contrast_type = #{contrastType} + AND id IN #{id} + + AND contrast_type IN + + #{contrastType} + + ORDER BY id - - - INSERT INTO hrsa_tax_report_column - - - - id, - - - create_time, - - - update_time, - - - creator, - - - delete_type, - - - tenant_key, - - - tax_report_type, - - - income_category, - - - report_column_name, - - - report_column_data_index, - - - data_type, - - - request_param_key, - - - report_column_label, - - - - - #{id}, - - - #{createTime}, - - - #{updateTime}, - - - #{creator}, - - - #{deleteType}, - - - #{tenantKey}, - - - #{taxReportType}, - - - #{incomeCategory}, - - - #{reportColumnName}, - - - #{reportColumnDataIndex}, - - - #{dataType}, - - - #{requestParamKey}, - - - #{reportColumnLabel}, - - - - - - - - INSERT INTO hrsa_tax_report_column - ( - id, - create_time, - update_time, - creator, - delete_type, - tenant_key, - tax_report_type, - income_category, - report_column_name, - report_column_data_index, - data_type, - request_param_key, - report_column_label - ) - VALUES - ( - - #{item.id}, - #{item.createTime}, - #{item.updateTime}, - #{item.creator}, - #{item.deleteType}, - #{item.tenantKey}, - #{item.taxReportType}, - #{item.incomeCategory}, - #{item.reportColumnName}, - #{item.reportColumnDataIndex}, - #{item.dataType}, - #{item.requestParamKey}, - #{item.reportColumnLabel} - - ) - - - - - INSERT INTO hrsa_tax_report_column ( - id, - create_time, - update_time, - creator, - delete_type, - tenant_key, - tax_report_type, - income_category, - report_column_name, - report_column_data_index, - data_type, - request_param_key, - report_column_label - ) - - - select - #{item.id,jdbcType=DOUBLE}, - #{item.createTime,jdbcType=DATE}, - #{item.updateTime,jdbcType=DATE}, - #{item.creator,jdbcType=DOUBLE}, - #{item.deleteType,jdbcType=INTEGER}, - #{item.tenantKey,jdbcType=VARCHAR}, - #{item.taxReportType,jdbcType=INTEGER}, - #{item.incomeCategory,jdbcType=INTEGER}, - #{item.reportColumnName,jdbcType=VARCHAR}, - #{item.reportColumnDataIndex,jdbcType=VARCHAR}, - #{item.dataType,jdbcType=VARCHAR}, - #{item.requestParamKey,jdbcType=VARCHAR}, - #{item.reportColumnLabel,jdbcType=INTEGER} - from dual - - - - - - - INSERT INTO hrsa_tax_report_column ( - id, - create_time, - update_time, - creator, - delete_type, - tenant_key, - tax_report_type, - income_category, - report_column_name, - report_column_data_index, - data_type, - request_param_key, - report_column_label - ) - VALUES - ( - #{item.id}, - #{item.createTime}, - #{item.updateTime}, - #{item.creator}, - #{item.deleteType}, - #{item.tenantKey}, - #{item.taxReportType}, - #{item.incomeCategory}, - #{item.reportColumnName}, - #{item.reportColumnDataIndex}, - #{item.dataType}, - #{item.requestParamKey}, - #{item.reportColumnLabel} - ) - - - - - UPDATE hrsa_tax_report_column - - create_time=#{createTime}, - update_time=#{updateTime}, - creator=#{creator}, - delete_type=#{deleteType}, - tenant_key=#{tenantKey}, - tax_report_type=#{taxReportType}, - income_category=#{incomeCategory}, - report_column_name=#{reportColumnName}, - report_column_data_index=#{reportColumnDataIndex}, - data_type=#{dataType}, - request_param_key=#{requestParamKey}, - report_column_label=#{reportColumnLabel}, - - WHERE id = #{id} AND delete_type = 0 - - - - - - UPDATE hrsa_tax_report_column - - - create_time=#{createTime}, - - - update_time=#{updateTime}, - - - creator=#{creator}, - - - delete_type=#{deleteType}, - - - tenant_key=#{tenantKey}, - - - tax_report_type=#{taxReportType}, - - - income_category=#{incomeCategory}, - - - report_column_name=#{reportColumnName}, - - - report_column_data_index=#{reportColumnDataIndex}, - - - data_type=#{dataType}, - - - request_param_key=#{requestParamKey}, - - - report_column_label=#{reportColumnLabel}, - - - WHERE id = #{id} AND delete_type = 0 - - - - - - UPDATE hrsa_tax_report_column - SET delete_type=1 - WHERE id = #{id} - AND delete_type = 0 - - - - UPDATE hrsa_tax_report_column - SET delete_type = 1 - WHERE delete_type = 0 - AND id IN - - #{id} - - - - \ No newline at end of file diff --git a/src/com/engine/salary/service/TaxDeclareRecordService.java b/src/com/engine/salary/service/TaxDeclareRecordService.java index 16478a170..1d844978a 100644 --- a/src/com/engine/salary/service/TaxDeclareRecordService.java +++ b/src/com/engine/salary/service/TaxDeclareRecordService.java @@ -81,6 +81,19 @@ public interface TaxDeclareRecordService { */ void save(TaxDeclarationSaveParam saveParam); + /** + * 税局端申报明细查询 + * + * @param id + */ + String queryCompanyIncomes(Long id); + + /** + * 对比线上和线下算税 + * @param id + */ + void contrast(Long id); + /** * 刷新数据 @@ -179,12 +192,7 @@ public interface TaxDeclareRecordService { */ String queryDeclareStatus(Long id); - /** - * 税局端申报明细查询 - * - * @param id - */ - String queryCompanyIncomes(Long id); + void updateById(TaxDeclareRecordPO taxDeclareRecord); diff --git a/src/com/engine/salary/service/TaxReportColumnService.java b/src/com/engine/salary/service/TaxReportColumnService.java index c9f466e14..329cd697e 100644 --- a/src/com/engine/salary/service/TaxReportColumnService.java +++ b/src/com/engine/salary/service/TaxReportColumnService.java @@ -28,5 +28,5 @@ public interface TaxReportColumnService { * @param incomeCategory * @return */ - List listByIncomeCategory(IncomeCategoryEnum incomeCategory); + List listByIncomeCategory(IncomeCategoryEnum incomeCategory, Integer... contrastTypes); } diff --git a/src/com/engine/salary/service/impl/TaxDeclarationExcelServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationExcelServiceImpl.java index 5f5796e39..f8a7db934 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationExcelServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationExcelServiceImpl.java @@ -197,7 +197,7 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar public XSSFWorkbook downloadTemplate(DownloadTemplateParam param) { TaxDeclarationPO declarationPO = getTaxDeclarationService(user).getById(param.getTaxDeclarationId()); IncomeCategoryEnum incomeCategoryEnum = IncomeCategoryEnum.parseByValue(declarationPO.getIncomeCategory()); - List taxReportColumnPOS = getTaxReportColumnService(user).listByIncomeCategory(incomeCategoryEnum); + List taxReportColumnPOS = getTaxReportColumnService(user).listByIncomeCategory(incomeCategoryEnum,0); List heads = new ArrayList<>(); @@ -247,7 +247,7 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar TaxDeclarationPO declarationPO = getTaxDeclarationService(user).getById(param.getTaxDeclarationId()); IncomeCategoryEnum incomeCategoryEnum = IncomeCategoryEnum.parseByValue(declarationPO.getIncomeCategory()); - List taxReportColumnPOS = getTaxReportColumnService(user).listByIncomeCategory(incomeCategoryEnum); + List taxReportColumnPOS = getTaxReportColumnService(user).listByIncomeCategory(incomeCategoryEnum,0); List taxReportColumnNames = SalaryEntityUtil.properties(taxReportColumnPOS, TaxReportColumnPO::getReportColumnName, Collectors.toList()); List taxDeclarationValuePOS = getTaxDeclarationValueService(user).listByTaxDeclarationId(declarationPO.getId()); diff --git a/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java index 80e1c8209..34191ae36 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java @@ -41,6 +41,8 @@ import weaver.hrm.User; import java.util.*; import java.util.stream.Collectors; +import static weaver.conn.ExternalDataSourceManager.list; + /** * 个税申报表 *

Copyright: Copyright (c) 2023

@@ -109,7 +111,7 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar public TaxDeclarationValueListDTO convert2List(TaxDeclarationPO taxDeclaration, List taxDeclarationValues) { // 查询个税申报表表头 IncomeCategoryEnum incomeCategoryEnum = SalaryEnumUtil.enumMatchByValue(taxDeclaration.getIncomeCategory(), IncomeCategoryEnum.class); - List taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(incomeCategoryEnum); + List taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(incomeCategoryEnum, 0); // 人员id Set employeeIds = SalaryEntityUtil.properties(taxDeclarationValues, TaxDeclarationValuePO::getEmployeeId); // 查询报送的人员 @@ -272,7 +274,7 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar } //正常薪资的表头 - List taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.WAGES_AND_SALARIES); + List taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.WAGES_AND_SALARIES, 0); Map valueMap = Maps.newHashMap(); for (TaxReportColumnPO taxReportColumn : taxReportColumns) { String value = Objects.equals(taxReportColumn.getDataType(), SalaryDataTypeEnum.NUMBER.getValue()) ? "0.00" : ""; @@ -328,4 +330,22 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar })).collect(Collectors.toList()); batchSave(autoAddValuePOs); } + + public void contrast(Long taxDeclarationId) { + TaxDeclarationPO declarationPO = getTaxDeclarationService(user).getById(taxDeclarationId); + if (declarationPO == null) { + throw new SalaryRunTimeException("无申报表"); + } + TaxDeclarationPO taxDeclarationPO; + + if (CollectionUtils.isNotEmpty(list)) { + if (list.size() > 1) { + throw new SalaryRunTimeException("存在多条正常工资薪金申报表数据"); + } + taxDeclarationPO = list.get(0); + } else { + + } + + } } diff --git a/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java index 00c26572a..61199ba8f 100644 --- a/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java @@ -1113,6 +1113,12 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe return res; } + @Override + public void contrast(Long id) { + + + } + @Override public void updateById(TaxDeclareRecordPO taxDeclareRecord) { getTaxDeclareRecordMapper().updateIgnoreNull(taxDeclareRecord); diff --git a/src/com/engine/salary/service/impl/TaxReportColumnServiceImpl.java b/src/com/engine/salary/service/impl/TaxReportColumnServiceImpl.java index 1ddd88cdc..30ebbe9d5 100644 --- a/src/com/engine/salary/service/impl/TaxReportColumnServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxReportColumnServiceImpl.java @@ -7,6 +7,7 @@ import com.engine.salary.mapper.taxdeclaration.TaxReportColumnMapper; import com.engine.salary.service.TaxReportColumnService; import com.engine.salary.util.db.MapperProxyFactory; +import java.util.Arrays; import java.util.List; /** @@ -17,7 +18,7 @@ import java.util.List; * @author qiantao * @version 1.0 **/ -public class TaxReportColumnServiceImpl extends Service implements TaxReportColumnService { +public class TaxReportColumnServiceImpl extends Service implements TaxReportColumnService { private TaxReportColumnMapper getTaxReportColumnMapper() { return MapperProxyFactory.getProxy(TaxReportColumnMapper.class); @@ -26,11 +27,11 @@ public class TaxReportColumnServiceImpl extends Service implements TaxReportCol @Override public List listAll() { - return getTaxReportColumnMapper().listAll(); + return getTaxReportColumnMapper().listAll(); } @Override - public List listByIncomeCategory(IncomeCategoryEnum incomeCategory) { - return getTaxReportColumnMapper().listSome(TaxReportColumnPO.builder().incomeCategory(incomeCategory.getValue().toString()).build()); + public List listByIncomeCategory(IncomeCategoryEnum incomeCategory, Integer... contrastTypes) { + return getTaxReportColumnMapper().listSome(TaxReportColumnPO.builder().contrastTypes(Arrays.asList(contrastTypes)).incomeCategory(incomeCategory.getValue().toString()).build()); } } diff --git a/src/com/engine/salary/web/TaxDeclarationController.java b/src/com/engine/salary/web/TaxDeclarationController.java index c4e3a82a6..d7561a977 100644 --- a/src/com/engine/salary/web/TaxDeclarationController.java +++ b/src/com/engine/salary/web/TaxDeclarationController.java @@ -364,6 +364,21 @@ public class TaxDeclarationController { return new ResponseResult(user).run(getTaxDeclareRecordWrapper(user)::queryCompanyIncomes, taxDeclareRecordParam.getTaxDeclareRecordId()); } + /** + * 对比算税过程 + * @param request + * @param response + * @param taxDeclareRecordParam + * @return + */ + @POST + @Path("/contrast") + @Produces(MediaType.APPLICATION_JSON) + public String contrast(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclareRecordParam taxDeclareRecordParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getTaxDeclareRecordWrapper(user)::contrast, taxDeclareRecordParam.getTaxDeclareRecordId()); + } + /** * 刷新数据 * diff --git a/src/com/engine/salary/wrapper/TaxDeclareRecordWrapper.java b/src/com/engine/salary/wrapper/TaxDeclareRecordWrapper.java index d8c0b7072..621721de5 100644 --- a/src/com/engine/salary/wrapper/TaxDeclareRecordWrapper.java +++ b/src/com/engine/salary/wrapper/TaxDeclareRecordWrapper.java @@ -636,6 +636,11 @@ public class TaxDeclareRecordWrapper extends Service { return getTaxDeclareRecordService(user).queryCompanyIncomes(id); } + + public void contrast(Long id) { + getTaxDeclareRecordService(user).contrast(id); + } + /** * 刷新数据 * @@ -714,6 +719,11 @@ public class TaxDeclareRecordWrapper extends Service { return getTaxDeclarationExcelService(user).exportEmployee4Fail(queryParam); } + /** + * 新增表单 + * @param param + * @return + */ public TaxDeclareRecordDetailFormDTO getAddForm(TaxDeclareRecordDetailFormParam param) { TaxDeclarationPO taxDeclaration = getTaxDeclarationService(user).getById(param.getTaxDeclarationId()); @@ -722,7 +732,7 @@ public class TaxDeclareRecordWrapper extends Service { } // 查询个税申报表列 - List taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.parseByValue(taxDeclaration.getIncomeCategory())); + List taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.parseByValue(taxDeclaration.getIncomeCategory()),0); //当前税款所属期报送成功且状态正常的人员 List employeeDeclarePOS = getEmployeeDeclareService(user).listByParam( EmployeeDeclareListQueryParam @@ -765,6 +775,11 @@ public class TaxDeclareRecordWrapper extends Service { getTaxDeclarationValueService(user).edit(param); } + /** + * 详细信息 + * @param id + * @return + */ public TaxDeclareRecordDetailFormDTO detailInfo(Long id) { TaxDeclarationValuePO declarationValuePO = getTaxDeclarationValueService(user).getById(id); TaxDeclarationPO taxDeclarationPO = getTaxDeclarationService(user).getById(declarationValuePO.getTaxDeclarationId()); @@ -783,7 +798,7 @@ public class TaxDeclareRecordWrapper extends Service { } EmployeeDeclarePO employeeDeclarePO = employeeDeclarePOS.get(0); // 查询个税申报表列 - List taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.parseByValue(taxDeclarationPO.getIncomeCategory())); + List taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.parseByValue(taxDeclarationPO.getIncomeCategory()),0); return TaxDeclareRecordDetailFormDTO .builder() .id(id)