2025-03-10 15:31:33 +08:00
|
|
|
package com.engine.salary.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
|
|
|
import com.engine.core.impl.Service;
|
2025-03-11 11:15:08 +08:00
|
|
|
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
2025-03-10 15:31:33 +08:00
|
|
|
import com.engine.salary.entity.deductionamount.param.DeductionAmountAddParam;
|
|
|
|
|
import com.engine.salary.entity.deductionamount.param.DeductionAmountOnlineQueryParam;
|
|
|
|
|
import com.engine.salary.entity.deductionamount.po.DeductionAmountPO;
|
|
|
|
|
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
|
|
|
|
|
import com.engine.salary.mapper.deductionamount.DeductionAmountMapper;
|
|
|
|
|
import com.engine.salary.mapper.employeedeclare.EmployeeDeclareMapper;
|
|
|
|
|
import com.engine.salary.remote.tax.client.DeductionAmountClient;
|
|
|
|
|
import com.engine.salary.service.*;
|
|
|
|
|
import com.engine.salary.util.SalaryEntityUtil;
|
|
|
|
|
import com.engine.salary.util.db.MapperProxyFactory;
|
|
|
|
|
import com.engine.salary.util.valid.ValidUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2025-03-11 11:15:08 +08:00
|
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
2025-03-10 15:31:33 +08:00
|
|
|
import weaver.hrm.User;
|
|
|
|
|
|
2025-03-11 11:15:08 +08:00
|
|
|
import java.util.Date;
|
2025-03-10 15:31:33 +08:00
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 年收入不足6万元的纳税人暂不预扣预缴税款扣除名单
|
|
|
|
|
* <p>Copyright: Copyright (c) 2023</p>
|
|
|
|
|
* <p>Company: 泛微软件</p>
|
|
|
|
|
*
|
|
|
|
|
* @author qiantao
|
|
|
|
|
* @version 1.0
|
|
|
|
|
**/
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class DeductionAmountServiceImpl extends Service implements DeductionAmountService {
|
|
|
|
|
|
|
|
|
|
private DeductionAmountMapper getDeductionAmountMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(DeductionAmountMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private EmployeeDeclareMapper getEmployeeDeclareMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(EmployeeDeclareMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private TaxAgentService getTaxAgentService(User user) {
|
|
|
|
|
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
|
|
|
|
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private SalaryArchiveService getSalaryArchiveService(User user) {
|
|
|
|
|
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private TaxDeclarationApiConfigService getTaxDeclarationApiConfigService(User user) {
|
|
|
|
|
return ServiceUtil.getService(TaxDeclarationApiConfigServiceImpl.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private TaxAgentTaxReturnService getTaxAgentTaxReturnService(User user) {
|
|
|
|
|
return ServiceUtil.getService(TaxAgentTaxReturnServiceImpl.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private EmployeeDeclareRecordService getEmployeeDeclareRecordService(User user) {
|
|
|
|
|
return ServiceUtil.getService(EmployeeDeclareRecordServiceImpl.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private TaxDeclarationApiBillingService getTaxDeclarationApiBillingService(User user) {
|
|
|
|
|
return ServiceUtil.getService(TaxDeclarationApiBillingServiceImpl.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Object query(DeductionAmountOnlineQueryParam queryParam) {
|
|
|
|
|
Long taxAgentId = queryParam.getTaxAgentId();
|
|
|
|
|
DeductionAmountClient deductionAmountClient = new DeductionAmountClient(taxAgentId);
|
|
|
|
|
return deductionAmountClient.query(queryParam.getYear());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void add(DeductionAmountAddParam param) {
|
|
|
|
|
ValidUtil.doValidator(param);
|
|
|
|
|
|
|
|
|
|
//已存在
|
|
|
|
|
List<DeductionAmountPO> deductionAmountPOS = getDeductionAmountMapper().listSome(DeductionAmountPO.builder().taxAgentId(param.getTaxAgentId()).year(param.getYear()).build());
|
|
|
|
|
List<Long> oldIds = SalaryEntityUtil.properties(deductionAmountPOS, DeductionAmountPO::getEmployeeId, Collectors.toList());
|
|
|
|
|
|
|
|
|
|
//本次新增
|
|
|
|
|
List<Long> employeeDeclareIds = param.getEmployeeDeclareIds();
|
|
|
|
|
List<EmployeeDeclarePO> employeeDeclarePOS = getEmployeeDeclareMapper().listSome(EmployeeDeclarePO.builder().ids(employeeDeclareIds).build());
|
|
|
|
|
|
2025-03-11 11:15:08 +08:00
|
|
|
Date now = new Date();
|
|
|
|
|
employeeDeclarePOS.stream()
|
|
|
|
|
.filter(employeeDeclarePO -> !oldIds.contains(employeeDeclarePO.getEmployeeId()))
|
|
|
|
|
.map(employeeDeclarePO -> {
|
|
|
|
|
DeductionAmountPO.builder()
|
|
|
|
|
.id(employeeDeclarePO.getEmployeeId())
|
|
|
|
|
.taxAgentId(employeeDeclarePO.getEmployeeId())
|
|
|
|
|
.year(param.getYear())
|
|
|
|
|
.employeeId(employeeDeclarePO.getEmployeeId())
|
|
|
|
|
.employeeName(employeeDeclarePO.getEmployeeName())
|
|
|
|
|
.employeeType(employeeDeclarePO.getEmployeeType())
|
|
|
|
|
.jobNum(employeeDeclarePO.getJobNum())
|
|
|
|
|
.cardNum(employeeDeclarePO.getCardNum())
|
|
|
|
|
.cardType(employeeDeclarePO.getCardType())
|
|
|
|
|
.declareStatus(0)
|
|
|
|
|
.deductFlag(1)
|
|
|
|
|
.successfullyDeclared(0)
|
|
|
|
|
.creator((long)user.getUID())
|
|
|
|
|
.createTime(now)
|
|
|
|
|
.updateTime(now)
|
|
|
|
|
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
|
|
|
|
.deleteType(NumberUtils.INTEGER_ZERO);
|
|
|
|
|
});
|
2025-03-10 15:31:33 +08:00
|
|
|
}
|
|
|
|
|
}
|