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; import com.engine.salary.util.db.MapperProxyFactory; 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; /** * 个税扣缴义务人管理员 *

Copyright: Copyright (c) 2022

*

Company: 泛微软件

* * @author qiantao * @version 1.0 **/ public class TaxAgentAdminServiceImpl extends Service implements TaxAgentAdminService { private TaxAgentAdminMapper getTaxAgentAdminMapper() { return MapperProxyFactory.getProxy(TaxAgentAdminMapper.class); } @Override public void deleteByTaxAgentIds(Collection taxAgentIds) { if (CollectionUtils.isEmpty(taxAgentIds)) { return; } getTaxAgentAdminMapper().deleteByTaxAgentIds(taxAgentIds); } @Override public void batchInsert(Long taxAgentId, Collection 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) .deleteType(0) .creator((long) user.getUID()) .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) .build()) .forEach(getTaxAgentAdminMapper()::insertIgnoreNull); } @Override public List listByTaxAgentIds(Collection taxAgentIds) { List list = Lists.newArrayList(); if (CollectionUtils.isEmpty(taxAgentIds)) { return list; } return getTaxAgentAdminMapper().listSome(TaxAgentAdminPO.builder().taxAgentIds(taxAgentIds).build()); } @Override public List listByTaxAgentIdsAndEmployeeId(Collection taxAgentIds, Long currentEmployeeId) { List list = Lists.newArrayList(); if (CollectionUtils.isEmpty(taxAgentIds) || currentEmployeeId == null) { return list; } return getTaxAgentAdminMapper().listSome(TaxAgentAdminPO.builder().taxAgentIds(taxAgentIds).employeeId(currentEmployeeId).build()); } @Override public List listByEmployeeId(Long currentEmployeeId) { return getTaxAgentAdminMapper().listSome(TaxAgentAdminPO.builder().employeeId(currentEmployeeId).build()); } }