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

79 lines
2.8 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;
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 {
private TaxAgentAdminMapper taxAgentAdminMapper;
@Override
public void deleteByTaxAgentIds(Collection<Long> taxAgentIds) {
if (CollectionUtils.isEmpty(taxAgentIds)) {
return;
}
taxAgentAdminMapper.deleteByTaxAgentIds(taxAgentIds);
}
@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())
.forEach(taxAgentAdminMapper::insertIgnoreNull);
}
@Override
public List<TaxAgentAdminPO> listByTaxAgentIds(Collection<Long> taxAgentIds) {
List<TaxAgentAdminPO> list = Lists.newArrayList();
if (CollectionUtils.isEmpty(taxAgentIds)) {
return list;
}
return taxAgentAdminMapper.listSome(TaxAgentAdminPO.builder().taxAgentIds(taxAgentIds).build());
}
@Override
public List<TaxAgentAdminPO> listByTaxAgentIdsAndEmployeeId(Collection<Long> taxAgentIds, Long currentEmployeeId) {
List<TaxAgentAdminPO> list = Lists.newArrayList();
if (CollectionUtils.isEmpty(taxAgentIds) || currentEmployeeId == null) {
return list;
}
return taxAgentAdminMapper.listSome(TaxAgentAdminPO.builder().taxAgentIds(taxAgentIds).employeeId(currentEmployeeId).build());
}
@Override
public List<TaxAgentAdminPO> listByEmployeeId(Long currentEmployeeId) {
return taxAgentAdminMapper.listSome(TaxAgentAdminPO.builder().employeeId(currentEmployeeId).build());
}
}