diff --git a/src/com/engine/salary/entity/datacollection/param/PersonalPensionSaveParam.java b/src/com/engine/salary/entity/datacollection/param/PersonalPensionSaveParam.java new file mode 100644 index 000000000..814206dae --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/param/PersonalPensionSaveParam.java @@ -0,0 +1,74 @@ +package com.engine.salary.entity.datacollection.param; + +import com.engine.salary.enums.datacollection.DataCollectionEmployeeTypeEnum; +import com.engine.salary.enums.datacollection.EnumDeductionDataSource; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * 其他免税扣除-个人养老金 + *

Copyright: Copyright (c) 2024

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_personal_pension +//其他免税扣除-个人养老金 +public class PersonalPensionSaveParam { + + //主键id + private Long id; + + //主表数据Id + private Long mainId; + + //税款所属期 + private Date taxYearMonth; + + //缴费月度 + private Date payMonth; + + //人员 + private Long employeeId; + + //个税扣缴义务人 + private Long taxAgentId; + + //凭证类别 + private Integer voucherType; + + //凭证类别名称 + private String voucherTypeName; + + //凭证编码 + private String voucherNo; + + //缴费金额 + private String payAmount; + + + /** + * 人员类型 + * @see DataCollectionEmployeeTypeEnum + */ + private Integer employeeType; + + /** + * 数据来源 + * @see EnumDeductionDataSource + */ + private Integer dataSource; + + //采集来源 + private String collectSource; + +} diff --git a/src/com/engine/salary/service/OtherDeductionService.java b/src/com/engine/salary/service/OtherDeductionService.java index 9b7875f76..21307f57b 100644 --- a/src/com/engine/salary/service/OtherDeductionService.java +++ b/src/com/engine/salary/service/OtherDeductionService.java @@ -1,8 +1,6 @@ package com.engine.salary.service; -import com.engine.salary.entity.datacollection.dto.FreeIncomeListDTO; -import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO; -import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO; +import com.engine.salary.entity.datacollection.dto.*; import com.engine.salary.entity.datacollection.param.*; import com.engine.salary.entity.datacollection.po.OtherDeductionPO; import com.engine.salary.util.page.PageInfo; @@ -127,17 +125,24 @@ public interface OtherDeductionService { String extendToLastMonth(OtherDeductionExtendLastParam param); PageInfo freeIncomeList(OtherDeductionDetailQueryParam param); + PageInfo derateDeductionListDTOList(OtherDeductionDetailQueryParam param); + PageInfo endowmentInsuranceListDTOList(OtherDeductionDetailQueryParam param); + PageInfo grantDonationListDTOList(OtherDeductionDetailQueryParam param); + PageInfo healthInsuranceListDTOList(OtherDeductionDetailQueryParam param); + PageInfo otherDerateDeductionListDTOList(OtherDeductionDetailQueryParam param); + PageInfo personalPensionListDTOList(OtherDeductionDetailQueryParam param); /** * 保存免税收入 * @param param */ void saveFreeIncome(FreeIncomeSaveParam param); -// void saveEndowmentInsurance(EndowmentInsuranceSaveParam param); -// void saveGrantDonation(GrantDonationSaveParam param); -// void saveHealthInsurance(HealthInsuranceSaveParam param); -// void saveOtherDerateDeduction(OtherDerateDeductionSaveParam param); -// void saveDerateDeduction(DerateDeductionSaveParam param); + void saveEndowmentInsurance(EndowmentInsuranceSaveParam param); + void saveGrantDonation(GrantDonationSaveParam param); + void saveHealthInsurance(HealthInsuranceSaveParam param); + void saveOtherDerateDeduction(OtherDerateDeductionSaveParam param); + void saveDerateDeduction(DerateDeductionSaveParam param); + void savePersonalPension(PersonalPensionSaveParam param); } diff --git a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java index 62eb03d76..f4555c9a3 100644 --- a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java @@ -124,6 +124,10 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction return MapperProxyFactory.getProxy(OtherDerateDeductionMapper.class); } + private PersonalPensionMapper getPersonalPensionMapper() { + return MapperProxyFactory.getProxy(PersonalPensionMapper.class); + } + @Override public OtherDeductionPO getById(Long id) { @@ -1164,13 +1168,9 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction } } - String derateAmount = dto.getDerateAmount(); - String derateItem = dto.getDerateItem(); - String derateProperty = dto.getDerateProperty(); - po.setDerateAmount(derateAmount); - po.setDerateItem(derateItem); - po.setDerateProperty(derateProperty); - + po.setDerateAmount(dto.getDerateAmount()); + po.setDerateItem(dto.getDerateItem()); + po.setDerateProperty(dto.getDerateProperty()); if (errorSum == 0) { successCount += 1; @@ -2178,13 +2178,94 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction return book; } + @Override + public PageInfo freeIncomeList(OtherDeductionDetailQueryParam param) { + + List freeIncomePOS = getFreeIncomeMapper().listSome(FreeIncomePO.builder().mainId(param.getId()).build()); + List listDTOS = freeIncomePOS.stream().map(po -> { + FreeIncomeListDTO freeIncomeListDTO = new FreeIncomeListDTO(); + BeanUtils.copyProperties(po, freeIncomeListDTO); + return freeIncomeListDTO; + }).collect(Collectors.toList()); + return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, FreeIncomeListDTO.class); + } + + @Override + public PageInfo derateDeductionListDTOList(OtherDeductionDetailQueryParam param) { + List pos = getDerateDeductionMapper().listSome(DerateDeductionPO.builder().mainId(param.getId()).build()); + List listDTOS = pos.stream().map(po -> { + DerateDeductionListDTO dtos = new DerateDeductionListDTO(); + BeanUtils.copyProperties(po, dtos); + return dtos; + }).collect(Collectors.toList()); + return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, DerateDeductionListDTO.class); + } + + @Override + public PageInfo endowmentInsuranceListDTOList(OtherDeductionDetailQueryParam param) { + List pos = getEndowmentInsuranceMapper().listSome(EndowmentInsurancePO.builder().mainId(param.getId()).build()); + List listDTOS = pos.stream().map(po -> { + EndowmentInsuranceListDTO dtos = new EndowmentInsuranceListDTO(); + BeanUtils.copyProperties(po, dtos); + return dtos; + }).collect(Collectors.toList()); + return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, EndowmentInsuranceListDTO.class); + } + + @Override + public PageInfo grantDonationListDTOList(OtherDeductionDetailQueryParam param) { + List pos = getGrantDonationMapper().listSome(GrantDonationPO.builder().mainId(param.getId()).build()); + List listDTOS = pos.stream().map(po -> { + GrantDonationListDTO dtos = new GrantDonationListDTO(); + BeanUtils.copyProperties(po, dtos); + return dtos; + }).collect(Collectors.toList()); + return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, GrantDonationListDTO.class); + } + + @Override + public PageInfo healthInsuranceListDTOList(OtherDeductionDetailQueryParam param) { + List pos = getHealthInsuranceMapper().listSome(HealthInsurancePO.builder().mainId(param.getId()).build()); + List listDTOS = pos.stream().map(po -> { + HealthInsuranceListDTO dtos = new HealthInsuranceListDTO(); + BeanUtils.copyProperties(po, dtos); + return dtos; + }).collect(Collectors.toList()); + return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, HealthInsuranceListDTO.class); + } + + @Override + public PageInfo otherDerateDeductionListDTOList(OtherDeductionDetailQueryParam param) { + List pos = getOtherDerateDeductionMapper().listSome(OtherDerateDeductionPO.builder().mainId(param.getId()).build()); + List listDTOS = pos.stream().map(po -> { + OtherDerateDeductionListDTO dtos = new OtherDerateDeductionListDTO(); + BeanUtils.copyProperties(po, dtos); + return dtos; + }).collect(Collectors.toList()); + return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, OtherDerateDeductionListDTO.class); + } + + @Override + public PageInfo personalPensionListDTOList(OtherDeductionDetailQueryParam param) { + List pos = getFreeIncomeMapper().listSome(FreeIncomePO.builder().mainId(param.getId()).build()); + List listDTOS = pos.stream().map(po -> { + PersonalPensionListDTO dtos = new PersonalPensionListDTO(); + BeanUtils.copyProperties(po, dtos); + return dtos; + }).collect(Collectors.toList()); + return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, PersonalPensionListDTO.class); + } + @Override public void saveFreeIncome(FreeIncomeSaveParam param) { Date now = new Date(); Long mainId = param.getMainId(); - OtherDeductionPO deductionPO = getOtherDeductionMapper().getById(mainId); + OtherDeductionPO deductionPO = getById(mainId); + if (deductionPO == null) { + throw new SalaryRunTimeException("主表不存在!"); + } Long id = param.getId(); if (id == null) { @@ -2208,30 +2289,301 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction getFreeIncomeMapper().insertIgnoreNull(po); } else { FreeIncomePO po = getFreeIncomeMapper().getById(id); + if (po == null){ + throw new SalaryRunTimeException("记录不存在!"); + } -// po.setTaxYearMonth(param.getTaxYearMonth()); -// po.setEmployeeId(param.getEmployeeId()); -// po.setTaxAgentId(param.getTaxAgentId()); + po.setUpdateTime(now); po.setFreeItem(param.getFreeItem()); po.setFreeProperty(param.getFreeProperty()); po.setFreeAmount(param.getFreeAmount()); - po.setEmployeeType(0); - po.setUpdateTime(now); getFreeIncomeMapper().updateIgnoreNull(po); } } @Override - public PageInfo freeIncomeList(OtherDeductionDetailQueryParam param) { + public void saveEndowmentInsurance(EndowmentInsuranceSaveParam param) { + Date now = new Date(); - List freeIncomePOS = getFreeIncomeMapper().listSome(FreeIncomePO.builder().mainId(param.getId()).build()); - List listDTOS = freeIncomePOS.stream().map(po -> { - FreeIncomeListDTO freeIncomeListDTO = new FreeIncomeListDTO(); - BeanUtils.copyProperties(po, freeIncomeListDTO); - return freeIncomeListDTO; - }).collect(Collectors.toList()); - return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, FreeIncomeListDTO.class); + Long mainId = param.getMainId(); + OtherDeductionPO deductionPO = getById(mainId); + if (deductionPO == null) { + throw new SalaryRunTimeException("主表不存在!"); + } + + Long id = param.getId(); + if (id == null) { + EndowmentInsurancePO po = EndowmentInsurancePO.builder() + .id(id) + .mainId(mainId) + .taxYearMonth(deductionPO.getDeclareMonth()) + .employeeId(deductionPO.getEmployeeId()) + .taxAgentId(deductionPO.getTaxAgentId()) + .accountNumber(param.getAccountNumber()) + .checkCode(param.getCheckCode()) + .yearPremium(param.getYearPremium()) + .monthPremium(param.getMonthPremium()) + .currentDeduction(param.getCurrentDeduction()) + .fileStatus(1) + .employeeType(0) + .createTime(now) + .updateTime(now) + .creator((long) user.getUID()) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .tenantKey(DEFAULT_TENANT_KEY) + .build(); + getEndowmentInsuranceMapper().insertIgnoreNull(po); + } else { + EndowmentInsurancePO po = getEndowmentInsuranceMapper().getById(id); + if (po == null){ + throw new SalaryRunTimeException("记录不存在!"); + } + + po.setUpdateTime(now); + po.setAccountNumber(param.getAccountNumber()); + po.setCheckCode(param.getCheckCode()); + po.setYearPremium(param.getYearPremium()); + po.setMonthPremium(param.getMonthPremium()); + po.setCurrentDeduction(param.getCurrentDeduction()); + + getEndowmentInsuranceMapper().updateIgnoreNull(po); + } + } + + @Override + public void saveGrantDonation(GrantDonationSaveParam param) { + Date now = new Date(); + + Long mainId = param.getMainId(); + OtherDeductionPO deductionPO = getById(mainId); + if (deductionPO == null) { + throw new SalaryRunTimeException("主表不存在!"); + } + + Long id = param.getId(); + if (id == null) { + GrantDonationPO po = GrantDonationPO.builder() + .id(id) + .mainId(mainId) + .taxYearMonth(deductionPO.getDeclareMonth()) + .employeeId(deductionPO.getEmployeeId()) + .taxAgentId(deductionPO.getTaxAgentId()) + .recipientName(param.getRecipientName()) + .taxCode(param.getTaxCode()) + .donationNumber(param.getDonationNumber()) + .donateDate(param.getDonateDate()) + .donateAmount(param.getDonateAmount()) + .deductionProportion(param.getDeductionProportion()) + .actualDeduction(param.getActualDeduction()) + .fileStatus(1) + .employeeType(0) + .createTime(now) + .updateTime(now) + .creator((long) user.getUID()) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .tenantKey(DEFAULT_TENANT_KEY) + .build(); + getGrantDonationMapper().insertIgnoreNull(po); + } else { + GrantDonationPO po = getGrantDonationMapper().getById(id); + if (po == null){ + throw new SalaryRunTimeException("记录不存在!"); + } + + po.setUpdateTime(now); + po.setRecipientName(param.getRecipientName()); + po.setTaxCode(param.getTaxCode()); + po.setDonationNumber(param.getDonationNumber()); + po.setDonateDate(param.getDonateDate()); + po.setDonateAmount(param.getDonateAmount()); + po.setDeductionProportion(param.getDeductionProportion()); + po.setActualDeduction(param.getActualDeduction()); + + getGrantDonationMapper().updateIgnoreNull(po); + } + } + + @Override + public void saveHealthInsurance(HealthInsuranceSaveParam param) { + Date now = new Date(); + + Long mainId = param.getMainId(); + OtherDeductionPO deductionPO = getById(mainId); + if (deductionPO == null) { + throw new SalaryRunTimeException("主表不存在!"); + } + + Long id = param.getId(); + if (id == null) { + HealthInsurancePO po = HealthInsurancePO.builder() + .id(id) + .mainId(mainId) + .taxYearMonth(deductionPO.getDeclareMonth()) + .employeeId(deductionPO.getEmployeeId()) + .taxAgentId(deductionPO.getTaxAgentId()) + .identificationNumber(param.getIdentificationNumber()) + .effectiveDate(param.getEffectiveDate()) + .yearPremium(param.getYearPremium()) + .monthPremium(param.getMonthPremium()) + .currentDeduction(param.getCurrentDeduction()) + .fileStatus(1) + .employeeType(0) + .createTime(now) + .updateTime(now) + .creator((long) user.getUID()) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .tenantKey(DEFAULT_TENANT_KEY) + .build(); + getHealthInsuranceMapper().insertIgnoreNull(po); + } else { + HealthInsurancePO po = getHealthInsuranceMapper().getById(id); + if (po == null){ + throw new SalaryRunTimeException("记录不存在!"); + } + + po.setUpdateTime(now); + po.setIdentificationNumber(param.getIdentificationNumber()); + po.setEffectiveDate(param.getEffectiveDate()); + po.setYearPremium(param.getYearPremium()); + po.setMonthPremium(param.getMonthPremium()); + po.setCurrentDeduction(param.getCurrentDeduction()); + + getHealthInsuranceMapper().updateIgnoreNull(po); + } + } + + @Override + public void saveOtherDerateDeduction(OtherDerateDeductionSaveParam param) { + Date now = new Date(); + + Long mainId = param.getMainId(); + OtherDeductionPO deductionPO = getById(mainId); + if (deductionPO == null) { + throw new SalaryRunTimeException("主表不存在!"); + } + + Long id = param.getId(); + if (id == null) { + OtherDerateDeductionPO po = OtherDerateDeductionPO.builder() + .id(id) + .mainId(mainId) + .taxYearMonth(deductionPO.getDeclareMonth()) + .employeeId(deductionPO.getEmployeeId()) + .taxAgentId(deductionPO.getTaxAgentId()) + .otherDeduction(param.getOtherDeduction()) + .remark(param.getRemark()) + .fileStatus(1) + .employeeType(0) + .createTime(now) + .updateTime(now) + .creator((long) user.getUID()) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .tenantKey(DEFAULT_TENANT_KEY) + .build(); + getOtherDerateDeductionMapper().insertIgnoreNull(po); + } else { + OtherDerateDeductionPO po = getOtherDerateDeductionMapper().getById(id); + if (po == null){ + throw new SalaryRunTimeException("记录不存在!"); + } + + po.setUpdateTime(now); + po.setOtherDeduction(param.getOtherDeduction()); + po.setRemark(param.getRemark()); + + getOtherDerateDeductionMapper().updateIgnoreNull(po); + } + } + + @Override + public void saveDerateDeduction(DerateDeductionSaveParam param) { + Date now = new Date(); + + Long mainId = param.getMainId(); + OtherDeductionPO deductionPO = getById(mainId); + if (deductionPO == null) { + throw new SalaryRunTimeException("主表不存在!"); + } + + Long id = param.getId(); + if (id == null) { + DerateDeductionPO po = DerateDeductionPO.builder() + .id(id) + .mainId(mainId) + .taxYearMonth(deductionPO.getDeclareMonth()) + .employeeId(deductionPO.getEmployeeId()) + .taxAgentId(deductionPO.getTaxAgentId()) + .derateAmount(param.getDerateAmount()) + .derateItem(param.getDerateItem()) + .derateProperty(param.getDerateProperty()) + .fileStatus(1) + .employeeType(0) + .createTime(now) + .updateTime(now) + .creator((long) user.getUID()) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .tenantKey(DEFAULT_TENANT_KEY) + .build(); + getDerateDeductionMapper().insertIgnoreNull(po); + } else { + DerateDeductionPO po = getDerateDeductionMapper().getById(id); + if (po == null){ + throw new SalaryRunTimeException("记录不存在!"); + } + + po.setUpdateTime(now); + po.setDerateAmount(param.getDerateAmount()); + po.setDerateItem(param.getDerateItem()); + po.setDerateProperty(param.getDerateProperty()); + + getDerateDeductionMapper().updateIgnoreNull(po); + } + } + + @Override + public void savePersonalPension(PersonalPensionSaveParam param) { + Date now = new Date(); + + Long mainId = param.getMainId(); + OtherDeductionPO deductionPO = getById(mainId); + if (deductionPO == null) { + throw new SalaryRunTimeException("主表不存在!"); + } + + Long id = param.getId(); + if (id == null) { + PersonalPensionPO po = PersonalPensionPO.builder() + .id(id) + .mainId(mainId) + .taxYearMonth(deductionPO.getDeclareMonth()) + .employeeId(deductionPO.getEmployeeId()) + .taxAgentId(deductionPO.getTaxAgentId()) + .voucherTypeName(param.getVoucherTypeName()) + .voucherNo(param.getVoucherNo()) + .payAmount(param.getPayAmount()) + .fileStatus(1) + .employeeType(0) + .createTime(now) + .updateTime(now) + .creator((long) user.getUID()) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .tenantKey(DEFAULT_TENANT_KEY) + .build(); + getPersonalPensionMapper().insertIgnoreNull(po); + } else { + PersonalPensionPO po = getPersonalPensionMapper().getById(id); + if (po == null){ + throw new SalaryRunTimeException("记录不存在!"); + } + + po.setUpdateTime(now); + po.setVoucherTypeName(param.getVoucherTypeName()); + po.setVoucherNo(param.getVoucherNo()); + po.setPayAmount(param.getPayAmount()); + + getPersonalPensionMapper().updateIgnoreNull(po); + } } }