列表和保存接口

This commit is contained in:
钱涛 2024-12-24 15:52:36 +08:00
parent 412d3488d1
commit 9c99e53288
3 changed files with 460 additions and 29 deletions

View File

@ -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;
/**
* 其他免税扣除-个人养老金
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @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;
}

View File

@ -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<FreeIncomeListDTO> freeIncomeList(OtherDeductionDetailQueryParam param);
PageInfo<DerateDeductionListDTO> derateDeductionListDTOList(OtherDeductionDetailQueryParam param);
PageInfo<EndowmentInsuranceListDTO> endowmentInsuranceListDTOList(OtherDeductionDetailQueryParam param);
PageInfo<GrantDonationListDTO> grantDonationListDTOList(OtherDeductionDetailQueryParam param);
PageInfo<HealthInsuranceListDTO> healthInsuranceListDTOList(OtherDeductionDetailQueryParam param);
PageInfo<OtherDerateDeductionListDTO> otherDerateDeductionListDTOList(OtherDeductionDetailQueryParam param);
PageInfo<PersonalPensionListDTO> 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);
}

View File

@ -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<FreeIncomeListDTO> freeIncomeList(OtherDeductionDetailQueryParam param) {
List<FreeIncomePO> freeIncomePOS = getFreeIncomeMapper().listSome(FreeIncomePO.builder().mainId(param.getId()).build());
List<FreeIncomeListDTO> 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<DerateDeductionListDTO> derateDeductionListDTOList(OtherDeductionDetailQueryParam param) {
List<DerateDeductionPO> pos = getDerateDeductionMapper().listSome(DerateDeductionPO.builder().mainId(param.getId()).build());
List<DerateDeductionListDTO> 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<EndowmentInsuranceListDTO> endowmentInsuranceListDTOList(OtherDeductionDetailQueryParam param) {
List<EndowmentInsurancePO> pos = getEndowmentInsuranceMapper().listSome(EndowmentInsurancePO.builder().mainId(param.getId()).build());
List<EndowmentInsuranceListDTO> 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<GrantDonationListDTO> grantDonationListDTOList(OtherDeductionDetailQueryParam param) {
List<GrantDonationPO> pos = getGrantDonationMapper().listSome(GrantDonationPO.builder().mainId(param.getId()).build());
List<GrantDonationListDTO> 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<HealthInsuranceListDTO> healthInsuranceListDTOList(OtherDeductionDetailQueryParam param) {
List<HealthInsurancePO> pos = getHealthInsuranceMapper().listSome(HealthInsurancePO.builder().mainId(param.getId()).build());
List<HealthInsuranceListDTO> 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<OtherDerateDeductionListDTO> otherDerateDeductionListDTOList(OtherDeductionDetailQueryParam param) {
List<OtherDerateDeductionPO> pos = getOtherDerateDeductionMapper().listSome(OtherDerateDeductionPO.builder().mainId(param.getId()).build());
List<OtherDerateDeductionListDTO> 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<PersonalPensionListDTO> personalPensionListDTOList(OtherDeductionDetailQueryParam param) {
List<FreeIncomePO> pos = getFreeIncomeMapper().listSome(FreeIncomePO.builder().mainId(param.getId()).build());
List<PersonalPensionListDTO> 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<FreeIncomeListDTO> freeIncomeList(OtherDeductionDetailQueryParam param) {
public void saveEndowmentInsurance(EndowmentInsuranceSaveParam param) {
Date now = new Date();
List<FreeIncomePO> freeIncomePOS = getFreeIncomeMapper().listSome(FreeIncomePO.builder().mainId(param.getId()).build());
List<FreeIncomeListDTO> 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);
}
}
}