This commit is contained in:
parent
d48f6131e0
commit
0bb2abc281
|
|
@ -23,4 +23,6 @@ public class OtherDeductionDetailDeleteParam {
|
|||
|
||||
// 主键id
|
||||
private List<Long> ids;
|
||||
|
||||
private Long mainId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.engine.salary.service;
|
|||
import com.engine.salary.entity.datacollection.dto.*;
|
||||
import com.engine.salary.entity.datacollection.param.*;
|
||||
import com.engine.salary.entity.datacollection.po.*;
|
||||
import com.engine.salary.enums.datacollection.TaxFreeTypeEnum;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
|
|
@ -125,35 +126,75 @@ public interface OtherDeductionService {
|
|||
String extendToLastMonth(OtherDeductionExtendLastParam param);
|
||||
|
||||
PageInfo<FreeIncomeListDTO> freeIncomeList(OtherDeductionDetailQueryParam param);
|
||||
|
||||
PageInfo<DerateDeductionListDTO> derateDeductionList(OtherDeductionDetailQueryParam param);
|
||||
|
||||
PageInfo<EndowmentInsuranceListDTO> endowmentInsuranceList(OtherDeductionDetailQueryParam param);
|
||||
|
||||
PageInfo<GrantDonationListDTO> grantDonationList(OtherDeductionDetailQueryParam param);
|
||||
|
||||
PageInfo<HealthInsuranceListDTO> healthInsuranceList(OtherDeductionDetailQueryParam param);
|
||||
|
||||
PageInfo<OtherDerateDeductionListDTO> otherDerateDeductionList(OtherDeductionDetailQueryParam param);
|
||||
|
||||
PageInfo<PersonalPensionListDTO> personalPensionList(OtherDeductionDetailQueryParam param);
|
||||
|
||||
List<FreeIncomePO> queryFreeIncomes(OtherDeductionFreeListQueryParam param);
|
||||
|
||||
List<DerateDeductionPO> queryDerateDeductions(OtherDeductionFreeListQueryParam param);
|
||||
|
||||
List<EndowmentInsurancePO> queryEndowmentInsurances(OtherDeductionFreeListQueryParam param);
|
||||
|
||||
List<GrantDonationPO> queryGrantDonations(OtherDeductionFreeListQueryParam param);
|
||||
|
||||
List<HealthInsurancePO> queryHealthInsurances(OtherDeductionFreeListQueryParam param);
|
||||
|
||||
List<OtherDerateDeductionPO> queryOtherDerateDeductions(OtherDeductionFreeListQueryParam param);
|
||||
|
||||
List<PersonalPensionPO> queryPersonalPensions(OtherDeductionFreeListQueryParam 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 savePersonalPension(PersonalPensionSaveParam param);
|
||||
|
||||
void deleteFreeIncome(OtherDeductionDetailDeleteParam param);
|
||||
|
||||
void deleteEndowmentInsurance(OtherDeductionDetailDeleteParam param);
|
||||
|
||||
void deleteGrantDonation(OtherDeductionDetailDeleteParam param);
|
||||
|
||||
void deleteHealthInsurance(OtherDeductionDetailDeleteParam param);
|
||||
|
||||
void deleteOtherDerateDeduction(OtherDeductionDetailDeleteParam param);
|
||||
|
||||
void deleteDerateDeduction(OtherDeductionDetailDeleteParam param);
|
||||
|
||||
void deletePersonalPension(OtherDeductionDetailDeleteParam param);
|
||||
|
||||
void syncMain(Long mainId, List<TaxFreeTypeEnum> taxFreeTypes);
|
||||
|
||||
void syncFreeIncome(OtherDeductionPO mainPO);
|
||||
|
||||
void syncEndowmentInsurance(OtherDeductionPO mainPO);
|
||||
|
||||
void syncGrantDonation(OtherDeductionPO mainPO);
|
||||
|
||||
void syncHealthInsurance(OtherDeductionPO mainPO);
|
||||
|
||||
void syncOtherDerateDeduction(OtherDeductionPO mainPO);
|
||||
|
||||
void syncDerateDeduction(OtherDeductionPO mainPO);
|
||||
|
||||
void syncPersonalPension(OtherDeductionPO mainPO);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
|||
import com.engine.salary.enums.OperateTypeEnum;
|
||||
import com.engine.salary.enums.UserStatusEnum;
|
||||
import com.engine.salary.enums.datacollection.DataCollectionEmployeeTypeEnum;
|
||||
import com.engine.salary.enums.datacollection.TaxFreeTypeEnum;
|
||||
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.datacollection.*;
|
||||
|
|
@ -2550,11 +2551,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
getFreeIncomeMapper().updateIgnoreNull(po);
|
||||
}
|
||||
|
||||
List<FreeIncomePO> freeIncomePOS = getFreeIncomeMapper().listSome(FreeIncomePO.builder().mainId(mainId).build());
|
||||
String sum = freeIncomePOS.stream().filter(po -> NumberUtil.isNumber(po.getFreeAmount())).map(po -> new BigDecimal(po.getFreeAmount())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString();
|
||||
deductionPO.setFreeIncome(sum);
|
||||
// getOtherDeductionMapper().updateData();
|
||||
|
||||
syncMain(mainId, Collections.singletonList(TaxFreeTypeEnum.FREE_INCOME));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -2606,6 +2603,8 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
|
||||
getEndowmentInsuranceMapper().updateIgnoreNull(po);
|
||||
}
|
||||
|
||||
syncMain(mainId, Collections.singletonList(TaxFreeTypeEnum.ENDOWMENT_INSURANCE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -2659,6 +2658,8 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
|
||||
getGrantDonationMapper().updateIgnoreNull(po);
|
||||
}
|
||||
|
||||
syncMain(mainId, Collections.singletonList(TaxFreeTypeEnum.GRANT_DONATION));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -2708,6 +2709,8 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
|
||||
getHealthInsuranceMapper().updateIgnoreNull(po);
|
||||
}
|
||||
|
||||
syncMain(mainId, Collections.singletonList(TaxFreeTypeEnum.HEALTH_INSURANCE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -2751,6 +2754,8 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
|
||||
getOtherDerateDeductionMapper().updateIgnoreNull(po);
|
||||
}
|
||||
|
||||
syncMain(mainId, Collections.singletonList(TaxFreeTypeEnum.OTHER_DERATE_DEDUCTION));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -2796,6 +2801,8 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
|
||||
getDerateDeductionMapper().updateIgnoreNull(po);
|
||||
}
|
||||
|
||||
syncMain(mainId, Collections.singletonList(TaxFreeTypeEnum.DERATE_DEDUCTION));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -2841,41 +2848,136 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
|
||||
getPersonalPensionMapper().updateIgnoreNull(po);
|
||||
}
|
||||
|
||||
syncMain(mainId, Collections.singletonList(TaxFreeTypeEnum.PERSONAL_PENSION));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFreeIncome(OtherDeductionDetailDeleteParam param) {
|
||||
getFreeIncomeMapper().deleteByIds(param.getIds());
|
||||
syncMain(param.getMainId(), Collections.singletonList(TaxFreeTypeEnum.FREE_INCOME));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteEndowmentInsurance(OtherDeductionDetailDeleteParam param) {
|
||||
getEndowmentInsuranceMapper().deleteByIds(param.getIds());
|
||||
syncMain(param.getMainId(), Collections.singletonList(TaxFreeTypeEnum.ENDOWMENT_INSURANCE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteGrantDonation(OtherDeductionDetailDeleteParam param) {
|
||||
getGrantDonationMapper().deleteByIds(param.getIds());
|
||||
syncMain(param.getMainId(), Collections.singletonList(TaxFreeTypeEnum.GRANT_DONATION));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteHealthInsurance(OtherDeductionDetailDeleteParam param) {
|
||||
getHealthInsuranceMapper().deleteByIds(param.getIds());
|
||||
syncMain(param.getMainId(), Collections.singletonList(TaxFreeTypeEnum.HEALTH_INSURANCE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOtherDerateDeduction(OtherDeductionDetailDeleteParam param) {
|
||||
getOtherDerateDeductionMapper().deleteByIds(param.getIds());
|
||||
syncMain(param.getMainId(), Collections.singletonList(TaxFreeTypeEnum.OTHER_DERATE_DEDUCTION));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDerateDeduction(OtherDeductionDetailDeleteParam param) {
|
||||
getDerateDeductionMapper().deleteByIds(param.getIds());
|
||||
syncMain(param.getMainId(), Collections.singletonList(TaxFreeTypeEnum.DERATE_DEDUCTION));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePersonalPension(OtherDeductionDetailDeleteParam param) {
|
||||
getPersonalPensionMapper().deleteByIds(param.getIds());
|
||||
syncMain(param.getMainId(), Collections.singletonList(TaxFreeTypeEnum.PERSONAL_PENSION));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncMain(Long mainId,List<TaxFreeTypeEnum> taxFreeTypes) {
|
||||
OtherDeductionPO deductionPO = getById(mainId);
|
||||
if (deductionPO == null) {
|
||||
throw new SalaryRunTimeException("主表不存在!");
|
||||
}
|
||||
|
||||
if(taxFreeTypes.contains(TaxFreeTypeEnum.FREE_INCOME)){
|
||||
syncFreeIncome(deductionPO);
|
||||
}
|
||||
if(taxFreeTypes.contains(TaxFreeTypeEnum.HEALTH_INSURANCE)){
|
||||
syncEndowmentInsurance(deductionPO);
|
||||
}
|
||||
if(taxFreeTypes.contains(TaxFreeTypeEnum.ENDOWMENT_INSURANCE)){
|
||||
syncGrantDonation(deductionPO);
|
||||
}
|
||||
if(taxFreeTypes.contains(TaxFreeTypeEnum.GRANT_DONATION)){
|
||||
syncHealthInsurance(deductionPO);
|
||||
}
|
||||
if(taxFreeTypes.contains(TaxFreeTypeEnum.DERATE_DEDUCTION)){
|
||||
syncDerateDeduction(deductionPO);
|
||||
}
|
||||
if(taxFreeTypes.contains(TaxFreeTypeEnum.OTHER_DERATE_DEDUCTION)){
|
||||
syncOtherDerateDeduction(deductionPO);
|
||||
}
|
||||
if(taxFreeTypes.contains(TaxFreeTypeEnum.PERSONAL_PENSION)){
|
||||
syncPersonalPension(deductionPO);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncFreeIncome(OtherDeductionPO mainPO) {
|
||||
List<FreeIncomePO> freeIncomePOS = getFreeIncomeMapper().listSome(FreeIncomePO.builder().mainId(mainPO.getId()).build());
|
||||
String sum = freeIncomePOS.stream().filter(po -> NumberUtil.isNumber(po.getFreeAmount())).map(po -> new BigDecimal(po.getFreeAmount())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString();
|
||||
mainPO.setFreeIncome(sum);
|
||||
getOtherDeductionMapper().updateData(Collections.singletonList(mainPO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncEndowmentInsurance(OtherDeductionPO mainPO) {
|
||||
List<EndowmentInsurancePO> endowmentInsurancePOS = getEndowmentInsuranceMapper().listSome(EndowmentInsurancePO.builder().mainId(mainPO.getId()).build());
|
||||
String sum = endowmentInsurancePOS.stream().filter(po -> NumberUtil.isNumber(po.getCurrentDeduction())).map(po -> new BigDecimal(po.getCurrentDeduction())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString();
|
||||
mainPO.setTaxDelayEndowmentInsurance(sum);
|
||||
getOtherDeductionMapper().updateData(Collections.singletonList(mainPO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncGrantDonation(OtherDeductionPO mainPO) {
|
||||
List<GrantDonationPO> grantDonationPOS = getGrantDonationMapper().listSome(GrantDonationPO.builder().mainId(mainPO.getId()).build());
|
||||
String sum = grantDonationPOS.stream().filter(po -> NumberUtil.isNumber(po.getActualDeduction())).map(po -> new BigDecimal(po.getActualDeduction())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString();
|
||||
mainPO.setDeductionAllowedDonation(sum);
|
||||
getOtherDeductionMapper().updateData(Collections.singletonList(mainPO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncHealthInsurance(OtherDeductionPO mainPO) {
|
||||
List<HealthInsurancePO> healthInsurancePOS = getHealthInsuranceMapper().listSome(HealthInsurancePO.builder().mainId(mainPO.getId()).build());
|
||||
String sum = healthInsurancePOS.stream().filter(po -> NumberUtil.isNumber(po.getCurrentDeduction())).map(po -> new BigDecimal(po.getCurrentDeduction())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString();
|
||||
mainPO.setBusinessHealthyInsurance(sum);
|
||||
getOtherDeductionMapper().updateData(Collections.singletonList(mainPO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncOtherDerateDeduction(OtherDeductionPO mainPO) {
|
||||
List<OtherDerateDeductionPO> otherDerateDeductionPOS = getOtherDerateDeductionMapper().listSome(OtherDerateDeductionPO.builder().mainId(mainPO.getId()).build());
|
||||
String sum = otherDerateDeductionPOS.stream().filter(po -> NumberUtil.isNumber(po.getOtherDeduction())).map(po -> new BigDecimal(po.getOtherDeduction())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString();
|
||||
mainPO.setOtherDeduction(sum);
|
||||
getOtherDeductionMapper().updateData(Collections.singletonList(mainPO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncDerateDeduction(OtherDeductionPO mainPO) {
|
||||
List<DerateDeductionPO> derateDeductionPOS = getDerateDeductionMapper().listSome(DerateDeductionPO.builder().mainId(mainPO.getId()).build());
|
||||
String sum = derateDeductionPOS.stream().filter(po -> NumberUtil.isNumber(po.getDerateAmount())).map(po -> new BigDecimal(po.getDerateAmount())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString();
|
||||
mainPO.setDerateDeduction(sum);
|
||||
getOtherDeductionMapper().updateData(Collections.singletonList(mainPO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncPersonalPension(OtherDeductionPO mainPO) {
|
||||
List<PersonalPensionPO> personalPensionPOS = getPersonalPensionMapper().listSome(PersonalPensionPO.builder().mainId(mainPO.getId()).build());
|
||||
String sum = personalPensionPOS.stream().filter(po -> NumberUtil.isNumber(po.getPayAmount())).map(po -> new BigDecimal(po.getPayAmount())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString();
|
||||
mainPO.setPrivatePension(sum);
|
||||
getOtherDeductionMapper().updateData(Collections.singletonList(mainPO));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue