From 6f3d8e85c0cecda3cb9b85a357ab21da2ee88e2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Mon, 9 May 2022 17:47:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E7=A8=8E=E7=94=B3=E6=8A=A5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salaryitem/dto/SalaryItemListDTO.java | 4 +- .../taxdeclaration/bo/TaxDeclarationBO.java | 6 +- .../datacollection/AddUpSituationMapper.java | 2 + .../datacollection/AddUpSituationMapper.xml | 15 +- .../taxdeclaration/TaxDeclarationMapper.xml | 9 +- .../salary/service/AddUpSituationService.java | 3 + .../impl/AddUpSituationServiceImpl.java | 68 +++++--- .../salary/wrapper/TaxDeclarationWrapper.java | 159 +++++++++--------- 8 files changed, 150 insertions(+), 116 deletions(-) diff --git a/src/com/engine/salary/entity/salaryitem/dto/SalaryItemListDTO.java b/src/com/engine/salary/entity/salaryitem/dto/SalaryItemListDTO.java index 48ffbdb3b..79dd67bd3 100644 --- a/src/com/engine/salary/entity/salaryitem/dto/SalaryItemListDTO.java +++ b/src/com/engine/salary/entity/salaryitem/dto/SalaryItemListDTO.java @@ -85,10 +85,10 @@ public class SalaryItemListDTO { //是否可以编辑 - private boolean canEdit; + private Boolean canEdit; //是否可以删除 - private boolean canDelete; + private Boolean canDelete; @SalaryTableColumn(text = "操作", width = "20%", column = "operate") private String operate; diff --git a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationBO.java b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationBO.java index 5657e0c77..5bfe09b17 100644 --- a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationBO.java +++ b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationBO.java @@ -38,9 +38,9 @@ public class TaxDeclarationBO { public static List convert2ListDTO(List taxDeclarations, List simpleEmployees, List taxAgents) { - if (CollectionUtils.isEmpty(simpleEmployees)) { - return Collections.emptyList(); - } +// if (CollectionUtils.isEmpty(simpleEmployees)) { +// return Collections.emptyList(); +// } Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgent::getId, TaxAgent::getName); Map employeeNameMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getUsername); return taxDeclarations.stream().map(e -> TaxDeclarationListDTO.builder() diff --git a/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.java b/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.java index 18a7e70b5..7b798b479 100644 --- a/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.java +++ b/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.java @@ -98,4 +98,6 @@ public interface AddUpSituationMapper { void updateData(@Param("collection") List updateList); void deleteSome(@Param("param") AddUpSituation params); + + void deleteByTaxYearMonthAndTaxAgentIds(@Param("param") AddUpSituation params); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.xml b/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.xml index 0c67e7618..bfb5b79c8 100644 --- a/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.xml @@ -980,7 +980,7 @@ UPDATE hrsa_add_up_situation SET delete_type=1 - WHERE id = #{id} AND delete_type = 0 + WHERE delete_type = 0 AND tax_year_month = #{param.taxYearMonth} AND employee_id IN @@ -991,4 +991,17 @@ + + UPDATE hrsa_add_up_situation + SET delete_type=1 + WHERE delete_type = 0 + AND tax_year_month = #{param.taxYearMonth} + + AND tax_agent_id IN + + #{taxAgentId} + + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationMapper.xml b/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationMapper.xml index 96e351c33..22261ae8d 100644 --- a/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationMapper.xml +++ b/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationMapper.xml @@ -59,11 +59,12 @@ ORDER BY id DESC - INSERT INTO hrsa_tax_declaration( salary_month, tax_cycle, tax_agent_id, description, + INSERT INTO hrsa_tax_declaration(id, salary_month, tax_cycle, tax_agent_id, description, creator, create_time, update_time, delete_type, tenant_key) VALUES ( + #{item.id}, #{item.salaryMonth}, #{item.taxCycle}, #{item.taxAgentId}, @@ -77,11 +78,12 @@ - INSERT INTO hrsa_tax_declaration(salary_month, tax_cycle, tax_agent_id, description, + INSERT INTO hrsa_tax_declaration(id,salary_month, tax_cycle, tax_agent_id, description, creator, create_time, update_time, delete_type, tenant_key) select + #{item.id}, #{item.salaryMonth}, #{item.taxCycle}, #{item.taxAgentId}, @@ -96,10 +98,11 @@ - INSERT INTO hrsa_tax_declaration(salary_month, tax_cycle, tax_agent_id, description, + INSERT INTO hrsa_tax_declaration(id,salary_month, tax_cycle, tax_agent_id, description, creator, create_time, update_time, delete_type, tenant_key) VALUES ( + #{item.id}, #{item.salaryMonth}, #{item.taxCycle}, #{item.taxAgentId}, diff --git a/src/com/engine/salary/service/AddUpSituationService.java b/src/com/engine/salary/service/AddUpSituationService.java index f2a64fcca..7b3210f92 100644 --- a/src/com/engine/salary/service/AddUpSituationService.java +++ b/src/com/engine/salary/service/AddUpSituationService.java @@ -5,6 +5,7 @@ import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import java.time.YearMonth; +import java.util.Collection; import java.util.List; import java.util.Map; @@ -42,4 +43,6 @@ public interface AddUpSituationService { boolean deleteAddUpSituationList(YearMonth taxYearMonth, List employeeIds); XSSFWorkbook downloadTemplate(AddUpSituationQueryParam queryParam); + + boolean deleteByTaxYearMonthAndTaxAgentIds(YearMonth localDate2YearMonth, Collection taxAgentIds); } diff --git a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java index 1c1a92e9d..2e4aab5ef 100644 --- a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java @@ -67,7 +67,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation AddUpSituation po = biz.getById(id); if (po == null) { - throw new SalaryRunTimeException(String.format("累计情况不存在"+"[id:%s]", id)); + throw new SalaryRunTimeException(String.format("累计情况不存在" + "[id:%s]", id)); } List employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId())); @@ -119,31 +119,31 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation @Override public XSSFWorkbook downloadTemplate(AddUpSituationQueryParam queryParam) { - String sheetName = SalaryI18nUtil.getI18nLabel( 101605, "往期累计情况导入模板"); + String sheetName = SalaryI18nUtil.getI18nLabel(101605, "往期累计情况导入模板"); String[] header = { - SalaryI18nUtil.getI18nLabel( 85429, "姓名"), - SalaryI18nUtil.getI18nLabel( 86184, "个税扣缴义务人"), - SalaryI18nUtil.getI18nLabel( 86185, "部门"), - SalaryI18nUtil.getI18nLabel( 86186, "手机号"), - SalaryI18nUtil.getI18nLabel( 86317, "工号"), - SalaryI18nUtil.getI18nLabel( 86318, "证件号码"), - SalaryI18nUtil.getI18nLabel( 86319, "入职日期"), - SalaryI18nUtil.getI18nLabel( 86712, "累计收入额"), - SalaryI18nUtil.getI18nLabel( 86711, "累计减除费用"), - SalaryI18nUtil.getI18nLabel( 86710, "累计社保个人合计"), - SalaryI18nUtil.getI18nLabel( 86709, "累计公积金个人合计"), - SalaryI18nUtil.getI18nLabel( 86321, "累计子女教育"), - SalaryI18nUtil.getI18nLabel( 86323, "累计继续教育"), - SalaryI18nUtil.getI18nLabel( 86324, "累计住房贷款利息"), - SalaryI18nUtil.getI18nLabel( 86325, "累计住房租金"), - SalaryI18nUtil.getI18nLabel( 86326, "累计赡养老人"), - SalaryI18nUtil.getI18nLabel( 105142, "累计大病医疗"), - SalaryI18nUtil.getI18nLabel( 90567, "累计企业(职业)年金及其他福利"), - SalaryI18nUtil.getI18nLabel( 93902, "累计其他免税扣除"), - SalaryI18nUtil.getI18nLabel( 86704, "累计免税收入"), - SalaryI18nUtil.getI18nLabel( 86703, "累计准予扣除的捐赠额"), - SalaryI18nUtil.getI18nLabel( 105478, "累计减免税额"), - SalaryI18nUtil.getI18nLabel( 86702, "累计已预扣预缴税额") + SalaryI18nUtil.getI18nLabel(85429, "姓名"), + SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"), + SalaryI18nUtil.getI18nLabel(86185, "部门"), + SalaryI18nUtil.getI18nLabel(86186, "手机号"), + SalaryI18nUtil.getI18nLabel(86317, "工号"), + SalaryI18nUtil.getI18nLabel(86318, "证件号码"), + SalaryI18nUtil.getI18nLabel(86319, "入职日期"), + SalaryI18nUtil.getI18nLabel(86712, "累计收入额"), + SalaryI18nUtil.getI18nLabel(86711, "累计减除费用"), + SalaryI18nUtil.getI18nLabel(86710, "累计社保个人合计"), + SalaryI18nUtil.getI18nLabel(86709, "累计公积金个人合计"), + SalaryI18nUtil.getI18nLabel(86321, "累计子女教育"), + SalaryI18nUtil.getI18nLabel(86323, "累计继续教育"), + SalaryI18nUtil.getI18nLabel(86324, "累计住房贷款利息"), + SalaryI18nUtil.getI18nLabel(86325, "累计住房租金"), + SalaryI18nUtil.getI18nLabel(86326, "累计赡养老人"), + SalaryI18nUtil.getI18nLabel(105142, "累计大病医疗"), + SalaryI18nUtil.getI18nLabel(90567, "累计企业(职业)年金及其他福利"), + SalaryI18nUtil.getI18nLabel(93902, "累计其他免税扣除"), + SalaryI18nUtil.getI18nLabel(86704, "累计免税收入"), + SalaryI18nUtil.getI18nLabel(86703, "累计准予扣除的捐赠额"), + SalaryI18nUtil.getI18nLabel(105478, "累计减免税额"), + SalaryI18nUtil.getI18nLabel(86702, "累计已预扣预缴税额") }; // 2.表头 List headerList = Arrays.asList(header); @@ -151,13 +151,13 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation // 获取累计情况 List list = getAddUpSituationMapper().list(queryParam); // 人员信息赋值 - list.forEach(m->{ + list.forEach(m -> { // todo 身份证号 m.setIdNo(null); }); List> rows = new ArrayList<>(); - rows.add(headerList);; + rows.add(headerList); for (AddUpSituationDTO dto : list) { List row = new ArrayList<>(); row.add(dto.getUsername()); @@ -166,7 +166,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation row.add(dto.getMobile()); row.add(dto.getJobNum()); row.add(dto.getIdNo()); - row.add(dto.getHiredate()+""); + row.add(dto.getHiredate() + ""); row.add(dto.getAddUpIncome()); row.add(dto.getAddUpSubtraction()); row.add(dto.getAddUpSocialSecurityTotal()); @@ -210,4 +210,16 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation return book; } + + @Override + public boolean deleteByTaxYearMonthAndTaxAgentIds(YearMonth taxYearMonth, Collection taxAgentIds) { + if (taxYearMonth == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100353, "参数有误:税款所属期必传")); + } + Date date = SalaryDateUtil.localDateToDate(taxYearMonth.atDay(1)); + + getAddUpSituationMapper().deleteByTaxYearMonthAndTaxAgentIds(AddUpSituation.builder().taxYearMonth(date).taxAgentIds(taxAgentIds).build()); + + return Boolean.TRUE; + } } diff --git a/src/com/engine/salary/wrapper/TaxDeclarationWrapper.java b/src/com/engine/salary/wrapper/TaxDeclarationWrapper.java index dfd5feb8d..81142f67c 100644 --- a/src/com/engine/salary/wrapper/TaxDeclarationWrapper.java +++ b/src/com/engine/salary/wrapper/TaxDeclarationWrapper.java @@ -34,14 +34,10 @@ import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.google.common.collect.Lists; -import com.google.j2objc.annotations.AutoreleasePool; -import com.weaverboot.frame.ioc.anno.fieldAnno.WeaAutowired; import org.apache.commons.collections4.CollectionUtils; -import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import weaver.hrm.User; -import javax.annotation.Resource; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -66,6 +62,15 @@ public class TaxDeclarationWrapper extends Service { private TaxAgentService getTaxAgentService(User user) { return (TaxAgentService) ServiceUtil.getService(TaxAgentServiceImpl.class, user); } + + private TaxDeclarationDetailService getTaxDeclarationDetailService(User user) { + return (TaxDeclarationDetailService) ServiceUtil.getService(TaxDeclarationDetailServiceImpl.class, user); + } + + private SalaryAcctRecordService getSalaryAcctRecordService(User user) { + return (SalaryAcctRecordService) ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user); + } + private TaxDeclarationMapper getTaxDeclarationMapper() { return MapperProxyFactory.getProxy(TaxDeclarationMapper.class); } @@ -74,22 +79,27 @@ public class TaxDeclarationWrapper extends Service { return MapperProxyFactory.getProxy(SalaryAcctRecordMapper.class); } -// @Resource - private TaxAgentBiz taxAgentBiz = new TaxAgentBiz(); - @Resource - private SalaryItemBiz salaryItemBiz; - @WeaAutowired - private TaxDeclarationDetailService taxDeclarationDetailService; - @Resource - private SalaryAcctResultService salaryAcctResultService; - @Resource - private SalaryAcctRecordService salaryAcctRecordService; - @Resource - private AddUpSituationMapper addUpSituationMapper; - @Resource - private TaxDeclarationMapper taxDeclarationMapper; - @Resource - private SalarySobService salarySobService; + private TaxAgentBiz taxAgentBiz = new TaxAgentBiz(); +// private SalaryItemBiz salaryItemBiz; +// private TaxDeclarationDetailService taxDeclarationDetailService; +// private SalaryAcctResultService salaryAcctResultService; +// private SalaryAcctRecordService salaryAcctRecordService; + + private AddUpSituationMapper getAddUpSituationMapper() { + return MapperProxyFactory.getProxy(AddUpSituationMapper.class); + } + + private AddUpSituationService getAddUpSituationService(User user) { + return (AddUpSituationService) ServiceUtil.getService(AddUpSituationServiceImpl.class, user); + } + + private SalarySobService getSalarySobService(User user) { + return (SalarySobService) ServiceUtil.getService(SalarySobServiceImpl.class, user); + } + + +// private TaxDeclarationMapper taxDeclarationMapper; + /** * 个税申报表列表 @@ -115,44 +125,44 @@ public class TaxDeclarationWrapper extends Service { //List taxAgentPOS = new TaxAgentBiz().listByIds(taxAgentIds); List taxAgentPOS = getTaxDeclarationService(user).countByTaxDeclarationId(taxAgentIds); // 转换成列表dto - List taxDeclarationListDTOS = TaxDeclarationBO.convert2ListDTO(list, employeeComInfos, taxAgentPOS); + List taxDeclarationListDTOS = TaxDeclarationBO.convert2ListDTO(list, employeeComInfos, taxAgentPOS); dtoPage.setList(taxDeclarationListDTOS); } return dtoPage; } - public TaxDeclarationFormDTO getForm(Long id) { - TaxDeclarationFormDTO formDTO = new TaxDeclarationFormDTO(); - if (Objects.nonNull(id)) { - // 查询个税申报表 - TaxDeclaration taxDeclaration = getTaxDeclarationService(user).getById(id); - if (Objects.isNull(taxDeclaration)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98877, "个税申报表不存在或已删除")); - } - // 查询个税扣缴义务人 - TaxAgent taxAgent = new TaxAgentBiz().getById(id); - //日期转换 - SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM"); - String transformDate=simpleDateFormat.format(taxDeclaration.getSalaryMonth()); - // 转换成个税申报表详情dto - formDTO = TaxDeclarationFormDTO.builder() - .salaryMonth(SalaryDateUtil.String2YearMonth(transformDate)) - .taxAgentId(taxDeclaration.getTaxAgentId()) - .taxAgentName(Optional.ofNullable(taxAgent).map(TaxAgent::getName).orElse("")) - .description(taxDeclaration.getDescription()) - .build(); + public TaxDeclarationFormDTO getForm(Long id) { + TaxDeclarationFormDTO formDTO = new TaxDeclarationFormDTO(); + if (Objects.nonNull(id)) { + // 查询个税申报表 + TaxDeclaration taxDeclaration = getTaxDeclarationService(user).getById(id); + if (Objects.isNull(taxDeclaration)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98877, "个税申报表不存在或已删除")); } - // 转换成前端所需的数据格式 - // WeaForm weaForm = SalaryFormatUtil.getInstance().buildForm(TaxDeclarationFormDTO.class, formDTO); + // 查询个税扣缴义务人 + TaxAgent taxAgent = new TaxAgentBiz().getById(id); + //日期转换 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM"); + String transformDate = simpleDateFormat.format(taxDeclaration.getSalaryMonth()); + // 转换成个税申报表详情dto + formDTO = TaxDeclarationFormDTO.builder() + .salaryMonth(SalaryDateUtil.String2YearMonth(transformDate)) + .taxAgentId(taxDeclaration.getTaxAgentId()) + .taxAgentName(Optional.ofNullable(taxAgent).map(TaxAgent::getName).orElse("")) + .description(taxDeclaration.getDescription()) + .build(); + } + // 转换成前端所需的数据格式 + // WeaForm weaForm = SalaryFormatUtil.getInstance().buildForm(TaxDeclarationFormDTO.class, formDTO); - // 查询租户所有的个税扣缴义务人 - Collection taxAgentListDTOS = new TaxAgentBiz().listAll(); - // 表单中个税扣缴义务人的可选项 - List weaFormOptions = Lists.newArrayListWithExpectedSize(taxAgentListDTOS.size()); - for (TaxAgent taxAgent : taxAgentListDTOS) { - weaFormOptions.add(new WeaFormOption("" + taxAgent.getId(), taxAgent.getName())); - } + // 查询租户所有的个税扣缴义务人 + Collection taxAgentListDTOS = new TaxAgentBiz().listAll(); + // 表单中个税扣缴义务人的可选项 + List weaFormOptions = Lists.newArrayListWithExpectedSize(taxAgentListDTOS.size()); + for (TaxAgent taxAgent : taxAgentListDTOS) { + weaFormOptions.add(new WeaFormOption("" + taxAgent.getId(), taxAgent.getName())); + } // weaForm.getItems().forEach((k, v) -> { // if (StringUtils.equals("taxAgentId", k)) { // v.setOptions(weaFormOptions); @@ -163,13 +173,13 @@ public class TaxDeclarationWrapper extends Service { // v.setOtherParams(otherParams); // } // }); - return formDTO; - } - /* - *//** + return formDTO; + } + + /** * 查询个税申报表的基本信息 * - * @param id 个税申报表id + * @param id 个税申报表id * @return */ public TaxDeclarationInfoDTO getTaxDeclarationInfoById(Long id) { @@ -179,8 +189,8 @@ public class TaxDeclarationWrapper extends Service { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98877, "个税申报表不存在或已删除")); } //日期转换 - SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM"); - String transformDate=simpleDateFormat.format(taxDeclaration.getSalaryMonth()); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM"); + String transformDate = simpleDateFormat.format(taxDeclaration.getSalaryMonth()); // 查询个税扣缴义务人 TaxAgent taxAgentPO = new TaxAgentBiz().getById(taxDeclaration.getTaxAgentId()); return TaxDeclarationInfoDTO.builder() @@ -189,19 +199,16 @@ public class TaxDeclarationWrapper extends Service { .taxAgentName(Optional.ofNullable(taxAgentPO).map(TaxAgent::getName).orElse("")) .build(); } - /* - *//** + /** * 保存 * - * @param saveParam 保存参数 + * @param saveParam 保存参数 */ @Transactional(rollbackFor = Exception.class) public void save(TaxDeclarationSaveParam saveParam) { - //getTaxDeclarationService(user).save(saveParam); - EmployBiz employBiz = new EmployBiz(); User user = saveParam.getUser(); // 薪资所属月的日期范围 - LocalDateRange salaryMonthDateRange = SalaryDateUtil.localDate2YearRange(SalaryDateUtil.localDateToDate(saveParam.getSalaryMonth().atDay(1))); + LocalDateRange salaryMonthDateRange = SalaryDateUtil.localDate2Range(SalaryDateUtil.localDateToDate(saveParam.getSalaryMonth().atDay(1))); if (Objects.isNull(salaryMonthDateRange)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); } @@ -242,38 +249,32 @@ public class TaxDeclarationWrapper extends Service { } // 查询薪资账套 Set salarySobIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getSalarySobId); - List salarySobPOS = new SalarySobServiceImpl().listByIds(salarySobIds); - - //查询DataCollectionEmployee - //DataCollectionEmployee employeeId = + List salarySobPOS = getSalarySobService(user).listByIds(salarySobIds); // 查询所有薪资项目 List salaryItemPOS = new SalaryItemBiz().listAll(); // 处理要保存的数据 - TaxDeclarationBO.Result result = TaxDeclarationBO.handle(saveParam, taxCycle, user,salaryItemPOS, salarySobPOS,salaryAcctResultPOS); + TaxDeclarationBO.Result result = TaxDeclarationBO.handle(saveParam, taxCycle, user, salaryItemPOS, salarySobPOS, salaryAcctResultPOS); // 保存个税申报表 - //添加判断 - if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxDeclarations())) { - getTaxDeclarationMapper().batchInsert(result.getNeedInsertTaxDeclarations()); } // 保存个税申报表明细 if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxDeclarationDetails())) { - - new TaxDeclarationDetailServiceImpl().batchSave(result.getNeedInsertTaxDeclarationDetails()); + getTaxDeclarationDetailService(user).batchSave(result.getNeedInsertTaxDeclarationDetails()); } // 保存累计情况 if (CollectionUtils.isNotEmpty(result.getNeedInsertAccumulatedSituations())) { - // TODO: 1/23/22 待修改(不能直接调用mapper) - // addUpSituationMapper.insertData(Lists.newArrayList(result.getNeedInsertAccumulatedSituations())); + Set taxAgentIds = SalaryEntityUtil.properties(result.getNeedInsertTaxDeclarations(), TaxDeclarationPO::getTaxAgentId); + getAddUpSituationService(user).deleteByTaxYearMonthAndTaxAgentIds(SalaryDateUtil.localDate2YearMonth(taxCycle),taxAgentIds); + getAddUpSituationMapper().insertData(Lists.newArrayList(result.getNeedInsertAccumulatedSituations())); } // 更新薪资核算记录的状态 - new SalaryAcctRecordServiceImpl().updateStatusByIds(salaryAcctRecordIds, SalaryAcctRecordStatusEnum.DECLARED); + getSalaryAcctRecordService(user).updateStatusByIds(salaryAcctRecordIds, SalaryAcctRecordStatusEnum.DECLARED); // 查询个税扣缴义务人 - Set taxAgentIds = SalaryEntityUtil.properties(result.getNeedInsertTaxDeclarations(), TaxDeclarationPO::getTaxAgentId); - List taxAgentPOS = new TaxAgentBiz().listByIds(taxAgentIds); - Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgent::getId, TaxAgent::getName); +// Set taxAgentIds = SalaryEntityUtil.properties(result.getNeedInsertTaxDeclarations(), TaxDeclarationPO::getTaxAgentId); +// List taxAgentPOS = new TaxAgentBiz().listByIds(taxAgentIds); +// Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgent::getId, TaxAgent::getName); // 记录日志 /*for (TaxDeclarationPO taxDeclarationPO : result.getNeedInsertTaxDeclarations()) { String targetName = SalaryDateUtil.toYearMonth(taxDeclarationPO.getSalaryMonth())