2022-05-19 14:50:01 +08:00
|
|
|
|
package com.engine.salary.service.impl;
|
|
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
import com.engine.common.service.HrmCommonService;
|
|
|
|
|
|
import com.engine.common.service.impl.HrmCommonServiceImpl;
|
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
2022-05-19 14:50:01 +08:00
|
|
|
|
import com.engine.core.impl.Service;
|
2024-02-21 18:19:02 +08:00
|
|
|
|
import com.engine.salary.config.SalaryElogConfig;
|
2022-06-16 14:13:22 +08:00
|
|
|
|
import com.engine.salary.constant.SalaryAuthConstant;
|
2024-03-12 14:34:44 +08:00
|
|
|
|
import com.engine.hrmelog.entity.dto.LoggerContext;
|
2022-05-19 14:50:01 +08:00
|
|
|
|
import com.engine.salary.entity.datacollection.AddUpDeduction;
|
|
|
|
|
|
import com.engine.salary.entity.datacollection.AddUpSituation;
|
2023-03-15 15:49:20 +08:00
|
|
|
|
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
2022-05-19 14:50:01 +08:00
|
|
|
|
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
|
|
|
|
|
|
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
2022-12-02 16:58:19 +08:00
|
|
|
|
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
|
2022-06-22 19:26:05 +08:00
|
|
|
|
import com.engine.salary.entity.salarysob.po.SalarySobPO;
|
2023-07-20 15:14:43 +08:00
|
|
|
|
import com.engine.salary.entity.siaccount.param.InsuranceAccountBatchParam;
|
|
|
|
|
|
import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO;
|
|
|
|
|
|
import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO;
|
2022-05-19 14:50:01 +08:00
|
|
|
|
import com.engine.salary.entity.taxagent.bo.TaxAgentBO;
|
|
|
|
|
|
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO;
|
|
|
|
|
|
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO;
|
|
|
|
|
|
import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO;
|
|
|
|
|
|
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
|
|
|
|
|
|
import com.engine.salary.entity.taxagent.param.TaxAgentAdminChangeCheckParam;
|
|
|
|
|
|
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
|
|
|
|
|
|
import com.engine.salary.entity.taxagent.param.TaxAgentSaveParam;
|
|
|
|
|
|
import com.engine.salary.entity.taxagent.po.*;
|
2024-02-21 18:19:02 +08:00
|
|
|
|
import com.engine.salary.enums.OperateTypeEnum;
|
2023-03-15 22:48:01 +08:00
|
|
|
|
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
|
2022-05-19 14:50:01 +08:00
|
|
|
|
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
|
|
|
|
|
|
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
|
|
|
|
|
|
import com.engine.salary.enums.taxagent.TaxAgentRoleTypeEnum;
|
|
|
|
|
|
import com.engine.salary.exception.SalaryRunTimeException;
|
|
|
|
|
|
import com.engine.salary.mapper.archive.SalaryArchiveMapper;
|
|
|
|
|
|
import com.engine.salary.mapper.datacollection.AddUpDeductionMapper;
|
|
|
|
|
|
import com.engine.salary.mapper.datacollection.AddUpSituationMapper;
|
|
|
|
|
|
import com.engine.salary.mapper.datacollection.OtherDeductionMapper;
|
2022-06-22 19:26:05 +08:00
|
|
|
|
import com.engine.salary.mapper.salarysob.SalarySobMapper;
|
2023-07-20 15:14:43 +08:00
|
|
|
|
import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper;
|
|
|
|
|
|
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
|
2022-05-19 14:50:01 +08:00
|
|
|
|
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
|
|
|
|
|
|
import com.engine.salary.service.*;
|
2022-06-29 17:38:00 +08:00
|
|
|
|
import com.engine.salary.util.SalaryEntityUtil;
|
2022-05-19 14:50:01 +08:00
|
|
|
|
import com.engine.salary.util.SalaryI18nUtil;
|
2022-05-24 09:14:26 +08:00
|
|
|
|
import com.engine.salary.util.db.MapperProxyFactory;
|
2022-05-19 14:50:01 +08:00
|
|
|
|
import com.engine.salary.util.page.PageInfo;
|
2022-05-25 13:10:03 +08:00
|
|
|
|
import com.engine.salary.util.page.SalaryPageUtil;
|
2022-05-24 09:14:26 +08:00
|
|
|
|
import com.engine.salary.util.valid.RuntimeTypeEnum;
|
|
|
|
|
|
import com.engine.salary.util.valid.ValidUtil;
|
2022-05-19 14:50:01 +08:00
|
|
|
|
import com.google.common.collect.Lists;
|
2022-06-16 14:13:22 +08:00
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2022-05-19 14:50:01 +08:00
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
2022-05-24 09:14:26 +08:00
|
|
|
|
import weaver.hrm.User;
|
2022-06-16 14:13:22 +08:00
|
|
|
|
import weaver.systeminfo.setting.HrmUserSettingComInfo;
|
|
|
|
|
|
import weaver.systeminfo.systemright.CheckUserRight;
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
2022-06-16 14:13:22 +08:00
|
|
|
|
@Slf4j
|
2022-05-31 21:05:59 +08:00
|
|
|
|
public class TaxAgentServiceImpl extends Service implements TaxAgentService {
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
private TaxAgentBaseService getTaxAgentBaseService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(TaxAgentBaseServiceImpl.class, user);
|
|
|
|
|
|
}
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
private TaxAgentAdminService getTaxAgentAdminService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(TaxAgentAdminServiceImpl.class, user);
|
|
|
|
|
|
}
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
private TaxAgentSubAdminService taxAgentSubAdminService;
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
private TaxAgentManageRangeService getTaxAgentManageRangeService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(TaxAgentManageRangeServiceImpl.class, user);
|
|
|
|
|
|
}
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
private TaxAgentEmpService getTaxAgentEmpService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(TaxAgentEmpServiceImpl.class, user);
|
|
|
|
|
|
}
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
private TaxAgentSubAdminEmpService taxAgentSubAdminEmpService;
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
private HrmCommonService getHrmCommonService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(HrmCommonServiceImpl.class, user);
|
|
|
|
|
|
}
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
|
|
|
|
|
|
}
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
private SIAccountService getSIAccountService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(SIAccountServiceImpl.class, user);
|
|
|
|
|
|
}
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
private SalaryArchiveMapper getSalaryArchiveMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(SalaryArchiveMapper.class);
|
|
|
|
|
|
}
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
private AddUpDeductionMapper getAddUpDeductionMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(AddUpDeductionMapper.class);
|
|
|
|
|
|
}
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
private OtherDeductionMapper getOtherDeductionMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(OtherDeductionMapper.class);
|
|
|
|
|
|
}
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
private AddUpSituationMapper getAddUpSituationMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(AddUpSituationMapper.class);
|
|
|
|
|
|
}
|
2022-07-05 15:31:18 +08:00
|
|
|
|
|
2022-06-22 19:26:05 +08:00
|
|
|
|
private SalarySobMapper getSalarySobMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(SalarySobMapper.class);
|
|
|
|
|
|
}
|
2022-05-24 09:14:26 +08:00
|
|
|
|
|
|
|
|
|
|
private TaxAgentMapper getTaxAgentMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-15 15:49:20 +08:00
|
|
|
|
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
2022-05-24 09:14:26 +08:00
|
|
|
|
}
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2023-07-20 15:14:43 +08:00
|
|
|
|
private InsuranceBaseInfoMapper getInsuranceBaseInfoMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private InsuranceAccountBatchMapper getInsuranceAccountBatchMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
|
|
|
|
|
// private PaymentAgencyMapper paymentAgencyMapper;
|
|
|
|
|
|
|
|
|
|
|
|
// private SIArchivesSocialMapper siArchivesSocialMapper;
|
|
|
|
|
|
|
|
|
|
|
|
// private SIArchivesFundMapper siArchivesFundMapper;
|
|
|
|
|
|
|
|
|
|
|
|
// private SIArchivesOtherMapper siArchivesOtherMapper;
|
|
|
|
|
|
|
|
|
|
|
|
// private AuthorityService authorityService;
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
// private HrmCommonHrmStatusService hrmCommonHrmStatusService;
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2022-10-26 13:46:36 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public List<TaxAgentEmployeePO> listEmployees() {
|
2023-03-15 15:49:20 +08:00
|
|
|
|
List<DataCollectionEmployee> employees = getSalaryEmployeeService(user).listEmployee();
|
|
|
|
|
|
return convert2TaxAgentEmployeePO(employees);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-15 22:48:01 +08:00
|
|
|
|
public List<TaxAgentEmployeePO> convert2TaxAgentEmployeePO(List<DataCollectionEmployee> dataCollectionEmployees) {
|
2023-03-15 15:49:20 +08:00
|
|
|
|
List<TaxAgentEmployeePO> result = new ArrayList<>();
|
|
|
|
|
|
dataCollectionEmployees.stream().forEach(PO -> {
|
|
|
|
|
|
TaxAgentEmployeePO taxAgentEmployeePO = new TaxAgentEmployeePO();
|
|
|
|
|
|
BeanUtils.copyProperties(PO, taxAgentEmployeePO);
|
|
|
|
|
|
result.add(taxAgentEmployeePO);
|
|
|
|
|
|
});
|
|
|
|
|
|
return result;
|
2022-10-26 13:46:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-05-19 14:50:01 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public TaxAgentRoleTypeEnum getRoleType(Long currentEmployeeId) {
|
|
|
|
|
|
TaxAgentRoleTypeEnum roleType = TaxAgentRoleTypeEnum.NONE;
|
|
|
|
|
|
if (isChief(currentEmployeeId)) {
|
|
|
|
|
|
return TaxAgentRoleTypeEnum.CHIEF;
|
|
|
|
|
|
}
|
|
|
|
|
|
// 是否开启分权
|
2022-05-24 09:14:26 +08:00
|
|
|
|
boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution();
|
2022-05-19 14:50:01 +08:00
|
|
|
|
if (!isOpenDevolution) {
|
2022-05-24 09:14:26 +08:00
|
|
|
|
List<TaxAgentAdminPO> taxAgentAdmins = getTaxAgentAdminService(user).listByEmployeeId(currentEmployeeId);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(taxAgentAdmins)) {
|
|
|
|
|
|
return TaxAgentRoleTypeEnum.ADMIN;
|
|
|
|
|
|
}
|
|
|
|
|
|
List<TaxAgentSubAdminPO> taxAgentSubAdmins = taxAgentSubAdminService.listByAndEmployeeId(currentEmployeeId);
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(taxAgentSubAdmins)) {
|
|
|
|
|
|
return TaxAgentRoleTypeEnum.SUBADMIN;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return roleType;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-05-31 21:48:00 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Boolean isNeedAuth(Long currentEmployeeId) {
|
2022-06-16 14:13:22 +08:00
|
|
|
|
return isOpenDevolution() && !isChief(currentEmployeeId);
|
2022-05-31 21:48:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-19 14:50:01 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Boolean isChief(Long currentEmployeeId) {
|
2022-06-16 14:13:22 +08:00
|
|
|
|
if (user == null) {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
CheckUserRight ck = new CheckUserRight();
|
|
|
|
|
|
boolean hasRight = ck.checkUserRight(SalaryAuthConstant.SALARY_CHIEF, user);
|
|
|
|
|
|
|
|
|
|
|
|
if (!hasRight) {
|
|
|
|
|
|
String belongtoshow = "";// 是否启用多账号数据显示
|
|
|
|
|
|
try {
|
|
|
|
|
|
HrmUserSettingComInfo HrmUserSettingComInfo = new HrmUserSettingComInfo();
|
|
|
|
|
|
belongtoshow = HrmUserSettingComInfo.getBelongtoshowByUserId("" + user.getUID());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
log.error("获取权限异常", e);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (belongtoshow.equals("1")) {
|
|
|
|
|
|
List lsUser = User.getBelongtoUsersByUserId(user.getUID());// 所有此账号
|
|
|
|
|
|
if (lsUser != null) {
|
|
|
|
|
|
for (Object tmpUser : lsUser) {
|
|
|
|
|
|
hasRight = ck.checkUserRight(SalaryAuthConstant.SALARY_CHIEF, (User) tmpUser);
|
|
|
|
|
|
if (hasRight) {
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2022-06-16 14:13:22 +08:00
|
|
|
|
return hasRight;
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Boolean isDefaultOpen(Long currentEmployeeId) {
|
2022-06-09 17:45:28 +08:00
|
|
|
|
return getTaxAgentBaseService(user).isOpenDevolution();
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Boolean isAdminEnable(Long currentEmployeeId) {
|
2022-06-01 19:14:05 +08:00
|
|
|
|
//是管理员
|
|
|
|
|
|
List<TaxAgentAdminPO> taxAgentAdminList = getTaxAgentAdminService(user).listByEmployeeId(currentEmployeeId);
|
|
|
|
|
|
return CollectionUtils.isNotEmpty(taxAgentAdminList);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public PageInfo<TaxAgentPO> listPage(TaxAgentQueryParam queryParam) {
|
2022-05-24 09:14:26 +08:00
|
|
|
|
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listBySome(queryParam);
|
2022-12-12 10:25:55 +08:00
|
|
|
|
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
|
|
|
|
|
|
taxAgentPOS, TaxAgentPO.class);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public List<TaxAgentPO> list(TaxAgentQueryParam queryParam) {
|
2022-05-24 09:14:26 +08:00
|
|
|
|
return getTaxAgentMapper().listBySome(queryParam);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public List<TaxAgentPO> listByIds(Collection<Long> ids) {
|
2022-05-24 09:14:26 +08:00
|
|
|
|
return getTaxAgentMapper().listBySome(TaxAgentQueryParam.builder().ids(ids).build());
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public List<TaxAgentPO> listAll() {
|
2022-05-24 09:14:26 +08:00
|
|
|
|
return getTaxAgentMapper().listAll();
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public TaxAgentPO getById(Long id) {
|
2022-05-24 09:14:26 +08:00
|
|
|
|
return getTaxAgentMapper().getById(id);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Collection<TaxAgentListDTO> findAll() {
|
2022-05-24 09:14:26 +08:00
|
|
|
|
List<TaxAgentPO> taxAgents = getTaxAgentMapper().listAll();
|
2022-05-19 14:50:01 +08:00
|
|
|
|
return TaxAgentBO.convertToListDTO(taxAgents);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Collection<TaxAgentPO> listAllTaxAgents(Long employeeId) {
|
2022-05-24 09:14:26 +08:00
|
|
|
|
List<TaxAgentPO> taxAgents = getTaxAgentMapper().listAll();
|
2022-07-05 15:31:18 +08:00
|
|
|
|
return handleForDevolution(taxAgents, employeeId, true);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Collection<TaxAgentPO> listAllTaxAgentsAsAdmin(Long employeeId) {
|
2022-05-24 09:14:26 +08:00
|
|
|
|
List<TaxAgentPO> taxAgents = getTaxAgentMapper().listAll();
|
2022-05-19 14:50:01 +08:00
|
|
|
|
// 是否开启分权
|
2022-05-24 09:14:26 +08:00
|
|
|
|
boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution();
|
2022-05-19 14:50:01 +08:00
|
|
|
|
if (!isOpenDevolution) {
|
|
|
|
|
|
return taxAgents;
|
|
|
|
|
|
}
|
|
|
|
|
|
List<Long> taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
|
|
|
|
|
List<Long> enableTaxAgentIds = Lists.newArrayList();
|
|
|
|
|
|
// 1.判断自己是否是管理员, 如果是管理员,就是能够查看所属个税扣缴义务人
|
2022-05-24 09:14:26 +08:00
|
|
|
|
List<TaxAgentAdminPO> taxAgentAdminList = getTaxAgentAdminService(user).listByTaxAgentIds(taxAgentIds);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
// 是管理员的列表
|
|
|
|
|
|
List<Long> adminTaxAgentIds = taxAgentAdminList.stream().filter(f -> f.getEmployeeId().equals(employeeId)).map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
enableTaxAgentIds.addAll(adminTaxAgentIds);
|
|
|
|
|
|
return taxAgents.stream().filter(f -> enableTaxAgentIds.contains(f.getId())).collect(Collectors.toList());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Collection<TaxAgentEmployeeTaxAgentDTO> listAllTaxAgentsAsRange(List<Long> employeeIds) {
|
2022-05-24 09:14:26 +08:00
|
|
|
|
List<TaxAgentPO> taxAgents = getTaxAgentMapper().listAll();
|
2022-05-19 14:50:01 +08:00
|
|
|
|
List<Long> taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
|
|
|
|
|
|
2023-03-15 22:48:01 +08:00
|
|
|
|
List<TaxAgentEmpPO> taxAgentEmployees = getTaxAgentEmpService(user).listByTaxAgentIds(taxAgentIds, UseEmployeeTypeEnum.ORG);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(taxAgentEmployees)) {
|
|
|
|
|
|
return Lists.newArrayList();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 转换数据结构
|
|
|
|
|
|
List<Long> allemployeeIds = taxAgentEmployees.stream().map(TaxAgentEmpPO::getEmployeeId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
return allemployeeIds.stream().map(m -> {
|
|
|
|
|
|
List<Long> enableTaxAgentIds = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(m)).map(TaxAgentEmpPO::getTaxAgentId).distinct()
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
return TaxAgentEmployeeTaxAgentDTO.builder()
|
|
|
|
|
|
.employeeId(m)
|
|
|
|
|
|
.taxAgentIds(enableTaxAgentIds)
|
|
|
|
|
|
.build();
|
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-05-24 09:14:26 +08:00
|
|
|
|
public String save(TaxAgentSaveParam saveParam) {
|
|
|
|
|
|
ValidUtil.doValidator(saveParam);
|
2023-07-19 11:10:27 +08:00
|
|
|
|
saveParam.setName(StringUtils.trim(saveParam.getName()));
|
2022-05-24 09:14:26 +08:00
|
|
|
|
|
2022-05-19 14:50:01 +08:00
|
|
|
|
// 是否开启分权
|
2022-05-24 09:14:26 +08:00
|
|
|
|
boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution();
|
2022-05-26 11:02:55 +08:00
|
|
|
|
if (isOpenDevolution && CollectionUtils.isEmpty(saveParam.getAdminUserIds())) {
|
2022-05-19 14:50:01 +08:00
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(106271, "请选择管理员"));
|
|
|
|
|
|
}
|
2022-05-24 09:14:26 +08:00
|
|
|
|
List<TaxAgentPO> taxAgents = getTaxAgentMapper().listByName(saveParam.getName());
|
2022-05-19 14:50:01 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(taxAgents)) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98080, "名称不允许重复"));
|
|
|
|
|
|
}
|
|
|
|
|
|
// PaymentAgencyPO paymentAgencyPO = new LambdaQueryChainWrapper<>(paymentAgencyMapper)
|
|
|
|
|
|
// .eq(PaymentAgencyPO::getTenantKey)
|
|
|
|
|
|
// .eq(PaymentAgencyPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
|
|
|
|
|
|
// .eq(PaymentAgencyPO::getAgencyName, saveParam.getName())
|
|
|
|
|
|
// .one();
|
|
|
|
|
|
// if (paymentAgencyPO != null) {
|
|
|
|
|
|
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(115130, "名称不允许与社保福利代缴机构名称重复"));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// 保存
|
2022-05-24 09:14:26 +08:00
|
|
|
|
TaxAgentPO taxAgent = TaxAgentBO.convertToPO(saveParam, (long) user.getUID());
|
2022-06-07 15:43:22 +08:00
|
|
|
|
getTaxAgentMapper().insertIgnoreNull(taxAgent);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
if (isOpenDevolution) {
|
2022-06-07 15:43:22 +08:00
|
|
|
|
getTaxAgentAdminService(user).batchInsert(taxAgent.getId(), saveParam.getAdminUserIds());
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 记录日志
|
2024-02-21 18:19:02 +08:00
|
|
|
|
LoggerContext<TaxAgentPO> loggerContext = new LoggerContext<>();
|
|
|
|
|
|
loggerContext.setUser(user);
|
|
|
|
|
|
loggerContext.setTargetId(taxAgent.getId().toString());
|
|
|
|
|
|
loggerContext.setTargetName(taxAgent.getName());
|
|
|
|
|
|
loggerContext.setOperateType(OperateTypeEnum.ADD.getValue());
|
|
|
|
|
|
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "新增个税扣缴义务人"));
|
|
|
|
|
|
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "新增个税扣缴义务人"));
|
|
|
|
|
|
loggerContext.setNewValues(taxAgent);
|
|
|
|
|
|
SalaryElogConfig.taxAgentLoggerTemplate.write(loggerContext);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
return StringUtils.EMPTY + taxAgent.getId();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-05-19 16:36:18 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public String paymentAgencyUpdate(TaxAgentPO taxAgentPO) {
|
2022-05-24 09:14:26 +08:00
|
|
|
|
getTaxAgentMapper().update(taxAgentPO);
|
2022-05-19 16:36:18 +08:00
|
|
|
|
return "";
|
|
|
|
|
|
}
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-05-24 09:14:26 +08:00
|
|
|
|
public String update(TaxAgentSaveParam saveParam) {
|
|
|
|
|
|
ValidUtil.doValidator(saveParam, RuntimeTypeEnum.UPDATE);
|
2023-07-19 11:10:27 +08:00
|
|
|
|
saveParam.setName(StringUtils.trim(saveParam.getName()));
|
2022-05-24 09:14:26 +08:00
|
|
|
|
|
2022-05-19 14:50:01 +08:00
|
|
|
|
TaxAgentPO taxAgent = getById(saveParam.getId());
|
|
|
|
|
|
if (taxAgent == null) {
|
2022-06-21 22:37:22 +08:00
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100545, "个税扣缴义务人不存在或不在权限范围内"));
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 是否开启分权
|
2022-05-24 09:14:26 +08:00
|
|
|
|
boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution();
|
2022-05-26 11:02:55 +08:00
|
|
|
|
if (isOpenDevolution && CollectionUtils.isEmpty(saveParam.getAdminUserIds())) {
|
2022-05-19 14:50:01 +08:00
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(106271, "请选择管理员"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
List<TaxAgentPO> individualTaxWithholdingAgents = getTaxAgentMapper().listByName(saveParam.getName());
|
2022-05-19 14:50:01 +08:00
|
|
|
|
boolean nameExist = individualTaxWithholdingAgents.stream().anyMatch(e -> !Objects.equals(e.getId(), saveParam.getId()));
|
|
|
|
|
|
if (nameExist) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98080, "名称不允许重复"));
|
|
|
|
|
|
}
|
|
|
|
|
|
TaxAgentPO taxAgentNew = new TaxAgentPO();
|
|
|
|
|
|
BeanUtils.copyProperties(taxAgent, taxAgentNew);
|
|
|
|
|
|
BeanUtils.copyProperties(saveParam, taxAgentNew);
|
|
|
|
|
|
taxAgentNew.setUpdateTime(new Date());
|
2022-05-24 09:14:26 +08:00
|
|
|
|
getTaxAgentMapper().update(taxAgentNew);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
if (isOpenDevolution) {
|
2022-05-26 11:02:55 +08:00
|
|
|
|
// Boolean isUnEnableChange = adminChangeCheck(TaxAgentAdminChangeCheckParam.builder()
|
|
|
|
|
|
// .taxAgentId(saveParam.getId())
|
|
|
|
|
|
// .adminUserId(saveParam.getAdminUserIds())
|
|
|
|
|
|
// .build());
|
|
|
|
|
|
// if (isUnEnableChange) {
|
|
|
|
|
|
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(115937, "该管理员有未归档核算数据,不可更换管理员"));
|
|
|
|
|
|
// }
|
2022-05-19 14:50:01 +08:00
|
|
|
|
// 删除管理员
|
2022-05-24 09:14:26 +08:00
|
|
|
|
getTaxAgentAdminService(user).deleteByTaxAgentIds(Collections.singletonList(taxAgent.getId()));
|
2022-05-19 14:50:01 +08:00
|
|
|
|
// 新增管理员
|
2022-05-26 11:02:55 +08:00
|
|
|
|
getTaxAgentAdminService(user).batchInsert(saveParam.getId(), saveParam.getAdminUserIds());
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 记录日志
|
2024-02-21 18:19:02 +08:00
|
|
|
|
LoggerContext<TaxAgentPO> loggerContext = new LoggerContext<>();
|
|
|
|
|
|
loggerContext.setUser(user);
|
|
|
|
|
|
loggerContext.setTargetId(taxAgentNew.getId().toString());
|
|
|
|
|
|
loggerContext.setTargetName(taxAgentNew.getName());
|
|
|
|
|
|
loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
|
|
|
|
|
|
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "编辑个税扣缴义务人"));
|
|
|
|
|
|
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "编辑个税扣缴义务人"));
|
|
|
|
|
|
loggerContext.setOldValues(taxAgent);
|
|
|
|
|
|
loggerContext.setNewValues(taxAgentNew);
|
|
|
|
|
|
SalaryElogConfig.taxAgentLoggerTemplate.write(loggerContext);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
|
|
|
|
|
return StringUtils.EMPTY;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-05-24 09:14:26 +08:00
|
|
|
|
public Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam) {
|
2022-05-26 11:02:55 +08:00
|
|
|
|
ValidUtil.doValidator(checkParam);
|
2022-05-24 09:14:26 +08:00
|
|
|
|
List<TaxAgentAdminPO> taxAgentAdminList = getTaxAgentAdminService(user).listByTaxAgentIds(Collections.singletonList(checkParam.getTaxAgentId()));
|
2022-05-19 14:50:01 +08:00
|
|
|
|
Long adminUserId = CollectionUtils.isNotEmpty(taxAgentAdminList) ? taxAgentAdminList.get(0).getEmployeeId() : 0L;
|
|
|
|
|
|
boolean isChanged = checkParam.getAdminUserId() != null && !adminUserId.equals(checkParam.getAdminUserId());
|
|
|
|
|
|
// 更换了管理员
|
|
|
|
|
|
if (isChanged) {
|
|
|
|
|
|
// 检查是否核算
|
|
|
|
|
|
//todo 1.社保福利档案是否有核算未归档
|
2022-05-24 09:14:26 +08:00
|
|
|
|
Boolean checkedValue = false;// getSIAccountService(user).changeAdminUnfiledCheck(adminUserId);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
// 2.薪资核算是否有核算未归档
|
2022-05-24 09:14:26 +08:00
|
|
|
|
List<SalaryAcctRecordPO> salaryAcctRecords = getSalaryAcctRecordService(user).listByStatusAndEmployeeId(SalaryAcctRecordStatusEnum.NOT_ARCHIVED, adminUserId);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(salaryAcctRecords) || checkedValue) {
|
|
|
|
|
|
return Boolean.TRUE;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return Boolean.FALSE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-06-29 17:38:00 +08:00
|
|
|
|
|
2022-05-19 14:50:01 +08:00
|
|
|
|
@Override
|
2022-12-02 16:58:19 +08:00
|
|
|
|
public String delete(List<Long> ids) {
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
if (org.springframework.util.CollectionUtils.isEmpty(ids)) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<TaxAgentPO> taxAgents = getTaxAgentMapper().listBySome(TaxAgentQueryParam.builder().ids(ids).build());
|
2022-05-19 14:50:01 +08:00
|
|
|
|
if (CollectionUtils.isEmpty(taxAgents)) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(85382, "要删除的个税扣缴义务人在不存在或已删除"));
|
|
|
|
|
|
}
|
|
|
|
|
|
// 正在使用的记录不允许删除
|
2022-12-02 16:58:19 +08:00
|
|
|
|
boolean checkUsed = checkUsed(ids.get(0));
|
2022-05-19 14:50:01 +08:00
|
|
|
|
if (checkUsed) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100570, "正在使用的记录不允许删除"));
|
|
|
|
|
|
}
|
|
|
|
|
|
// 删除管理员
|
2022-05-24 09:14:26 +08:00
|
|
|
|
getTaxAgentAdminService(user).deleteByTaxAgentIds(ids);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
// 删除分管理员和对应管理范围
|
2022-05-24 09:14:26 +08:00
|
|
|
|
// todo taxAgentSubAdminService.deleteByTaxAgentIds(ids);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
// 删除人员范围
|
2022-05-24 09:14:26 +08:00
|
|
|
|
getTaxAgentManageRangeService(user).deleteByTaxAgentIds(ids);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
|
getTaxAgentMapper().deleteByIds(ids);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
|
|
|
|
|
// 记录日志
|
2024-02-21 18:19:02 +08:00
|
|
|
|
taxAgents.forEach(e ->{
|
|
|
|
|
|
LoggerContext<TaxAgentPO> loggerContext = new LoggerContext<>();
|
|
|
|
|
|
loggerContext.setUser(user);
|
|
|
|
|
|
loggerContext.setTargetId(e.getId().toString());
|
|
|
|
|
|
loggerContext.setTargetName(e.getName());
|
|
|
|
|
|
loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue());
|
|
|
|
|
|
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "删除个税扣缴义务人"));
|
|
|
|
|
|
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "删除个税扣缴义务人"));
|
|
|
|
|
|
loggerContext.setOldValues(e);
|
|
|
|
|
|
SalaryElogConfig.taxAgentLoggerTemplate.write(loggerContext);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
2024-02-21 18:19:02 +08:00
|
|
|
|
});
|
2022-05-19 14:50:01 +08:00
|
|
|
|
return StringUtils.EMPTY;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 检查正在被使用的记录
|
|
|
|
|
|
*
|
2022-12-02 16:58:19 +08:00
|
|
|
|
* @param id
|
2022-05-19 14:50:01 +08:00
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2022-12-02 16:58:19 +08:00
|
|
|
|
private boolean checkUsed(Long id) {
|
|
|
|
|
|
//被薪资档案引用
|
2022-12-05 16:01:08 +08:00
|
|
|
|
List<SalaryArchivePO> salaryArchiveList = getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().taxAgentId(id).build());
|
2022-12-02 16:58:19 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(salaryArchiveList)) {
|
2022-12-05 16:01:08 +08:00
|
|
|
|
throw new SalaryRunTimeException("存在薪资档案引用");
|
2022-12-02 16:58:19 +08:00
|
|
|
|
}
|
2023-07-20 15:14:43 +08:00
|
|
|
|
// 被社保福利档案引用
|
|
|
|
|
|
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("存在社保福利台账引用");
|
|
|
|
|
|
}
|
2022-12-02 16:58:19 +08:00
|
|
|
|
//被社保福利档案引用
|
2022-05-19 14:50:01 +08:00
|
|
|
|
// List<InsuranceArchivesSocialSchemePO> socialSchemePOList = new LambdaQueryChainWrapper<>(siArchivesSocialMapper)
|
|
|
|
|
|
// .eq(InsuranceArchivesSocialSchemePO::getTenantKey)
|
|
|
|
|
|
// .eq(InsuranceArchivesSocialSchemePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
|
|
|
|
|
|
// .in(InsuranceArchivesSocialSchemePO::getPaymentOrganization, ids)
|
|
|
|
|
|
// .list();
|
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(socialSchemePOList)) {
|
|
|
|
|
|
// return Boolean.TRUE;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// List<InsuranceArchivesFundSchemePO> fundSchemePOList = new LambdaQueryChainWrapper<>(siArchivesFundMapper)
|
|
|
|
|
|
// .eq(InsuranceArchivesFundSchemePO::getTenantKey)
|
|
|
|
|
|
// .eq(InsuranceArchivesFundSchemePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
|
|
|
|
|
|
// .in(InsuranceArchivesFundSchemePO::getPaymentOrganization, ids)
|
|
|
|
|
|
// .list();
|
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(fundSchemePOList)) {
|
|
|
|
|
|
// return Boolean.TRUE;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// List<InsuranceArchivesOtherSchemePO> otherSchemePOList = new LambdaQueryChainWrapper<>(siArchivesOtherMapper)
|
|
|
|
|
|
// .eq(InsuranceArchivesOtherSchemePO::getTenantKey)
|
|
|
|
|
|
// .eq(InsuranceArchivesOtherSchemePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
|
|
|
|
|
|
// .in(InsuranceArchivesOtherSchemePO::getPaymentOrganization, ids)
|
|
|
|
|
|
// .list();
|
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(otherSchemePOList)) {
|
|
|
|
|
|
// return Boolean.TRUE;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// 被外部人员引用
|
|
|
|
|
|
// List<ExtEmployeePO> extEmployeeList = extEmployeeService.listAll(tenantKey);
|
|
|
|
|
|
// List<Long> extTaxAgentIds = extEmployeeList.stream().map(ExtEmployeePO::getTaxAgentId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(extTaxAgentIds)) {
|
|
|
|
|
|
// return ids.stream().anyMatch(e -> extTaxAgentIds.stream().anyMatch(f -> f.equals(e)));
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// 被累计专项附加扣除引用
|
2022-12-06 18:08:50 +08:00
|
|
|
|
List<AddUpDeduction> addUpDeductionList = getAddUpDeductionMapper().listSome(AddUpDeduction.builder().taxAgentIds(Collections.singleton(id)).build());
|
2022-05-19 14:50:01 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(addUpDeductionList)) {
|
2022-12-02 16:58:19 +08:00
|
|
|
|
throw new SalaryRunTimeException("存在累计专项附加扣除引用");
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 被其他免税扣除引用
|
2022-12-06 18:08:50 +08:00
|
|
|
|
List<OtherDeductionPO> otherDeductionList = getOtherDeductionMapper().listSome(OtherDeductionPO.builder().taxAgentIds(Collections.singleton(id)).build());
|
2022-05-19 14:50:01 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(otherDeductionList)) {
|
2022-12-02 16:58:19 +08:00
|
|
|
|
throw new SalaryRunTimeException("存在其他免税扣除引用");
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 被往期累计情况引用
|
2022-12-06 18:08:50 +08:00
|
|
|
|
List<AddUpSituation> addUpSituationList = getAddUpSituationMapper().listSome(AddUpSituation.builder().taxAgentIds(Collections.singleton(id)).build());
|
2022-05-19 14:50:01 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(addUpSituationList)) {
|
2022-12-02 16:58:19 +08:00
|
|
|
|
throw new SalaryRunTimeException("存在往期累计情况引用");
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-06-22 19:26:05 +08:00
|
|
|
|
//账套
|
2022-12-02 16:58:19 +08:00
|
|
|
|
List<SalarySobPO> salarySobPOS = getSalarySobMapper().listSome(SalarySobPO.builder().taxAgentId(id).build());
|
2022-06-22 19:26:05 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(salarySobPOS)) {
|
2022-12-02 16:58:19 +08:00
|
|
|
|
throw new SalaryRunTimeException("存在账套引用");
|
2022-06-22 19:26:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-05-19 14:50:01 +08:00
|
|
|
|
return Boolean.FALSE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2023-09-21 09:38:38 +08:00
|
|
|
|
public List<Map<String, Object>> selectList(boolean needAuth) {
|
2022-05-24 09:14:26 +08:00
|
|
|
|
List<TaxAgentPO> taxAgents = getTaxAgentMapper().listAll();
|
2023-09-21 09:38:38 +08:00
|
|
|
|
if (needAuth) {
|
|
|
|
|
|
taxAgents = handleForDevolution(taxAgents, (long) user.getUID(), true);
|
|
|
|
|
|
}
|
2022-07-05 15:31:18 +08:00
|
|
|
|
return taxAgents.stream().map(m -> {
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(2);
|
|
|
|
|
|
map.put("id", String.valueOf(m.getId()));
|
|
|
|
|
|
map.put("content", m.getName());
|
|
|
|
|
|
return map;
|
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public List<Map<String, Object>> selectListAsAdmin(boolean chiefCanSeeAll) {
|
|
|
|
|
|
List<TaxAgentPO> taxAgents = getTaxAgentMapper().listAll();
|
|
|
|
|
|
taxAgents = handleForDevolution(taxAgents, (long) user.getUID(), false);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
return taxAgents.stream().map(m -> {
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(2);
|
|
|
|
|
|
map.put("id", String.valueOf(m.getId()));
|
|
|
|
|
|
map.put("content", m.getName());
|
|
|
|
|
|
return map;
|
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2022-07-05 15:31:18 +08:00
|
|
|
|
* 分权处理(总管理员可见所有)
|
2022-05-19 14:50:01 +08:00
|
|
|
|
*
|
|
|
|
|
|
* @param taxAgents
|
|
|
|
|
|
* @param currentEmployeeId
|
2022-12-02 16:58:19 +08:00
|
|
|
|
* @param chiefCanSeeAll 总管理员是否可见所有
|
2022-05-19 14:50:01 +08:00
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2022-07-05 15:31:18 +08:00
|
|
|
|
private List<TaxAgentPO> handleForDevolution(List<TaxAgentPO> taxAgents, Long currentEmployeeId, boolean chiefCanSeeAll) {
|
2022-05-19 14:50:01 +08:00
|
|
|
|
// 是否开启分权
|
2022-05-24 09:14:26 +08:00
|
|
|
|
boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution();
|
2022-07-05 15:31:18 +08:00
|
|
|
|
if (!isOpenDevolution || (chiefCanSeeAll && isChief(currentEmployeeId))) {
|
2022-05-19 14:50:01 +08:00
|
|
|
|
return taxAgents;
|
|
|
|
|
|
}
|
|
|
|
|
|
List<Long> taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
|
|
|
|
|
List<Long> enableTaxAgentIds = Lists.newArrayList();
|
|
|
|
|
|
// 1.判断自己是否是管理员, 如果是管理员,就是能够查看所属个税扣缴义务人
|
2022-05-24 09:14:26 +08:00
|
|
|
|
List<TaxAgentAdminPO> taxAgentAdminList = getTaxAgentAdminService(user).listByTaxAgentIdsAndEmployeeId(taxAgentIds, currentEmployeeId);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
// 是管理员的列表
|
|
|
|
|
|
List<Long> adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
enableTaxAgentIds.addAll(adminTaxAgentIds);
|
2022-07-05 15:31:18 +08:00
|
|
|
|
|
2022-05-19 14:50:01 +08:00
|
|
|
|
return taxAgents.stream().filter(f -> enableTaxAgentIds.contains(f.getId())).collect(Collectors.toList());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-05 15:31:18 +08:00
|
|
|
|
|
2022-05-19 14:50:01 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Boolean isOpenDevolution() {
|
2022-05-24 09:14:26 +08:00
|
|
|
|
return getTaxAgentBaseService(user).isOpenDevolution();
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public List<TaxAgentManageRangeEmployeeDTO> listTaxAgentAndEmployeeTree(Long employeeId) {
|
|
|
|
|
|
return listTaxAgentAndEmployeeTree(null, employeeId);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-06 16:42:13 +08:00
|
|
|
|
|
2022-05-19 14:50:01 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public List<TaxAgentEmployeeDTO> listTaxAgentAndEmployee(Long employeeId) {
|
|
|
|
|
|
return listTaxAgentAndEmployee(null, employeeId);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-03 16:53:23 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public List<TaxAgentEmployeeDTO> listAllTaxAgentAndEmployee() {
|
|
|
|
|
|
List<TaxAgentEmployeeDTO> taxAgentEmployeeList = Lists.newArrayList();
|
|
|
|
|
|
|
|
|
|
|
|
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeList = listTaxAgentAndEmployeeTree();
|
|
|
|
|
|
taxAgentManageRangeEmployeeList.forEach(m -> {
|
|
|
|
|
|
List<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> employeeList = m.getEmployeeList();
|
|
|
|
|
|
if (CollectionUtils.isEmpty(employeeList)) {
|
|
|
|
|
|
taxAgentEmployeeList.add(TaxAgentEmployeeDTO.builder()
|
|
|
|
|
|
.taxAgentId(m.getTaxAgentId())
|
|
|
|
|
|
.taxAgentName(m.getTaxAgentName())
|
|
|
|
|
|
.employeeId(null)
|
|
|
|
|
|
.username(null)
|
|
|
|
|
|
.build());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
employeeList.forEach(f -> taxAgentEmployeeList.add(TaxAgentEmployeeDTO.builder()
|
|
|
|
|
|
.taxAgentId(m.getTaxAgentId())
|
|
|
|
|
|
.taxAgentName(m.getTaxAgentName())
|
|
|
|
|
|
.employeeId(f.getEmployeeId())
|
|
|
|
|
|
.username(f.getUsername())
|
|
|
|
|
|
.build()));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return taxAgentEmployeeList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-05-19 14:50:01 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public List<TaxAgentManageRangeEmployeeDTO> listTaxAgentAndEmployeeTree(SalaryEmployeeStatusEnum employeeStatus, Long employeeId) {
|
|
|
|
|
|
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeList = Lists.newArrayList();
|
|
|
|
|
|
// 所有个税扣缴义务人
|
|
|
|
|
|
List<TaxAgentPO> allTaxAgents = listAll();
|
|
|
|
|
|
if (CollectionUtils.isEmpty(allTaxAgents)) {
|
|
|
|
|
|
return taxAgentManageRangeEmployeeList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<Long> taxAgentIds = allTaxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
2023-03-15 15:49:20 +08:00
|
|
|
|
List<DataCollectionEmployee> employees = getSalaryEmployeeService(user).listEmployee();
|
2023-03-15 22:48:01 +08:00
|
|
|
|
List<TaxAgentEmployeePO> allEmployees = convert2TaxAgentEmployeePO(employees);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
if (employeeStatus != null) {
|
|
|
|
|
|
List<String> personnelStatusList;
|
|
|
|
|
|
// 查询人员状态
|
2022-10-09 13:32:05 +08:00
|
|
|
|
// if (employeeStatus.equals(SalaryEmployeeStatusEnum.NORMAL)) {
|
|
|
|
|
|
// allEmployees = allEmployees.stream().filter(f -> UserStatusEnum.getNormalStatus().contains(f.getStatus())).collect(Collectors.toList());
|
|
|
|
|
|
// } else if (employeeStatus.equals(SalaryEmployeeStatusEnum.UNAVAILABLE)) {
|
|
|
|
|
|
// allEmployees = allEmployees.stream().filter(f -> UserStatusEnum.getUnavailableStatus().contains(f.getStatus())).collect(Collectors.toList());
|
|
|
|
|
|
// }
|
2022-05-19 14:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 是否开启分权
|
|
|
|
|
|
if (!isOpenDevolution() || isChief(employeeId)) {
|
|
|
|
|
|
return getTaxAgentEmp(allTaxAgents, taxAgentIds, allEmployees);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 1.判断自己是否是管理员, 如果是管理员,就是能够操作所属个税扣缴义务人下的所有人的数据
|
2022-05-24 09:14:26 +08:00
|
|
|
|
List<TaxAgentAdminPO> taxAgentAdminList = getTaxAgentAdminService(user).listByTaxAgentIdsAndEmployeeId(taxAgentIds, (long) user.getUID());
|
2022-05-19 14:50:01 +08:00
|
|
|
|
// 是管理员的列表
|
|
|
|
|
|
List<Long> adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(adminTaxAgentIds)) {
|
|
|
|
|
|
taxAgentManageRangeEmployeeList.addAll(getTaxAgentEmp(allTaxAgents, adminTaxAgentIds, allEmployees));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return taxAgentManageRangeEmployeeList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-06 16:42:13 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public List<TaxAgentManageRangeEmployeeDTO> listTaxAgentAndEmployeeTree() {
|
|
|
|
|
|
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeList = Lists.newArrayList();
|
|
|
|
|
|
// 所有个税扣缴义务人
|
|
|
|
|
|
List<TaxAgentPO> allTaxAgents = listAll();
|
|
|
|
|
|
if (CollectionUtils.isEmpty(allTaxAgents)) {
|
|
|
|
|
|
return taxAgentManageRangeEmployeeList;
|
|
|
|
|
|
}
|
|
|
|
|
|
List<Long> taxAgentIds = allTaxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
2023-03-15 15:49:20 +08:00
|
|
|
|
List<DataCollectionEmployee> employees = getSalaryEmployeeService(user).listEmployee();
|
|
|
|
|
|
List<TaxAgentEmployeePO> allEmployees = convert2TaxAgentEmployeePO(employees);
|
2022-12-05 16:01:08 +08:00
|
|
|
|
taxAgentManageRangeEmployeeList.addAll(getTaxAgentEmp(allTaxAgents, taxAgentIds, allEmployees));
|
2022-07-06 16:42:13 +08:00
|
|
|
|
return taxAgentManageRangeEmployeeList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-05 09:57:27 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public List<TaxAgentManageRangeEmployeeDTO> listAllTaxAgentAndEmployeeTree() {
|
|
|
|
|
|
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeList = Lists.newArrayList();
|
|
|
|
|
|
// 所有个税扣缴义务人
|
|
|
|
|
|
List<TaxAgentPO> allTaxAgents = listAll();
|
|
|
|
|
|
if (CollectionUtils.isEmpty(allTaxAgents)) {
|
|
|
|
|
|
return taxAgentManageRangeEmployeeList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<Long> taxAgentIds = allTaxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
2023-03-15 15:49:20 +08:00
|
|
|
|
List<DataCollectionEmployee> employees = getSalaryEmployeeService(user).listEmployee();
|
|
|
|
|
|
List<TaxAgentEmployeePO> allEmployees = convert2TaxAgentEmployeePO(employees);
|
2022-12-05 09:57:27 +08:00
|
|
|
|
|
|
|
|
|
|
// 1.判断自己是否是管理员, 如果是管理员,就是能够操作所属个税扣缴义务人下的所有人的数据
|
|
|
|
|
|
List<TaxAgentAdminPO> taxAgentAdminList = getTaxAgentAdminService(user).listByTaxAgentIdsAndEmployeeId(taxAgentIds, (long) user.getUID());
|
|
|
|
|
|
// 是管理员的列表
|
|
|
|
|
|
List<Long> adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList());
|
|
|
|
|
|
taxAgentManageRangeEmployeeList.addAll(getTaxAgentEmp(allTaxAgents, adminTaxAgentIds, allEmployees));
|
2022-12-05 10:34:25 +08:00
|
|
|
|
taxAgentManageRangeEmployeeList = taxAgentManageRangeEmployeeList.stream().distinct().collect(Collectors.toList());
|
2022-12-05 09:57:27 +08:00
|
|
|
|
return taxAgentManageRangeEmployeeList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-06 16:42:13 +08:00
|
|
|
|
|
2022-05-19 14:50:01 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 获取分管理员的关联人员
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param allTaxAgents
|
|
|
|
|
|
* @param noAdminTaxAgentIds
|
|
|
|
|
|
* @param allEmployees
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
private List<TaxAgentManageRangeEmployeeDTO> getTaxAgentSubAdminEmp(List<TaxAgentPO> allTaxAgents, List<Long> noAdminTaxAgentIds, List<TaxAgentEmployeePO> allEmployees) {
|
|
|
|
|
|
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeList = Lists.newArrayList();
|
|
|
|
|
|
List<TaxAgentSubAdminEmpPO> taxAgentEmps = taxAgentSubAdminEmpService.listByTaxAgentIds(noAdminTaxAgentIds);
|
|
|
|
|
|
|
|
|
|
|
|
taxAgentEmps = taxAgentEmps.stream().filter(f -> allEmployees.stream().anyMatch(e -> e.getEmployeeId().equals(f.getEmployeeId()))).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
List<TaxAgentSubAdminEmpPO> finalTaxAgentEmps = taxAgentEmps;
|
|
|
|
|
|
noAdminTaxAgentIds.forEach(e -> {
|
|
|
|
|
|
Optional<TaxAgentPO> optionalTaxAgent = allTaxAgents.stream().filter(t -> t.getId().equals(e)).findFirst();
|
|
|
|
|
|
String taxAgentName = (optionalTaxAgent.isPresent() ? optionalTaxAgent.get().getName() : "");
|
|
|
|
|
|
List<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> taxAgentEmployees = finalTaxAgentEmps.stream().filter(f -> f.getTaxAgentId().equals(e)).map(m -> {
|
|
|
|
|
|
TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee taxAgentEmployee = new TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee();
|
|
|
|
|
|
taxAgentEmployee.setEmployeeId(m.getEmployeeId());
|
|
|
|
|
|
taxAgentEmployee.setUsername(m.getEmployeeName());
|
|
|
|
|
|
return taxAgentEmployee;
|
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
taxAgentManageRangeEmployeeList.add(
|
|
|
|
|
|
TaxAgentManageRangeEmployeeDTO.builder()
|
|
|
|
|
|
.taxAgentId(e)
|
|
|
|
|
|
.taxAgentName(taxAgentName)
|
|
|
|
|
|
.employeeList(taxAgentEmployees)
|
|
|
|
|
|
.build()
|
|
|
|
|
|
);
|
|
|
|
|
|
});
|
|
|
|
|
|
return taxAgentManageRangeEmployeeList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取个税口角义务人的关联人员
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param allTaxAgents
|
|
|
|
|
|
* @param taxAgentIds
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
private List<TaxAgentManageRangeEmployeeDTO> getTaxAgentEmp(List<TaxAgentPO> allTaxAgents, List<Long> taxAgentIds, List<TaxAgentEmployeePO> allEmployees) {
|
|
|
|
|
|
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeList = Lists.newArrayList();
|
2023-03-16 16:10:29 +08:00
|
|
|
|
List<TaxAgentEmpPO> taxAgentEmps = getTaxAgentEmpService(user).listByTaxAgentIds(taxAgentIds, UseEmployeeTypeEnum.ALL);
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
|
|
|
|
|
taxAgentEmps = taxAgentEmps.stream().filter(f -> allEmployees.stream().anyMatch(e -> e.getEmployeeId().equals(f.getEmployeeId()))).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
List<TaxAgentEmpPO> finalTaxAgentEmps = taxAgentEmps;
|
|
|
|
|
|
taxAgentIds.forEach(e -> {
|
|
|
|
|
|
Optional<TaxAgentPO> optionalTaxAgent = allTaxAgents.stream().filter(t -> t.getId().equals(e)).findFirst();
|
|
|
|
|
|
String taxAgentName = (optionalTaxAgent.isPresent() ? optionalTaxAgent.get().getName() : "");
|
|
|
|
|
|
List<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> taxAgentEmployees = finalTaxAgentEmps.stream().filter(f -> f.getTaxAgentId().equals(e)).map(m -> {
|
|
|
|
|
|
TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee taxAgentEmployee = new TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee();
|
|
|
|
|
|
taxAgentEmployee.setEmployeeId(m.getEmployeeId());
|
|
|
|
|
|
taxAgentEmployee.setUsername(m.getEmployeeName());
|
|
|
|
|
|
return taxAgentEmployee;
|
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
taxAgentManageRangeEmployeeList.add(
|
|
|
|
|
|
TaxAgentManageRangeEmployeeDTO.builder()
|
|
|
|
|
|
.taxAgentId(e)
|
|
|
|
|
|
.taxAgentName(taxAgentName)
|
|
|
|
|
|
.employeeList(taxAgentEmployees)
|
|
|
|
|
|
.build()
|
|
|
|
|
|
);
|
|
|
|
|
|
});
|
|
|
|
|
|
return taxAgentManageRangeEmployeeList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public List<TaxAgentEmployeeDTO> listTaxAgentAndEmployee(SalaryEmployeeStatusEnum employeeStatus, Long employeeId) {
|
|
|
|
|
|
List<TaxAgentEmployeeDTO> taxAgentEmployeeList = Lists.newArrayList();
|
2022-12-02 16:58:19 +08:00
|
|
|
|
|
2022-05-19 14:50:01 +08:00
|
|
|
|
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeList = listTaxAgentAndEmployeeTree(employeeStatus, employeeId);
|
|
|
|
|
|
taxAgentManageRangeEmployeeList.forEach(m -> {
|
|
|
|
|
|
List<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> employeeList = m.getEmployeeList();
|
|
|
|
|
|
if (CollectionUtils.isEmpty(employeeList)) {
|
|
|
|
|
|
taxAgentEmployeeList.add(TaxAgentEmployeeDTO.builder()
|
|
|
|
|
|
.taxAgentId(m.getTaxAgentId())
|
|
|
|
|
|
.taxAgentName(m.getTaxAgentName())
|
|
|
|
|
|
.employeeId(null)
|
|
|
|
|
|
.username(null)
|
|
|
|
|
|
.build());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
employeeList.forEach(f -> taxAgentEmployeeList.add(TaxAgentEmployeeDTO.builder()
|
|
|
|
|
|
.taxAgentId(m.getTaxAgentId())
|
|
|
|
|
|
.taxAgentName(m.getTaxAgentName())
|
|
|
|
|
|
.employeeId(f.getEmployeeId())
|
|
|
|
|
|
.username(f.getUsername())
|
|
|
|
|
|
.build()));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return taxAgentEmployeeList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-03 16:53:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
2022-06-29 17:38:00 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Collection<Long> listEmployeeIdsInTaxAgent(Long taxAgentId) {
|
2023-07-12 09:45:00 +08:00
|
|
|
|
List<TaxAgentEmpPO> taxAgentEmpPOS = getTaxAgentEmpService(user).listByTaxAgentIds(Collections.singletonList(taxAgentId),UseEmployeeTypeEnum.ALL);
|
2022-06-29 17:38:00 +08:00
|
|
|
|
|
2022-07-05 15:31:18 +08:00
|
|
|
|
return SalaryEntityUtil.properties(taxAgentEmpPOS, TaxAgentEmpPO::getEmployeeId);
|
2022-06-29 17:38:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-05-19 14:50:01 +08:00
|
|
|
|
|
|
|
|
|
|
}
|