删除个税扣缴义务人时校验社保福利

This commit is contained in:
Harryxzy 2023-07-20 15:14:43 +08:00
parent ce32c6571c
commit 79ef1941b2
1 changed files with 23 additions and 0 deletions

View File

@ -12,6 +12,9 @@ import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.siaccount.param.InsuranceAccountBatchParam;
import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO;
import com.engine.salary.entity.taxagent.bo.TaxAgentBO;
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO;
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO;
@ -31,6 +34,8 @@ import com.engine.salary.mapper.datacollection.AddUpDeductionMapper;
import com.engine.salary.mapper.datacollection.AddUpSituationMapper;
import com.engine.salary.mapper.datacollection.OtherDeductionMapper;
import com.engine.salary.mapper.salarysob.SalarySobMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper;
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.*;
import com.engine.salary.util.SalaryEntityUtil;
@ -117,6 +122,14 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private InsuranceBaseInfoMapper getInsuranceBaseInfoMapper() {
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
}
private InsuranceAccountBatchMapper getInsuranceAccountBatchMapper() {
return MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class);
}
// private PaymentAgencyMapper paymentAgencyMapper;
@ -469,6 +482,16 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
if (CollectionUtils.isNotEmpty(salaryArchiveList)) {
throw new SalaryRunTimeException("存在薪资档案引用");
}
// 被社保福利档案引用
List<InsuranceArchivesBaseInfoPO> socialByPaymentOrganization = getInsuranceBaseInfoMapper().getSocialByPaymentOrganization(id);
if(CollectionUtils.isNotEmpty(socialByPaymentOrganization)){
throw new SalaryRunTimeException("存在社保福利档案引用");
}
// 被社保福利台账引用
List<InsuranceAccountBatchPO> insuranceArchiveList = getInsuranceAccountBatchMapper().list(InsuranceAccountBatchParam.builder().taxAgents(Collections.singletonList(id)).build());
if(CollectionUtils.isNotEmpty(insuranceArchiveList)){
throw new SalaryRunTimeException("存在社保福利台账引用");
}
//被社保福利档案引用
// List<InsuranceArchivesSocialSchemePO> socialSchemePOList = new LambdaQueryChainWrapper<>(siArchivesSocialMapper)
// .eq(InsuranceArchivesSocialSchemePO::getTenantKey)