diff --git a/resource/sql/申报表.sql b/resource/sql/申报表.sql index 2e233b895..00d198ce7 100644 --- a/resource/sql/申报表.sql +++ b/resource/sql/申报表.sql @@ -1 +1,9 @@ -ALTER TABLE hrsa_tax_declaration ADD COLUMN income_category int(255) NOT NULL COMMENT '薪资类型。1:正常工资薪金所得、4:劳务所得' ; \ No newline at end of file +ALTER TABLE hrsa_tax_declaration ADD COLUMN income_category int(255) NOT NULL COMMENT '薪资类型。1:正常工资薪金所得、4:劳务所得' ; + +ALTER TABLE hrsa_tax_declaration_detail ADD COLUMN employee_type int(255) NOT NULL ; + +ALTER TABLE hrsa_tax_declaration ADD income_category int NULL +GO + +ALTER TABLE hrsa_tax_declaration_detail ADD employee_type int NULL +GO \ No newline at end of file diff --git a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java index c8b961978..58ff90b3c 100644 --- a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java @@ -332,6 +332,35 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM */ @Override public void save(TaxAgentRangeSaveParam saveParam) { + + if (saveParam == null) { + throw new SalaryRunTimeException("参数错误"); + } + + if (Objects.isNull(saveParam.getTaxAgentId())) { + throw new SalaryRunTimeException("个税扣缴义务人的id不允许为空"); + } + + if (saveParam.getIncludeType() != 0 && saveParam.getIncludeType() != 1) { + throw new SalaryRunTimeException("只能选择 关联人员范围/从范围中排除"); + } + + if (CollectionUtils.isEmpty(saveParam.getEmployeeStatus())) { + throw new SalaryRunTimeException("员工状态不允许为空"); + } + + if (CollectionUtils.isNotEmpty(saveParam.getTargetParams())) { + saveParam.getTargetParams().forEach(target -> { + if (target.getTargetType() == null) { + throw new SalaryRunTimeException("对象类型不能为空"); + } + if (target.getTargetId() == null) { + throw new SalaryRunTimeException("对象不能为空"); + } + }); + } + + // 查询薪资账套 TaxAgentPO taxAgent = getTaxAgentV2Service(user).getById(saveParam.getTaxAgentId()); if (Objects.isNull(taxAgent)) { @@ -387,11 +416,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM taskExecutor.execute(() -> { syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, (long) user.getUID()); }); -// new Thread() { -// public void run() { -// syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, (long) user.getUID()); -// } -// }.start(); + } /** @@ -408,78 +433,6 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM return getTaxAgentManageRangeMapper().listSome(TaxAgentManageRangePO.builder().taxAgentId(taxAgentId).rangeType(TaxAgentRangeTypeEnum.SUBADMIN.getValue()).build()); } -// @Override -// @Transactional(rollbackFor = Exception.class) -// public void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam) { -// // 查询薪资账套 -// TaxAgentSubAdminPO taxAgentSubAdmin = taxAgentSubAdminService.getById(saveParam.getSubAdminId()); -// if (Objects.isNull(taxAgentSubAdmin)) { -// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(106687, "参数错误,分管理员不存在或者已被删除")); -// } -// // 查询已有的管理范围 -// List taxAgentManageAllRanges = listBySubAdminId(saveParam.getSubAdminId()); -// List taxAgentManageRanges = taxAgentManageAllRanges.stream().filter(f -> f.getIncludeType().equals(saveParam.getIncludeType())).collect(Collectors.toList()); -// // 处理一下本次的保存参数(如果原来添加过对应的人员(/部门/岗位),那么本次不需要新增,只需要更新) -// TaxAgentBO.Result result = TaxAgentBO.handleSubAdminRange(taxAgentManageRanges, saveParam, taxAgentSubAdmin.getTaxAgentId(), taxAgentSubAdmin.getId(), (long) user.getUID()); -// -// // 当前库中所有分管理员的管理范围 -// List allSubAdminRangesExist = listSunAdminRangeByTaxAgentId(taxAgentSubAdmin.getTaxAgentId()); -// /** 检查当前分管理员的范围与其他分管理员人员范围===========================start */ -// // 当前分管理员的范围 -// List allSubAdminRangesCuttent = Lists.newArrayList(taxAgentManageAllRanges); -// // 其他分管理员的范围 -// List otherSubAdminRangesExist = allSubAdminRangesExist.stream().filter(f -> !f.getTaxAgentSubAdminId().equals(saveParam.getSubAdminId())).collect(Collectors.toList()); -// allSubAdminRangesCuttent.addAll(result.getNeedInsertTaxAgentManageRanges()); -// allSubAdminRangesCuttent.addAll(result.getNeedUpdateTaxAgentManageRanges()); -// -// // 当前分管理员的所有人员 -// List currentSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRangesCuttent); -// // 其他分管理员的所有人员 -// List otherSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), otherSubAdminRangesExist); -// for (DataCollectionEmployee se : currentSubAdminSalaryEmployees) { -// Optional optionalSe = otherSubAdminSalaryEmployees.stream().filter(f -> f.getEmployeeId().equals(se.getEmployeeId())).findFirst(); -// if (optionalSe.isPresent()) { -// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110149, "不可包含其他分管理员的人员")); -// } -// } -// /** 检查当前分管理员的范围与其他分管理员人员范围===========================end */ -// -// /** 检查当前分管理员的范围与所属个税扣缴义务人的人员范围===========================start */ -// // 所属个税扣缴义务人的所有分管理员的管理范围 -// List allSubAdminRanges = Lists.newArrayList(allSubAdminRangesExist); -// allSubAdminRanges.addAll(result.getNeedInsertTaxAgentManageRanges()); -// allSubAdminRanges.addAll(result.getNeedUpdateTaxAgentManageRanges()); -// // 去重 -// allSubAdminRanges = allSubAdminRanges.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>( -// Comparator.comparing(f -> f.getTaxAgentSubAdminId() + "." + f.getRangeType() + "." + f.getTargetType() + "." + f.getTargetId() + "." + f.getEmployeeStatus() + "." + f.getIncludeType())) -// ), ArrayList::new)); -// // 所属个税扣缴义务人的所有人员 -// List allRanges = listByTaxAgentId(taxAgentSubAdmin.getTaxAgentId()); -// List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allRanges); -// // 所有分管理员的所有人员 -// List allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRanges); -// List allSalaryEmployeeIds = allSalaryEmployees.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList()); -// allSubAdminSalaryEmployees.removeIf(a -> allSalaryEmployeeIds.contains(a.getEmployeeId())); -// if (CollectionUtils.isNotEmpty(allSubAdminSalaryEmployees)) { -// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110125, "超出了整体人员范围")); -// } -// /** 检查当前分管理员的范围与所属个税扣缴义务人的人员范围===========================end */ -// -// // 保存 -// if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxAgentManageRanges())) { -// result.getNeedInsertTaxAgentManageRanges().forEach(range -> getTaxAgentManageRangeMapper().insertIgnoreNull(range)); -//// todo this.saveBatch(result.getNeedInsertTaxAgentManageRanges()); -// } -// if (CollectionUtils.isNotEmpty(result.getNeedUpdateTaxAgentManageRanges())) { -// result.getNeedUpdateTaxAgentManageRanges().forEach(range -> getTaxAgentManageRangeMapper().updateIgnoreNull(range)); -//// todo this.updateBatchById(result.getNeedUpdateTaxAgentManageRanges()); -// } -// /** 同步本地人员范围的关联人员=========================== */ -// List finalAllSubAdminRanges = allSubAdminRanges; -// -// syncLocalEmp(taxAgentSubAdmin.getTaxAgentId(), allSalaryEmployees, allSubAdminRanges); -// // 记录日志 todo -// } /**