diff --git a/src/com/engine/salary/entity/datacollection/param/AddUpDeductionRecordDeleteParam.java b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionRecordDeleteParam.java index fa1e8bcac..4b9aa0e78 100644 --- a/src/com/engine/salary/entity/datacollection/param/AddUpDeductionRecordDeleteParam.java +++ b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionRecordDeleteParam.java @@ -23,4 +23,7 @@ public class AddUpDeductionRecordDeleteParam { // 申报月份 private String declareMonth; + + // 个税扣缴义务人 + private String taxAgentId; } diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index b5ad85798..03dac60c8 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -37,6 +37,7 @@ import com.engine.salary.sys.entity.vo.OrderRuleVO; import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; import com.engine.salary.util.SalaryDateUtil; +import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelComment; @@ -578,7 +579,20 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction }catch (Exception e){ throw new SalaryRunTimeException("日期异常"); } - AddUpDeductionQueryParam queryParam = AddUpDeductionQueryParam.builder().declareMonthDate(declareMonthDate).taxAgentIds(taxAgentIds).build(); + AddUpDeductionQueryParam queryParam = null; + if(deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))){ + // 设置了个税扣缴义务人 + Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId()); + boolean canDelete = taxAgentIds.stream().anyMatch(t -> t == taxAgentId); + if(!canDelete){ + throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!"); + } + ArrayList tai = new ArrayList<>(); + tai.add(taxAgentId); + queryParam = AddUpDeductionQueryParam.builder().declareMonthDate(declareMonthDate).taxAgentIds(tai).build(); + }else { + queryParam = AddUpDeductionQueryParam.builder().declareMonthDate(declareMonthDate).taxAgentIds(taxAgentIds).build(); + } // 获取所有想要删除的数据 List list = addUpDeductionBiz.list(queryParam); // 获取已经核算的数据 diff --git a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java index 51a985b08..f5e668048 100644 --- a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java @@ -1058,7 +1058,22 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation ArrayList dateRange = new ArrayList<>(); dateRange.add(beginDate); dateRange.add(endDate); - AddUpSituation queryParam = AddUpSituation.builder().taxYearMonthRange(dateRange).taxAgentIds(taxAgentIds).build(); + + AddUpSituation queryParam = null; + if(deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))){ + // 设置了个税扣缴义务人 + Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId()); + boolean canDelete = taxAgentIds.stream().anyMatch(t -> t == taxAgentId); + if(!canDelete){ + throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!"); + } + ArrayList tai = new ArrayList<>(); + tai.add(taxAgentId); + queryParam = AddUpSituation.builder().taxYearMonthRange(dateRange).taxAgentIds(tai).build(); + }else { + queryParam = AddUpSituation.builder().taxYearMonthRange(dateRange).taxAgentIds(taxAgentIds).build(); + } + // 获取所有想要删除的数据 List list = biz.listSome(queryParam); // 获取已经核算的数据 diff --git a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java index c6ce474a9..2513aacdc 100644 --- a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java @@ -10,10 +10,7 @@ import com.engine.salary.encrypt.datacollection.OtherDeductionRecordDTOEncrypt; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO; import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO; -import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam; -import com.engine.salary.entity.datacollection.param.OtherDeductionImportParam; -import com.engine.salary.entity.datacollection.param.OtherDeductionParam; -import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam; +import com.engine.salary.entity.datacollection.param.*; import com.engine.salary.entity.datacollection.po.OtherDeductionPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; @@ -31,6 +28,7 @@ import com.engine.salary.sys.entity.vo.OrderRuleVO; import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; import com.engine.salary.util.SalaryDateUtil; +import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelComment; @@ -734,7 +732,21 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction }catch (Exception e){ throw new SalaryRunTimeException("日期异常"); } - OtherDeductionPO queryParam = OtherDeductionPO.builder().declareMonth(declareMonthDate).taxAgentIds(taxAgentIds).build(); + + OtherDeductionPO queryParam = null; + if(deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))){ + // 设置了个税扣缴义务人 + Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId()); + boolean canDelete = taxAgentIds.stream().anyMatch(t -> t == taxAgentId); + if(!canDelete){ + throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!"); + } + ArrayList tai = new ArrayList<>(); + tai.add(taxAgentId); + queryParam = OtherDeductionPO.builder().declareMonth(declareMonthDate).taxAgentIds(tai).build(); + }else { + queryParam = OtherDeductionPO.builder().declareMonth(declareMonthDate).taxAgentIds(taxAgentIds).build(); + } // 获取所有想要删除的数据 List list = otherDeductionBiz.listSome(queryParam); // 获取已经核算的数据 diff --git a/src/com/engine/salary/web/AddUpSituationController.java b/src/com/engine/salary/web/AddUpSituationController.java index 360cc532d..a0bd97f03 100644 --- a/src/com/engine/salary/web/AddUpSituationController.java +++ b/src/com/engine/salary/web/AddUpSituationController.java @@ -4,6 +4,7 @@ import com.engine.common.util.ParamUtil; import com.engine.common.util.ServiceUtil; import com.engine.salary.entity.datacollection.dto.AddUpSituationDTO; import com.engine.salary.entity.datacollection.dto.AddUpSituationRecordDTO; +import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam; import com.engine.salary.entity.datacollection.param.AddUpSituationImportParam; import com.engine.salary.entity.datacollection.param.AddUpSituationParam; import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam; @@ -320,13 +321,13 @@ public class AddUpSituationController { * @author Harryxzy * @date 2022/10/27 21:10 */ -// @POST -// @Path("/deleteAllAddUpSituation") -// @Produces(MediaType.APPLICATION_JSON) -// public String deleteAllAddUpSituation(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionRecordDeleteParam addUpSituationDeleteParam) { -// User user = HrmUserVarify.getUser(request, response); -// return new ResponseResult>(user).run(getAddUpSituationWrapper(user)::deleteAllAddUpSituation, addUpSituationDeleteParam); -// } + @POST + @Path("/deleteAllAddUpSituation") + @Produces(MediaType.APPLICATION_JSON) + public String deleteAllAddUpSituation(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionRecordDeleteParam addUpSituationDeleteParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getAddUpSituationWrapper(user)::deleteAllAddUpSituation, addUpSituationDeleteParam); + } @POST @Path("/preview")