754 lines
38 KiB
Java
754 lines
38 KiB
Java
|
|
package com.engine.salary.wrapper;
|
|||
|
|
|
|||
|
|
import com.engine.core.impl.Service;
|
|||
|
|
import com.engine.salary.service.SalaryCacheService;
|
|||
|
|
import com.engine.salary.service.TaxAgentService;
|
|||
|
|
import com.engine.salary.service.TaxDeclarationExcelService;
|
|||
|
|
import com.engine.salary.service.TaxDeclarationService;
|
|||
|
|
import com.weaver.common.component.form.WeaForm;
|
|||
|
|
import com.weaver.common.component.table.WeaTable;
|
|||
|
|
import com.weaver.common.component.table.page.Page;
|
|||
|
|
import com.weaver.common.component.table.permission.Permission;
|
|||
|
|
import com.weaver.common.distribution.genid.IdGenerator;
|
|||
|
|
import com.weaver.common.hr.util.Util;
|
|||
|
|
import com.weaver.common.hrm.service.HrmCommonEmployeeService;
|
|||
|
|
import com.weaver.common.threadPool.ThreadPoolUtil;
|
|||
|
|
import com.weaver.common.threadPool.constant.ModulePoolEnum;
|
|||
|
|
import com.weaver.common.threadPool.entity.LocalRunnable;
|
|||
|
|
import com.weaver.datasecurity.interceptor.DSTenantKeyThreadVar;
|
|||
|
|
import com.weaver.framework.util.JsonUtil;
|
|||
|
|
import com.weaver.hrm.salary.cache.SalaryCacheKey;
|
|||
|
|
import com.weaver.hrm.salary.common.excel.ExcelExportParam;
|
|||
|
|
import com.weaver.hrm.salary.constant.SalaryConstant;
|
|||
|
|
import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentPO;
|
|||
|
|
import com.weaver.hrm.salary.entity.taxdeclaration.dto.*;
|
|||
|
|
import com.weaver.hrm.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
|
|||
|
|
import com.weaver.hrm.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam;
|
|||
|
|
import com.weaver.hrm.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
|
|||
|
|
import com.weaver.hrm.salary.entity.taxdeclaration.param.TaxDeclarationValueListQueryParam;
|
|||
|
|
import com.weaver.hrm.salary.entity.taxdeclaration.po.*;
|
|||
|
|
import com.weaver.hrm.salary.enums.salarysob.IncomeCategoryEnum;
|
|||
|
|
import com.weaver.hrm.salary.enums.taxdeclaration.TaxAgentRangeEnum;
|
|||
|
|
import com.weaver.hrm.salary.enums.taxdeclaration.TaxDeclareStatusEnum;
|
|||
|
|
import com.weaver.hrm.salary.enums.taxdeclaration.TaxDeclareTypeEnum;
|
|||
|
|
import com.weaver.hrm.salary.exception.SalaryNullException;
|
|||
|
|
import com.weaver.hrm.salary.exception.SalaryRunTimeException;
|
|||
|
|
import com.weaver.hrm.salary.service.*;
|
|||
|
|
import com.weaver.hrm.salary.util.*;
|
|||
|
|
import com.weaver.teams.domain.EntityType;
|
|||
|
|
import com.weaver.teams.domain.user.SimpleEmployee;
|
|||
|
|
import lombok.extern.slf4j.Slf4j;
|
|||
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|||
|
|
import org.apache.commons.compress.utils.Lists;
|
|||
|
|
import org.apache.commons.lang3.StringUtils;
|
|||
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|||
|
|
import org.springframework.stereotype.Component;
|
|||
|
|
|
|||
|
|
import java.time.YearMonth;
|
|||
|
|
import java.util.*;
|
|||
|
|
import java.util.stream.Collectors;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @description: 个税申报
|
|||
|
|
* @author: xiajun
|
|||
|
|
* @modified By: xiajun
|
|||
|
|
* @date: Created in 2022/11/10 9:24 AM
|
|||
|
|
* @version:v1.0
|
|||
|
|
*/
|
|||
|
|
@Slf4j
|
|||
|
|
@Component
|
|||
|
|
public class TaxDeclareRecordWrapper extends Service {
|
|||
|
|
|
|||
|
|
|
|||
|
|
private TaxDeclareRecordService taxDeclareRecordService;
|
|||
|
|
|
|||
|
|
private TaxAgentService taxAgentService;
|
|||
|
|
|
|||
|
|
private HrmCommonEmployeeService hrmCommonEmployeeService;
|
|||
|
|
|
|||
|
|
private SalaryCacheService salaryCacheService;
|
|||
|
|
|
|||
|
|
private TaxDeclarationService taxDeclarationService;
|
|||
|
|
|
|||
|
|
private TaxDeclarationValueService taxDeclarationValueService;
|
|||
|
|
|
|||
|
|
private TaxDeclarationExcelService taxDeclarationExcelService;
|
|||
|
|
|
|||
|
|
private TaxDeclareEmployeeService taxDeclareEmployeeService;
|
|||
|
|
|
|||
|
|
private TaxDeclareFailService taxDeclareFailService;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 个税申报记录列表
|
|||
|
|
*
|
|||
|
|
* @param queryParam
|
|||
|
|
* @param employeeId
|
|||
|
|
* @param tenantKey
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public WeaTable<TaxDeclareRecordListDTO> listPage(TaxDeclarationListQueryParam queryParam, Long employeeId, String tenantKey) {
|
|||
|
|
Page<TaxDeclareRecordPO> page = taxDeclareRecordService.listPageByParam(queryParam, employeeId, tenantKey);
|
|||
|
|
Page<TaxDeclareRecordListDTO> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount());
|
|||
|
|
if (CollectionUtils.isNotEmpty(page.getRecords())) {
|
|||
|
|
// 查询个税扣缴义务人
|
|||
|
|
Set<Long> taxAgentIds = SalaryEntityUtil.properties(page.getRecords(), TaxDeclareRecordPO::getTaxAgentId);
|
|||
|
|
List<TaxAgentPO> taxAgents = taxAgentService.listByIds(taxAgentIds, tenantKey);
|
|||
|
|
// 查询人员姓名
|
|||
|
|
List<Long> employeeIds = SalaryEntityUtil.properties(page.getRecords(), TaxDeclareRecordPO::getCreator, Collectors.toList());
|
|||
|
|
List<SimpleEmployee> simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(employeeIds, tenantKey);
|
|||
|
|
|
|||
|
|
List<TaxDeclareRecordListDTO> dtoList = Lists.newArrayList();
|
|||
|
|
Map<Long, String> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName);
|
|||
|
|
Map<Long, String> simpleEmployeeNameMap = SalaryEntityUtil.convert2Map(simpleEmployees, SimpleEmployee::getEmployeeId, SimpleEmployee::getName);
|
|||
|
|
for (TaxDeclareRecordPO taxDeclareRecord : page.getRecords()) {
|
|||
|
|
TaxDeclareTypeEnum taxDeclareTypeEnum = SalaryEnumUtil.enumMatchByValue(taxDeclareRecord.getTaxDeclareType(), TaxDeclareTypeEnum.class);
|
|||
|
|
TaxDeclareStatusEnum taxDeclareStatusEnum = SalaryEnumUtil.enumMatchByValue(taxDeclareRecord.getTaxDeclareStatus(), TaxDeclareStatusEnum.class);
|
|||
|
|
TaxDeclareRecordListDTO taxDeclareRecordListDTO = new TaxDeclareRecordListDTO()
|
|||
|
|
.setId(taxDeclareRecord.getId())
|
|||
|
|
.setTaxAgentId(taxDeclareRecord.getTaxAgentId())
|
|||
|
|
.setTaxAgentName(taxAgentNameMap.get(taxDeclareRecord.getTaxAgentId()))
|
|||
|
|
.setSalaryMonth(taxDeclareRecord.getSalaryMonth())
|
|||
|
|
.setTaxCycle(taxDeclareRecord.getTaxCycle())
|
|||
|
|
.setTaxDeclareType(taxDeclareTypeEnum)
|
|||
|
|
.setTaxDeclareTypeDesc(taxDeclareTypeEnum == null ? "" : SalaryI18nUtil.getI18nLabel(taxDeclareTypeEnum.getLabelId(), taxDeclareTypeEnum.getDefaultLabel()))
|
|||
|
|
.setTaxDeclareStatus(taxDeclareStatusEnum)
|
|||
|
|
.setTaxDeclareStatusDesc(taxDeclareStatusEnum == null ? "" : SalaryI18nUtil.getI18nLabel(taxDeclareStatusEnum.getLabelId(), taxDeclareStatusEnum.getDefaultLabel()))
|
|||
|
|
.setTaxPaidAmount(SalaryEntityUtil.thousandthConvert(taxDeclareRecord.getTaxPaidAmount()))
|
|||
|
|
.setOperateEmployeeId(taxDeclareRecord.getCreator())
|
|||
|
|
.setOperateEmployeeName(simpleEmployeeNameMap.get(taxDeclareRecord.getCreator()))
|
|||
|
|
.setOperateTime(SalaryDateUtil.getFormatLocalDateTime(taxDeclareRecord.getCreateTime()))
|
|||
|
|
.setDescription(taxDeclareRecord.getRemark())
|
|||
|
|
.setDisplayIcon(Objects.equals(taxDeclareRecord.getDisplayUpdateIcon(), 1));
|
|||
|
|
dtoList.add(taxDeclareRecordListDTO);
|
|||
|
|
}
|
|||
|
|
dtoPage.setRecords(dtoList);
|
|||
|
|
}
|
|||
|
|
// 转换成前端所需的数据格式
|
|||
|
|
WeaTable<TaxDeclareRecordListDTO> weaTable = SalaryFormatUtil.<TaxDeclareRecordListDTO>getInstance()
|
|||
|
|
.buildTable(TaxDeclareRecordListDTO.class, dtoPage);
|
|||
|
|
for (int i = 0; i < dtoPage.getRecords().size(); i++) {
|
|||
|
|
TaxDeclareRecordListDTO dto = dtoPage.getRecords().get(i);
|
|||
|
|
List<Permission> permissions = weaTable.getOperatesPermission().get(i);
|
|||
|
|
for (int j = 0; j < permissions.size(); j++) {
|
|||
|
|
Permission permission = permissions.get(j);
|
|||
|
|
if (j == 1 && (dto.getTaxDeclareStatus() != TaxDeclareStatusEnum.NOT_DECLARE || dto.getTaxDeclareType() != TaxDeclareTypeEnum.NORMAL_DECLARE)) {
|
|||
|
|
permission.setVisible(false);
|
|||
|
|
permission.setDisabled(false);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return weaTable;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 个税申报表明细列表
|
|||
|
|
*
|
|||
|
|
* @param queryParam 列表查询条件
|
|||
|
|
* @param tenantKey 租户key
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public WeaTable<?> listValuePage(TaxDeclarationValueListQueryParam queryParam, Long employeeId, String tenantKey) {
|
|||
|
|
// 查询个税申报表
|
|||
|
|
TaxDeclarationPO taxDeclaration = taxDeclarationService.getById(queryParam.getTaxDeclarationId(), tenantKey);
|
|||
|
|
// 判断是否有权限查看
|
|||
|
|
boolean canSee = taxDeclareRecordService.checkByAuthority(taxDeclaration, employeeId, tenantKey);
|
|||
|
|
if (!canSee) {
|
|||
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156515, "对不起,您暂时没有权限查看"));
|
|||
|
|
}
|
|||
|
|
String pageUid = "taxDeclarationValueList";
|
|||
|
|
SalaryPageUtil.handlePageSize(pageUid, queryParam);
|
|||
|
|
// 查询个税申报表详情
|
|||
|
|
Page<TaxDeclarationValuePO> page = taxDeclarationValueService.listPageByTaxDeclarationIds(
|
|||
|
|
new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true), Collections.singleton(queryParam.getTaxDeclarationId()), tenantKey);
|
|||
|
|
TaxDeclarationValueListDTO taxDeclarationValueListDTO = taxDeclarationValueService.convert2List(taxDeclaration, page.getRecords(), tenantKey);
|
|||
|
|
Page<Map<String, Object>> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount());
|
|||
|
|
dtoPage.setRecords(taxDeclarationValueListDTO.getData());
|
|||
|
|
// 转成前端所需的格式
|
|||
|
|
WeaTable<Map<String, Object>> weaTable = new WeaTable<>();
|
|||
|
|
weaTable.setColumns(taxDeclarationValueListDTO.getColumns());
|
|||
|
|
weaTable.setPage(dtoPage);
|
|||
|
|
weaTable.setModule(SalaryConstant.MODULE);
|
|||
|
|
weaTable.setPageUid(pageUid);
|
|||
|
|
return weaTable;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 未报送的人员列表
|
|||
|
|
*
|
|||
|
|
* @param queryParam
|
|||
|
|
* @param tenantKey
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public WeaTable<AbnormalEmployeeListDTO> listEmployeePage4NotDeclare(AbnormalEmployeeListQueryParam queryParam, String tenantKey) {
|
|||
|
|
String pageUid = "abnormalEmployeeList4NoDeclare";
|
|||
|
|
SalaryPageUtil.handlePageSize(pageUid, queryParam);
|
|||
|
|
WeaTable<AbnormalEmployeeListDTO> weaTable = listEmployeePage("NotDeclare", queryParam, tenantKey);
|
|||
|
|
weaTable.setPageUid(pageUid);
|
|||
|
|
return weaTable;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 没有申报数据的人员列表
|
|||
|
|
*
|
|||
|
|
* @param queryParam
|
|||
|
|
* @param tenantKey
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public WeaTable<AbnormalEmployeeListDTO> listEmployeePage4NoValue(AbnormalEmployeeListQueryParam queryParam, String tenantKey) {
|
|||
|
|
String pageUid = "abnormalEmployeeList4NoValue";
|
|||
|
|
SalaryPageUtil.handlePageSize(pageUid, queryParam);
|
|||
|
|
WeaTable<AbnormalEmployeeListDTO> weaTable = listEmployeePage("NoValue", queryParam, tenantKey);
|
|||
|
|
weaTable.setPageUid(pageUid);
|
|||
|
|
return weaTable;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 申报失败的人员列表
|
|||
|
|
*
|
|||
|
|
* @param queryParam
|
|||
|
|
* @param tenantKey
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public WeaTable<FailEmployeeListDTO> listEmployeePage4Fail(AbnormalEmployeeListQueryParam queryParam, String tenantKey) {
|
|||
|
|
String pageUid = "failEmployeeList";
|
|||
|
|
SalaryPageUtil.handlePageSize(pageUid, queryParam);
|
|||
|
|
// 查询个税申报记录
|
|||
|
|
TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(queryParam.getTaxDeclareRecordId(), tenantKey);
|
|||
|
|
// 查询申报失败的数据
|
|||
|
|
Page<TaxDeclareFailPO> page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true);
|
|||
|
|
page = taxDeclareFailService.listPageByTaxDeclareRecordIds(page, Collections.singleton(taxDeclareRecord.getId()), tenantKey);
|
|||
|
|
// 转换成dto
|
|||
|
|
Page<FailEmployeeListDTO> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount());
|
|||
|
|
dtoPage.setRecords(taxDeclareFailService.convert2FailEmployeeList(taxDeclareRecord, page.getRecords(), tenantKey));
|
|||
|
|
// 转成前端所需的格式
|
|||
|
|
return SalaryFormatUtil.<FailEmployeeListDTO>getInstance().buildTable(FailEmployeeListDTO.class, dtoPage);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private WeaTable<AbnormalEmployeeListDTO> listEmployeePage(String key, AbnormalEmployeeListQueryParam queryParam, String tenantKey) {
|
|||
|
|
WeaTable<AbnormalEmployeeListDTO> weaTable;
|
|||
|
|
// 查询个税申报记录
|
|||
|
|
TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(queryParam.getTaxDeclareRecordId(), tenantKey);
|
|||
|
|
queryParam.setTaxAgentId(taxDeclareRecord.getTaxAgentId());
|
|||
|
|
queryParam.setTaxCycle(taxDeclareRecord.getTaxCycle());
|
|||
|
|
if (StringUtils.isEmpty(queryParam.getKeyword())) {
|
|||
|
|
// 查询个税申报记录的人员
|
|||
|
|
Page<TaxDeclareEmployeePO> page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true);
|
|||
|
|
if (StringUtils.equals("NotDeclare", key)) {
|
|||
|
|
page = taxDeclareEmployeeService.listPage4NotDeclareByParam(queryParam, tenantKey);
|
|||
|
|
} else if (StringUtils.equals("NoValue", key)) {
|
|||
|
|
page = taxDeclareEmployeeService.listPage4NoValueByParam(queryParam, tenantKey);
|
|||
|
|
}
|
|||
|
|
Page<AbnormalEmployeeListDTO> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount());
|
|||
|
|
dtoPage.setRecords(taxDeclareEmployeeService.convert2AbnormalEmployeeList(taxDeclareRecord, page.getRecords(), tenantKey));
|
|||
|
|
// 转换成前端所需的格式
|
|||
|
|
weaTable = SalaryFormatUtil.<AbnormalEmployeeListDTO>getInstance().buildTable(AbnormalEmployeeListDTO.class, dtoPage);
|
|||
|
|
} else {
|
|||
|
|
// 查询条件中包含"keyword"时,不好通过SQL分页,所以在内存中分页
|
|||
|
|
List<TaxDeclareEmployeePO> taxDeclareEmployees = Collections.emptyList();
|
|||
|
|
if (StringUtils.equals("NotDeclare", key)) {
|
|||
|
|
taxDeclareEmployees = taxDeclareEmployeeService.list4NotDeclareByParam(queryParam, tenantKey);
|
|||
|
|
} else if (StringUtils.equals("NoValue", key)) {
|
|||
|
|
taxDeclareEmployees = taxDeclareEmployeeService.list4NoValueByParam(queryParam, tenantKey);
|
|||
|
|
}
|
|||
|
|
List<AbnormalEmployeeListDTO> dtos = taxDeclareEmployeeService.convert2AbnormalEmployeeList(taxDeclareRecord, taxDeclareEmployees, tenantKey)
|
|||
|
|
.stream()
|
|||
|
|
.filter(e -> StringUtils.contains(e.getEmployeeName(), queryParam.getKeyword())
|
|||
|
|
|| StringUtils.contains(e.getJobNum(), queryParam.getKeyword())
|
|||
|
|
|| StringUtils.contains(e.getCardNum(), queryParam.getKeyword()))
|
|||
|
|
.collect(Collectors.toList());
|
|||
|
|
Page<AbnormalEmployeeListDTO> dtoPage = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), dtos.size(), true);
|
|||
|
|
dtoPage.setRecords(SalaryPageUtil.subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), dtos));
|
|||
|
|
// 转换成前端所需的格式
|
|||
|
|
weaTable = SalaryFormatUtil.<AbnormalEmployeeListDTO>getInstance().buildTable(AbnormalEmployeeListDTO.class, dtoPage);
|
|||
|
|
}
|
|||
|
|
return weaTable;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 获取个税申报记录的表单
|
|||
|
|
*
|
|||
|
|
* @param id
|
|||
|
|
* @param tenantKey
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public WeaForm getForm(Long id, Long employeeId, String tenantKey) {
|
|||
|
|
TaxDeclareRecordFormDTO formDTO = new TaxDeclareRecordFormDTO();
|
|||
|
|
formDTO.setTaxAgentRange(TaxAgentRangeEnum.SELECT_TAX_AGENT);
|
|||
|
|
// 判断当前是否开启了分权
|
|||
|
|
Boolean openDevolution = taxAgentService.isOpenDevolution(tenantKey);
|
|||
|
|
Boolean isChief = taxAgentService.isChief(employeeId, tenantKey);
|
|||
|
|
// 转换成前端所需的数据格式
|
|||
|
|
WeaForm weaForm = SalaryFormatUtil.<TaxDeclareRecordFormDTO>getInstance().buildForm(TaxDeclareRecordFormDTO.class, formDTO);
|
|||
|
|
weaForm.getItems().forEach((k, v) -> {
|
|||
|
|
if (StringUtils.equals("salaryMonth", k)) {
|
|||
|
|
Map<String, Object> otherParams = new HashMap<>();
|
|||
|
|
otherParams.put("type", "month");
|
|||
|
|
v.setOtherParams(otherParams);
|
|||
|
|
}
|
|||
|
|
// 未开启分权,没有"作为管理员的个税扣缴义务人"
|
|||
|
|
if (!openDevolution && StringUtils.equals("taxAgentRange", k)) {
|
|||
|
|
v.getOptions().remove(1);
|
|||
|
|
}
|
|||
|
|
// 开启分权,但不是总管理员,没有"所有个税扣缴义务人"
|
|||
|
|
if (openDevolution && !isChief && StringUtils.equals("taxAgentRange", k)) {
|
|||
|
|
v.getOptions().remove(0);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
return weaForm;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 获取个税申报记录下的个税申报表TAB
|
|||
|
|
*
|
|||
|
|
* @param id
|
|||
|
|
* @param tenantKey
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public List<TaxDeclarationTabDTO> getTaxDeclarationTab(Long id, Long employeeId, String tenantKey) {
|
|||
|
|
// 查询个税申报记录
|
|||
|
|
TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(id, tenantKey);
|
|||
|
|
// 查询个税申报记录下的个税申报表
|
|||
|
|
List<TaxDeclarationPO> taxDeclarations = taxDeclarationService.listByTaxCycleAndTaxAgentIds(YearMonth.parse(taxDeclareRecord.getTaxCycle()),
|
|||
|
|
Collections.singleton(taxDeclareRecord.getTaxAgentId()), tenantKey);
|
|||
|
|
taxDeclarations = taxDeclarations.stream()
|
|||
|
|
.filter(e -> Objects.equals(e.getControlView(), 0) || Objects.equals(e.getCreator(), employeeId))
|
|||
|
|
.collect(Collectors.toList());
|
|||
|
|
Map<Integer, TaxDeclarationPO> taxDeclarationMap = SalaryEntityUtil.convert2Map(taxDeclarations, TaxDeclarationPO::getIncomeCategory);
|
|||
|
|
List<TaxDeclarationTabDTO> tabs = Lists.newArrayList();
|
|||
|
|
for (IncomeCategoryEnum incomeCategoryEnum : IncomeCategoryEnum.values()) {
|
|||
|
|
TaxDeclarationPO taxDeclaration = taxDeclarationMap.get(incomeCategoryEnum.getValue());
|
|||
|
|
if (taxDeclaration != null) {
|
|||
|
|
TaxDeclarationTabDTO taxDeclarationTabDTO = new TaxDeclarationTabDTO()
|
|||
|
|
.setTabName(SalaryI18nUtil.getI18nLabel(incomeCategoryEnum.getLabelId(), incomeCategoryEnum.getDefaultLabel()))
|
|||
|
|
.setIncomeCategory(incomeCategoryEnum)
|
|||
|
|
.setTaxDeclarationId(taxDeclaration.getId());
|
|||
|
|
tabs.add(taxDeclarationTabDTO);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return tabs;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 查询个税申报表的基本信息
|
|||
|
|
*
|
|||
|
|
* @param id 个税申报表id
|
|||
|
|
* @param tenantKey 租户key
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public TaxDeclarationInfoDTO getTaxDeclarationInfoById(Long id, String tenantKey) {
|
|||
|
|
// 查询个税申报表
|
|||
|
|
TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(id, tenantKey);
|
|||
|
|
if (Objects.isNull(taxDeclareRecord)) {
|
|||
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98877, "个税申报表不存在或已删除"));
|
|||
|
|
}
|
|||
|
|
AbnormalEmployeeListQueryParam queryParam = new AbnormalEmployeeListQueryParam()
|
|||
|
|
.setTaxDeclareRecordId(taxDeclareRecord.getId())
|
|||
|
|
.setTaxAgentId(taxDeclareRecord.getTaxAgentId())
|
|||
|
|
.setTaxCycle(taxDeclareRecord.getTaxCycle());
|
|||
|
|
// 查询是否存在有未报送的人
|
|||
|
|
List<TaxDeclareEmployeePO> notDeclareTaxDeclareEmployees = taxDeclareEmployeeService.list4NotDeclareByParam(queryParam, tenantKey);
|
|||
|
|
// 查询是否存在没有申报数据的人
|
|||
|
|
List<TaxDeclareEmployeePO> noValueTaxDeclareEmployees = taxDeclareEmployeeService.list4NoValueByParam(queryParam, tenantKey);
|
|||
|
|
// 查询是否存在申报失败的人
|
|||
|
|
List<TaxDeclareFailPO> taxDeclareFails = taxDeclareFailService.listByTaxDeclareRecordIds(Collections.singleton(taxDeclareRecord.getId()), tenantKey);
|
|||
|
|
// 查询个税扣缴义务人
|
|||
|
|
TaxAgentPO taxAgentPO = taxAgentService.getById(taxDeclareRecord.getTaxAgentId(), tenantKey);
|
|||
|
|
TaxDeclareTypeEnum taxDeclareTypeEnum = SalaryEnumUtil.enumMatchByValue(taxDeclareRecord.getTaxDeclareType(), TaxDeclareTypeEnum.class);
|
|||
|
|
TaxDeclareStatusEnum taxDeclareStatusEnum = SalaryEnumUtil.enumMatchByValue(taxDeclareRecord.getTaxDeclareStatus(), TaxDeclareStatusEnum.class);
|
|||
|
|
return new TaxDeclarationInfoDTO()
|
|||
|
|
.setSalaryMonth(taxDeclareRecord.getSalaryMonth())
|
|||
|
|
.setTaxCycle(taxDeclareRecord.getTaxCycle())
|
|||
|
|
.setTaxAgentId(taxDeclareRecord.getTaxAgentId())
|
|||
|
|
.setTaxAgentName(Optional.ofNullable(taxAgentPO).map(TaxAgentPO::getName).orElse(""))
|
|||
|
|
.setDeclareType(taxDeclareTypeEnum)
|
|||
|
|
.setDeclareTypeDesc(taxDeclareTypeEnum == null ? "" : SalaryI18nUtil.getI18nLabel(taxDeclareTypeEnum.getLabelId(), taxDeclareTypeEnum.getDefaultLabel()))
|
|||
|
|
.setDeclareStatus(taxDeclareStatusEnum)
|
|||
|
|
.setDeclareStatusDesc(taxDeclareStatusEnum == null ? "" : SalaryI18nUtil.getI18nLabel(taxDeclareStatusEnum.getLabelId(), taxDeclareStatusEnum.getDefaultLabel()))
|
|||
|
|
.setDeclareErrorMsg(taxDeclareRecord.getTaxDeclareErrorMsg())
|
|||
|
|
.setDisplayIcon(Objects.equals(taxDeclareRecord.getDisplayUpdateIcon(), 1))
|
|||
|
|
.setDeclareFailSize(taxDeclareFails.size())
|
|||
|
|
.setAbnormalSize(notDeclareTaxDeclareEmployees.size() + noValueTaxDeclareEmployees.size())
|
|||
|
|
.setTaxPaidAmount(SalaryEntityUtil.thousandthConvert(taxDeclareRecord.getTaxPaidAmount()));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 保存
|
|||
|
|
*
|
|||
|
|
* @param saveParam 保存参数
|
|||
|
|
* @param employeeId 人员id
|
|||
|
|
* @param tenantKey 租户key
|
|||
|
|
*/
|
|||
|
|
public String save(TaxDeclarationSaveParam saveParam, Long employeeId, String tenantKey) {
|
|||
|
|
TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true)
|
|||
|
|
.setIndex(Util.null2String(IdGenerator.generate()))
|
|||
|
|
.setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 95836, "生成申报表"));
|
|||
|
|
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
|
|||
|
|
LocalRunnable localRunnable = new LocalRunnable() {
|
|||
|
|
@Override
|
|||
|
|
public void execute() {
|
|||
|
|
try {
|
|||
|
|
DSTenantKeyThreadVar.tenantKey.set(tenantKey);
|
|||
|
|
taxDeclareRecordService.save(saveParam, employeeId, tenantKey);
|
|||
|
|
taxDeclarationRate.setStatus(true).setFinish(true);
|
|||
|
|
} catch (SalaryRunTimeException e) {
|
|||
|
|
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage());
|
|||
|
|
} catch (Exception e) {
|
|||
|
|
log.error("个税申报表生成报错:{}", e.getMessage(), e);
|
|||
|
|
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 187276, "个税申报表生成报错:") + e.getMessage());
|
|||
|
|
} finally {
|
|||
|
|
DSTenantKeyThreadVar.tenantKey.remove();
|
|||
|
|
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "saveTaxDeclaration", localRunnable);
|
|||
|
|
return taxDeclarationRate.getIndex();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 更新个税申报表的待刷新数据的标识
|
|||
|
|
*
|
|||
|
|
* @param id
|
|||
|
|
* @param employeeId
|
|||
|
|
* @param tenantKey
|
|||
|
|
*/
|
|||
|
|
public void updateIcon(Long id, Long employeeId, String tenantKey) {
|
|||
|
|
taxDeclareRecordService.updateIcon(id, NumberUtils.INTEGER_ZERO, employeeId, tenantKey);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 删除个税申报表
|
|||
|
|
*
|
|||
|
|
* @param ids
|
|||
|
|
* @param employeeId
|
|||
|
|
* @param tenantKey
|
|||
|
|
*/
|
|||
|
|
public void delete(Collection<Long> ids, Long employeeId, String tenantKey) {
|
|||
|
|
taxDeclareRecordService.deleteByIds(ids, tenantKey);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 获取个税申报表是否已经生成
|
|||
|
|
*
|
|||
|
|
* @param index
|
|||
|
|
* @param tenantKey
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public TaxDeclarationRateDTO getRate(String index, String tenantKey) {
|
|||
|
|
return salaryCacheService.get(SalaryCacheKey.TAX_DECLARATION, index, TaxDeclarationRateDTO.class);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 申报
|
|||
|
|
*
|
|||
|
|
* @param id
|
|||
|
|
* @param tenantKey
|
|||
|
|
*/
|
|||
|
|
public String declare(Long id, Long employeeId, String tenantKey) {
|
|||
|
|
checkBefore(id);
|
|||
|
|
TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id))
|
|||
|
|
.setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156454, "在线申报"));
|
|||
|
|
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
|
|||
|
|
LocalRunnable localRunnable = new LocalRunnable() {
|
|||
|
|
@Override
|
|||
|
|
public void execute() {
|
|||
|
|
try {
|
|||
|
|
DSTenantKeyThreadVar.tenantKey.set(tenantKey);
|
|||
|
|
taxDeclareRecordService.declare(id, employeeId, tenantKey);
|
|||
|
|
taxDeclarationRate.setFinish(true);
|
|||
|
|
} catch (SalaryRunTimeException | SalaryNullException e) {
|
|||
|
|
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage());
|
|||
|
|
} catch (Exception e) {
|
|||
|
|
log.error("在线申报失败:{}", e.getMessage(), e);
|
|||
|
|
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 187274, "在线申报失败:") + e.getMessage());
|
|||
|
|
} finally {
|
|||
|
|
DSTenantKeyThreadVar.tenantKey.remove();
|
|||
|
|
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "declare", localRunnable);
|
|||
|
|
return taxDeclarationRate.getIndex();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 获取申报反馈
|
|||
|
|
*
|
|||
|
|
* @param id
|
|||
|
|
* @param tenantKey
|
|||
|
|
*/
|
|||
|
|
public String getDeclareFeedback(Long id, Long employeeId, String tenantKey) {
|
|||
|
|
checkBefore(id);
|
|||
|
|
TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id))
|
|||
|
|
.setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 182680, "获取申报反馈"));
|
|||
|
|
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
|
|||
|
|
LocalRunnable localRunnable = new LocalRunnable() {
|
|||
|
|
@Override
|
|||
|
|
public void execute() {
|
|||
|
|
try {
|
|||
|
|
taxDeclareRecordService.getDeclareFeedback(id, taxDeclarationRate, employeeId, tenantKey);
|
|||
|
|
taxDeclarationRate.setFinish(true);
|
|||
|
|
} catch (SalaryRunTimeException | SalaryNullException e) {
|
|||
|
|
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage());
|
|||
|
|
} catch (Exception e) {
|
|||
|
|
log.error("获取申报反馈失败:{}", e.getMessage(), e);
|
|||
|
|
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 187255, "获取申报反馈失败:") + e.getMessage());
|
|||
|
|
} finally {
|
|||
|
|
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "getDeclareFeedback", localRunnable);
|
|||
|
|
return taxDeclarationRate.getIndex();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 作废
|
|||
|
|
*
|
|||
|
|
* @param id
|
|||
|
|
* @param tenantKey
|
|||
|
|
*/
|
|||
|
|
public String cancelDeclare(Long id, Long employeeId, String tenantKey) {
|
|||
|
|
checkBefore(id);
|
|||
|
|
TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id))
|
|||
|
|
.setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 158842, "作废申报"));
|
|||
|
|
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
|
|||
|
|
LocalRunnable localRunnable = new LocalRunnable() {
|
|||
|
|
@Override
|
|||
|
|
public void execute() {
|
|||
|
|
try {
|
|||
|
|
taxDeclareRecordService.cancelDeclare(id, employeeId, tenantKey);
|
|||
|
|
taxDeclarationRate.setFinish(true);
|
|||
|
|
} catch (SalaryRunTimeException | SalaryNullException e) {
|
|||
|
|
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage());
|
|||
|
|
} catch (Exception e) {
|
|||
|
|
log.error("作废申报失败:{}", e.getMessage(), e);
|
|||
|
|
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 187272, "作废申报失败:") + e.getMessage());
|
|||
|
|
} finally {
|
|||
|
|
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "cancel", localRunnable);
|
|||
|
|
return taxDeclarationRate.getIndex();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 获取作废反馈
|
|||
|
|
*
|
|||
|
|
* @param id
|
|||
|
|
* @param tenantKey
|
|||
|
|
*/
|
|||
|
|
public String getCancelFeedback(Long id, Long employeeId, String tenantKey) {
|
|||
|
|
checkBefore(id);
|
|||
|
|
TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id))
|
|||
|
|
.setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 182681, "获取作废申报反馈"));
|
|||
|
|
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
|
|||
|
|
LocalRunnable localRunnable = new LocalRunnable() {
|
|||
|
|
@Override
|
|||
|
|
public void execute() {
|
|||
|
|
try {
|
|||
|
|
taxDeclareRecordService.getCancelFeedback(id, taxDeclarationRate, employeeId, tenantKey);
|
|||
|
|
taxDeclarationRate.setFinish(true);
|
|||
|
|
} catch (SalaryRunTimeException | SalaryNullException e) {
|
|||
|
|
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage());
|
|||
|
|
} catch (Exception e) {
|
|||
|
|
log.error("获取作废反馈结果失败:{}", e.getMessage(), e);
|
|||
|
|
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 187270, "获取作废反馈结果失败:") + e.getMessage());
|
|||
|
|
} finally {
|
|||
|
|
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "getCancelFeedback", localRunnable);
|
|||
|
|
return taxDeclarationRate.getIndex();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 更正申报
|
|||
|
|
*
|
|||
|
|
* @param id
|
|||
|
|
* @param employeeId
|
|||
|
|
* @param tenantKey
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public String updateDeclare(Long id, Long employeeId, String tenantKey) {
|
|||
|
|
checkBefore(id);
|
|||
|
|
TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id))
|
|||
|
|
.setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 177637, "更正申报"));
|
|||
|
|
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
|
|||
|
|
LocalRunnable localRunnable = new LocalRunnable() {
|
|||
|
|
@Override
|
|||
|
|
public void execute() {
|
|||
|
|
try {
|
|||
|
|
taxDeclareRecordService.updateDeclare(id, employeeId, tenantKey);
|
|||
|
|
taxDeclarationRate.setFinish(true);
|
|||
|
|
} catch (SalaryRunTimeException | SalaryNullException e) {
|
|||
|
|
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage());
|
|||
|
|
} catch (Exception e) {
|
|||
|
|
log.error("更正申报失败:{}", e.getMessage(), e);
|
|||
|
|
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 187269, "更正申报失败:") + e.getMessage());
|
|||
|
|
} finally {
|
|||
|
|
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "updateDeclare", localRunnable);
|
|||
|
|
return taxDeclarationRate.getIndex();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 税局端申报状态查询
|
|||
|
|
*
|
|||
|
|
* @param id
|
|||
|
|
* @param employeeId
|
|||
|
|
* @param tenantKey
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public String queryDeclareStatus(Long id, Long employeeId, String tenantKey) {
|
|||
|
|
return taxDeclareRecordService.queryDeclareStatus(id, employeeId, tenantKey);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 税局端申报明细查询
|
|||
|
|
*
|
|||
|
|
* @param id
|
|||
|
|
* @param employeeId
|
|||
|
|
* @param tenantKey
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public String queryCompanyIncomes(Long id, Long employeeId, String tenantKey) {
|
|||
|
|
return taxDeclareRecordService.queryCompanyIncomes(id, employeeId, tenantKey);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 刷新数据
|
|||
|
|
*
|
|||
|
|
* @param id
|
|||
|
|
* @param employeeId
|
|||
|
|
* @param tenantKey
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public String refreshData(Long id, Long employeeId, String tenantKey) {
|
|||
|
|
checkBefore(id);
|
|||
|
|
TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id))
|
|||
|
|
.setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156447, "刷新数据"));
|
|||
|
|
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
|
|||
|
|
LocalRunnable localRunnable = new LocalRunnable() {
|
|||
|
|
@Override
|
|||
|
|
public void execute() {
|
|||
|
|
try {
|
|||
|
|
DSTenantKeyThreadVar.tenantKey.set(tenantKey);
|
|||
|
|
taxDeclareRecordService.refreshData(id, employeeId, tenantKey);
|
|||
|
|
taxDeclarationRate.setFinish(true);
|
|||
|
|
} catch (SalaryRunTimeException | SalaryNullException e) {
|
|||
|
|
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage());
|
|||
|
|
} catch (Exception e) {
|
|||
|
|
log.error("刷新数据失败:{}", e.getMessage(), e);
|
|||
|
|
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 187268, "刷新数据失败:") + e.getMessage());
|
|||
|
|
} finally {
|
|||
|
|
DSTenantKeyThreadVar.tenantKey.remove();
|
|||
|
|
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "refreshData", localRunnable);
|
|||
|
|
return taxDeclarationRate.getIndex();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void checkBefore(Long id) {
|
|||
|
|
TaxDeclarationRateDTO taxDeclarationRate = salaryCacheService.get(SalaryCacheKey.TAX_DECLARATION, Util.null2String(id), TaxDeclarationRateDTO.class);
|
|||
|
|
if (taxDeclarationRate != null && !taxDeclarationRate.isFinish()) {
|
|||
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(182691, "当前正处于「{0}」中,请稍后再试").replace("{0}", taxDeclarationRate.getMsg()));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 导出个税申报明细列表
|
|||
|
|
*
|
|||
|
|
* @param queryParam
|
|||
|
|
* @param simpleEmployee
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public Map<String, Object> exportTaxDeclarationValue(TaxDeclarationValueListQueryParam queryParam, SimpleEmployee simpleEmployee) {
|
|||
|
|
ExcelExportParam excelExportParam = new ExcelExportParam()
|
|||
|
|
.setBiz(String.valueOf(IdGenerator.generate()))
|
|||
|
|
.setModule(EntityType.hrmsalary.name())
|
|||
|
|
.setFunction("exportTaxDeclarationValue");
|
|||
|
|
LocalRunnable localRunnable = new LocalRunnable() {
|
|||
|
|
@Override
|
|||
|
|
public void execute() {
|
|||
|
|
taxDeclarationExcelService.exportTaxDeclarationValue(excelExportParam, queryParam, simpleEmployee);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportTaxDeclarationValue", localRunnable);
|
|||
|
|
return JsonUtil.parseMap(excelExportParam, Object.class);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 导出未报送的人员列表
|
|||
|
|
*
|
|||
|
|
* @param queryParam
|
|||
|
|
* @param simpleEmployee
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public Map<String, Object> exportEmployee4NotDeclare(AbnormalEmployeeListQueryParam queryParam, SimpleEmployee simpleEmployee) {
|
|||
|
|
ExcelExportParam excelExportParam = new ExcelExportParam()
|
|||
|
|
.setBiz(String.valueOf(IdGenerator.generate()))
|
|||
|
|
.setModule(EntityType.hrmsalary.name())
|
|||
|
|
.setFunction("exportEmployee4NotDeclare");
|
|||
|
|
LocalRunnable localRunnable = new LocalRunnable() {
|
|||
|
|
@Override
|
|||
|
|
public void execute() {
|
|||
|
|
taxDeclarationExcelService.exportEmployee4NotDeclare(excelExportParam, queryParam, simpleEmployee);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployee4NotDeclare", localRunnable);
|
|||
|
|
return JsonUtil.parseMap(excelExportParam, Object.class);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 导出没有申报数据的人员列表
|
|||
|
|
*
|
|||
|
|
* @param queryParam
|
|||
|
|
* @param simpleEmployee
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public Map<String, Object> exportEmployee4NoValue(AbnormalEmployeeListQueryParam queryParam, SimpleEmployee simpleEmployee) {
|
|||
|
|
ExcelExportParam excelExportParam = new ExcelExportParam()
|
|||
|
|
.setBiz(String.valueOf(IdGenerator.generate()))
|
|||
|
|
.setModule(EntityType.hrmsalary.name())
|
|||
|
|
.setFunction("exportEmployee4NoValue");
|
|||
|
|
LocalRunnable localRunnable = new LocalRunnable() {
|
|||
|
|
@Override
|
|||
|
|
public void execute() {
|
|||
|
|
taxDeclarationExcelService.exportEmployee4NoValue(excelExportParam, queryParam, simpleEmployee);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployee4NoValue", localRunnable);
|
|||
|
|
return JsonUtil.parseMap(excelExportParam, Object.class);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 导出申报失败的人员列表
|
|||
|
|
*
|
|||
|
|
* @param queryParam
|
|||
|
|
* @param simpleEmployee
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
public Map<String, Object> exportEmployee4Fail(AbnormalEmployeeListQueryParam queryParam, SimpleEmployee simpleEmployee) {
|
|||
|
|
ExcelExportParam excelExportParam = new ExcelExportParam()
|
|||
|
|
.setBiz(String.valueOf(IdGenerator.generate()))
|
|||
|
|
.setModule(EntityType.hrmsalary.name())
|
|||
|
|
.setFunction("exportEmployee4Fail");
|
|||
|
|
LocalRunnable localRunnable = new LocalRunnable() {
|
|||
|
|
@Override
|
|||
|
|
public void execute() {
|
|||
|
|
taxDeclarationExcelService.exportEmployee4Fail(excelExportParam, queryParam, simpleEmployee);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployee4Fail", localRunnable);
|
|||
|
|
return JsonUtil.parseMap(excelExportParam, Object.class);
|
|||
|
|
}
|
|||
|
|
}
|