weaver-hrm-salary/src/com/engine/salary/service/impl/TaxAgentAdminServiceImpl.java

82 lines
2.9 KiB
Java
Raw Normal View History

2022-05-18 09:19:50 +08:00
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO;
import com.engine.salary.mapper.taxagent.TaxAgentAdminMapper;
import com.engine.salary.service.TaxAgentAdminService;
2022-05-24 09:14:26 +08:00
import com.engine.salary.util.db.MapperProxyFactory;
2022-05-18 09:19:50 +08:00
import com.google.common.collect.Lists;
import dm.jdbc.util.IdGenerator;
import org.apache.commons.collections4.CollectionUtils;
import java.util.Collection;
import java.util.Date;
import java.util.List;
/**
* 个税扣缴义务人管理员
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class TaxAgentAdminServiceImpl extends Service implements TaxAgentAdminService {
2022-05-24 09:14:26 +08:00
private TaxAgentAdminMapper getTaxAgentAdminMapper() {
return MapperProxyFactory.getProxy(TaxAgentAdminMapper.class);
}
2022-05-18 09:19:50 +08:00
@Override
public void deleteByTaxAgentIds(Collection<Long> taxAgentIds) {
if (CollectionUtils.isEmpty(taxAgentIds)) {
return;
}
2022-05-24 09:14:26 +08:00
getTaxAgentAdminMapper().deleteByTaxAgentIds(taxAgentIds);
2022-05-18 09:19:50 +08:00
}
@Override
public void batchInsert(Long taxAgentId, Collection<Long> admins) {
if (taxAgentId == null || CollectionUtils.isEmpty(admins)) {
return;
}
Date now = new Date();
admins.stream()
.map(e -> TaxAgentAdminPO.builder()
.id(IdGenerator.generate())
.taxAgentId(taxAgentId)
.employeeId(e)
.createTime(now)
.updateTime(now)
.creator((long) user.getUID())
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build())
2022-05-24 09:14:26 +08:00
.forEach(getTaxAgentAdminMapper()::insertIgnoreNull);
2022-05-18 09:19:50 +08:00
}
@Override
public List<TaxAgentAdminPO> listByTaxAgentIds(Collection<Long> taxAgentIds) {
List<TaxAgentAdminPO> list = Lists.newArrayList();
if (CollectionUtils.isEmpty(taxAgentIds)) {
return list;
}
2022-05-24 09:14:26 +08:00
return getTaxAgentAdminMapper().listSome(TaxAgentAdminPO.builder().taxAgentIds(taxAgentIds).build());
2022-05-18 09:19:50 +08:00
}
@Override
public List<TaxAgentAdminPO> listByTaxAgentIdsAndEmployeeId(Collection<Long> taxAgentIds, Long currentEmployeeId) {
List<TaxAgentAdminPO> list = Lists.newArrayList();
if (CollectionUtils.isEmpty(taxAgentIds) || currentEmployeeId == null) {
return list;
}
2022-05-24 09:14:26 +08:00
return getTaxAgentAdminMapper().listSome(TaxAgentAdminPO.builder().taxAgentIds(taxAgentIds).employeeId(currentEmployeeId).build());
2022-05-18 09:19:50 +08:00
}
@Override
public List<TaxAgentAdminPO> listByEmployeeId(Long currentEmployeeId) {
2022-05-24 09:14:26 +08:00
return getTaxAgentAdminMapper().listSome(TaxAgentAdminPO.builder().employeeId(currentEmployeeId).build());
2022-05-18 09:19:50 +08:00
}
}