This commit is contained in:
parent
9e416123dd
commit
2f2727c4b9
|
|
@ -2,7 +2,6 @@ package com.engine.salary.entity.taxdeclaration.param;
|
||||||
|
|
||||||
import com.engine.salary.common.BaseQueryParam;
|
import com.engine.salary.common.BaseQueryParam;
|
||||||
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
|
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -14,7 +13,6 @@ import lombok.Data;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
**/
|
**/
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("个税申报表记录列表查询参数")
|
|
||||||
public class TaxDeclarationValueListQueryParam extends BaseQueryParam {
|
public class TaxDeclarationValueListQueryParam extends BaseQueryParam {
|
||||||
|
|
||||||
//个税申报记录id")
|
//个税申报记录id")
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.engine.salary.service;
|
package com.engine.salary.service;
|
||||||
|
|
||||||
|
import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
|
||||||
|
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationValueListQueryParam;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -15,7 +17,32 @@ public interface TaxDeclarationExcelService {
|
||||||
/**
|
/**
|
||||||
* 导出个税申报表
|
* 导出个税申报表
|
||||||
*
|
*
|
||||||
* @param taxDeclarationId
|
* @param queryParam
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
XSSFWorkbook exportTaxDeclaration(Long taxDeclarationId);
|
XSSFWorkbook exportTaxDeclarationValue(TaxDeclarationValueListQueryParam queryParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出未报送的人员
|
||||||
|
*
|
||||||
|
* @param queryParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
XSSFWorkbook exportEmployee4NotDeclare(AbnormalEmployeeListQueryParam queryParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出缺少申报数据的人员
|
||||||
|
*
|
||||||
|
* @param queryParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
XSSFWorkbook exportEmployee4NoValue(AbnormalEmployeeListQueryParam queryParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出申报失败的人员
|
||||||
|
*
|
||||||
|
* @param queryParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
XSSFWorkbook exportEmployee4Fail(AbnormalEmployeeListQueryParam queryParam);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,30 @@
|
||||||
package com.engine.salary.service.impl;
|
package com.engine.salary.service.impl;
|
||||||
|
|
||||||
|
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
||||||
import com.engine.common.util.ServiceUtil;
|
import com.engine.common.util.ServiceUtil;
|
||||||
import com.engine.core.impl.Service;
|
import com.engine.core.impl.Service;
|
||||||
import com.engine.salary.annotation.SalaryTableColumn;
|
import com.engine.salary.annotation.SalaryTableColumn;
|
||||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationAnnualListDTO;
|
import com.engine.salary.entity.taxdeclaration.dto.AbnormalEmployeeListDTO;
|
||||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
|
import com.engine.salary.entity.taxdeclaration.dto.FailEmployeeListDTO;
|
||||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationWageListDTO;
|
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationValueListDTO;
|
||||||
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam;
|
import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
|
||||||
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
|
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationValueListQueryParam;
|
||||||
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
|
import com.engine.salary.entity.taxdeclaration.po.*;
|
||||||
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationDetailMapper;
|
import com.engine.salary.service.*;
|
||||||
import com.engine.salary.service.TaxDeclarationDetailService;
|
|
||||||
import com.engine.salary.service.TaxDeclarationExcelService;
|
|
||||||
import com.engine.salary.service.TaxDeclarationService;
|
|
||||||
import com.engine.salary.util.JsonUtil;
|
import com.engine.salary.util.JsonUtil;
|
||||||
import com.engine.salary.util.SalaryI18nUtil;
|
import com.engine.salary.util.SalaryI18nUtil;
|
||||||
import com.engine.salary.util.db.MapperProxyFactory;
|
import com.engine.salary.util.excel.ExcelSheetData;
|
||||||
import com.engine.salary.util.excel.ExcelUtil;
|
import com.engine.salary.util.excel.ExcelUtil;
|
||||||
import com.engine.salary.util.page.PageInfo;
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
import weaver.general.Util;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 个税申报表导出
|
* 个税申报表导出
|
||||||
|
|
@ -39,101 +37,126 @@ import java.util.Objects;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclarationExcelService {
|
public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclarationExcelService {
|
||||||
|
|
||||||
private TaxDeclarationDetailService getTaxDeclarationDetailService(User user) {
|
|
||||||
return ServiceUtil.getService(TaxDeclarationDetailServiceImpl.class, user);
|
|
||||||
}
|
|
||||||
private TaxDeclarationDetailMapper getTaxDeclarationDetailMapper() {
|
|
||||||
return MapperProxyFactory.getProxy(TaxDeclarationDetailMapper.class);
|
|
||||||
}
|
|
||||||
private TaxDeclarationService getTaxDeclarationService(User user) {
|
private TaxDeclarationService getTaxDeclarationService(User user) {
|
||||||
return ServiceUtil.getService(TaxDeclarationServiceImpl.class, user);
|
return ServiceUtil.getService(TaxDeclarationServiceImpl.class, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TaxDeclarationValueService getTaxDeclarationValueService(User user) {
|
||||||
|
return ServiceUtil.getService(TaxDeclarationValueServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private TaxDeclareRecordService getTaxDeclareRecordService(User user) {
|
||||||
|
return ServiceUtil.getService(TaxDeclareRecordServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private TaxDeclareEmployeeService getTaxDeclareEmployeeService(User user) {
|
||||||
|
return ServiceUtil.getService(TaxDeclareEmployeeServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private TaxDeclareFailService getTaxDeclareFailService(User user) {
|
||||||
|
return ServiceUtil.getService(TaxDeclareFailServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public XSSFWorkbook exportTaxDeclarationValue(TaxDeclarationValueListQueryParam queryParam) {
|
||||||
|
// 查询个税申报表
|
||||||
|
TaxDeclarationPO taxDeclarationPO = getTaxDeclarationService(user).getById(queryParam.getTaxDeclarationId());
|
||||||
|
// 查询个税申报表明细
|
||||||
|
List<TaxDeclarationValuePO> taxDeclarationValues = getTaxDeclarationValueService(user).listByTaxDeclarationIds(Collections.singleton(queryParam.getTaxDeclarationId()));
|
||||||
|
// 转成个税申报表明细
|
||||||
|
TaxDeclarationValueListDTO taxDeclarationValueListDTO = getTaxDeclarationValueService(user).convert2List(taxDeclarationPO, taxDeclarationValues);
|
||||||
|
// excel导出的数据
|
||||||
|
List<List<String>> rows = Lists.newArrayList();
|
||||||
|
List<String> headerList = Lists.newArrayList();
|
||||||
|
List<String> dataIndexList = Lists.newArrayList();
|
||||||
|
|
||||||
|
// 解析表头
|
||||||
|
for (WeaTableColumn column : taxDeclarationValueListDTO.getColumns()) {
|
||||||
|
headerList.add(column.getText());
|
||||||
|
dataIndexList.add(column.getColumn());
|
||||||
|
}
|
||||||
|
|
||||||
|
rows.add(headerList);
|
||||||
|
// 解析表中数据
|
||||||
|
for (Map<String, Object> datum : taxDeclarationValueListDTO.getData()) {
|
||||||
|
List<String> row = Lists.newArrayList();
|
||||||
|
for (String dataIndex : dataIndexList) {
|
||||||
|
row.add(Util.null2String(datum.get(dataIndex)));
|
||||||
|
}
|
||||||
|
rows.add(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
String sheetName = SalaryI18nUtil.getI18nLabel(100090, "个税申报表");
|
||||||
|
|
||||||
|
return ExcelUtil.genWorkbook(rows, sheetName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XSSFWorkbook exportTaxDeclaration(Long taxDeclarationId) {
|
public XSSFWorkbook exportEmployee4NotDeclare(AbnormalEmployeeListQueryParam queryParam) {
|
||||||
// 1.工作簿名称
|
// 查询个税申报记录
|
||||||
String sheetName = SalaryI18nUtil.getI18nLabel(85368, "个税申报表");
|
TaxDeclareRecordPO taxDeclareRecord = getTaxDeclareRecordService(user).getById(queryParam.getTaxDeclareRecordId());
|
||||||
|
queryParam.setTaxAgentId(taxDeclareRecord.getTaxAgentId());
|
||||||
|
queryParam.setTaxCycle(taxDeclareRecord.getTaxCycle());
|
||||||
TaxDeclarationPO taxDeclarationPO = getTaxDeclarationService(user).getById(taxDeclarationId);
|
// 查询个税申报表明细中的人员
|
||||||
// 查询当前个税申报表一共有多少人员
|
List<TaxDeclareEmployeePO> taxDeclareEmployees = getTaxDeclareEmployeeService(user).list4NotDeclareByParam(queryParam);
|
||||||
int count = getTaxDeclarationDetailMapper().countEmployeeId(taxDeclarationId);
|
// 转换成列表dto
|
||||||
// 以1000个人员一页,一共有多少页
|
List<AbnormalEmployeeListDTO> dtoList = getTaxDeclareEmployeeService(user).convert2AbnormalEmployeeList(taxDeclareRecord, taxDeclareEmployees);
|
||||||
int totalPages = (count % 1000 == 0) ? (count / 1000) : (count / 1000 + 1); //总页数
|
ExcelSheetData excelSheetData = getExcelSheetData(AbnormalEmployeeListDTO.class, dtoList);
|
||||||
// excel导出的数据
|
return ExcelUtil.genWorkbook(excelSheetData);
|
||||||
List<List<Object>> rows = Lists.newArrayListWithExpectedSize(count);
|
|
||||||
List<Object> headerList = Lists.newArrayList();
|
|
||||||
List<String> dataIndexList = Lists.newArrayList();
|
|
||||||
if (Objects.equals(taxDeclarationPO.getIncomeCategory(), IncomeCategoryEnum.WAGES_AND_SALARIES.getValue())) {
|
|
||||||
// 解析表头
|
|
||||||
parseHeader(TaxDeclarationWageListDTO.class, headerList, dataIndexList);
|
|
||||||
rows.add(headerList);
|
|
||||||
for (int i = 0; i < totalPages; i++) {
|
|
||||||
TaxDeclarationDetailListQueryParam queryParam = new TaxDeclarationDetailListQueryParam();
|
|
||||||
queryParam.setTaxDeclarationId(taxDeclarationId);
|
|
||||||
queryParam.setCurrent(i+1);
|
|
||||||
queryParam.setPageSize(1000);
|
|
||||||
PageInfo<TaxDeclarationWageListDTO> dtoPage = getTaxDeclarationDetailService(user).listDtoPageByParam4Wage(queryParam);
|
|
||||||
List<TaxDeclarationWageListDTO> list = dtoPage.getList();
|
|
||||||
for (TaxDeclarationWageListDTO taxDeclarationWageListDTO : list) {
|
|
||||||
List<Object> row = Lists.newArrayListWithExpectedSize(dataIndexList.size());
|
|
||||||
Map<String, Object> map = JsonUtil.parseMap(taxDeclarationWageListDTO, Object.class);
|
|
||||||
for (String dataIndex : dataIndexList) {
|
|
||||||
row.add(map.get(dataIndex));
|
|
||||||
}
|
|
||||||
rows.add(row);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Objects.equals(taxDeclarationPO.getIncomeCategory(), IncomeCategoryEnum.REMUNERATION_FOR_LABOR.getValue())) {
|
|
||||||
// 解析表头
|
|
||||||
parseHeader(TaxDeclarationLaborListDTO.class, headerList, dataIndexList);
|
|
||||||
rows.add(headerList);
|
|
||||||
for (int i = 0; i < totalPages; i++) {
|
|
||||||
TaxDeclarationDetailListQueryParam queryParam = new TaxDeclarationDetailListQueryParam();
|
|
||||||
queryParam.setTaxDeclarationId(taxDeclarationId);
|
|
||||||
queryParam.setCurrent(i);
|
|
||||||
queryParam.setPageSize(1000);
|
|
||||||
PageInfo<TaxDeclarationLaborListDTO> dtoPage = getTaxDeclarationDetailService(user).listDtoPageByParam4Labor(queryParam);
|
|
||||||
List<TaxDeclarationLaborListDTO> list = dtoPage.getList();
|
|
||||||
for (TaxDeclarationLaborListDTO taxDeclarationLaborListDTO : list) {
|
|
||||||
List<Object> row = Lists.newArrayListWithExpectedSize(dataIndexList.size());
|
|
||||||
Map<String, Object> map = JsonUtil.parseMap(taxDeclarationLaborListDTO, Object.class);
|
|
||||||
for (String dataIndex : dataIndexList) {
|
|
||||||
row.add(map.get(dataIndex));
|
|
||||||
}
|
|
||||||
rows.add(row);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Objects.equals(taxDeclarationPO.getIncomeCategory(), IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue())) {
|
|
||||||
// 解析表头
|
|
||||||
parseHeader(TaxDeclarationAnnualListDTO.class, headerList, dataIndexList);
|
|
||||||
rows.add(headerList);
|
|
||||||
for (int i = 0; i < totalPages; i++) {
|
|
||||||
TaxDeclarationDetailListQueryParam queryParam = new TaxDeclarationDetailListQueryParam();
|
|
||||||
queryParam.setTaxDeclarationId(taxDeclarationId);
|
|
||||||
queryParam.setCurrent(i);
|
|
||||||
queryParam.setPageSize(1000);
|
|
||||||
PageInfo<TaxDeclarationAnnualListDTO> dtoPage = getTaxDeclarationDetailService(user).listDtoPageByParam4Annual(queryParam);
|
|
||||||
List<TaxDeclarationAnnualListDTO> list = dtoPage.getList();
|
|
||||||
for (TaxDeclarationAnnualListDTO taxDeclarationLaborListDTO : list) {
|
|
||||||
List<Object> row = Lists.newArrayListWithExpectedSize(dataIndexList.size());
|
|
||||||
Map<String, Object> map = JsonUtil.parseMap(taxDeclarationLaborListDTO, Object.class);
|
|
||||||
for (String dataIndex : dataIndexList) {
|
|
||||||
row.add(map.get(dataIndex));
|
|
||||||
}
|
|
||||||
rows.add(row);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ExcelUtil.genWorkbookV2(rows, sheetName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public XSSFWorkbook exportEmployee4NoValue(AbnormalEmployeeListQueryParam queryParam) {
|
||||||
|
// 查询个税申报记录
|
||||||
|
TaxDeclareRecordPO taxDeclareRecord = getTaxDeclareRecordService(user).getById(queryParam.getTaxDeclareRecordId());
|
||||||
|
queryParam.setTaxAgentId(taxDeclareRecord.getTaxAgentId());
|
||||||
|
queryParam.setTaxCycle(taxDeclareRecord.getTaxCycle());
|
||||||
|
// 查询个税申报表明细中的人员
|
||||||
|
List<TaxDeclareEmployeePO> taxDeclareEmployees = getTaxDeclareEmployeeService(user).list4NoValueByParam(queryParam);
|
||||||
|
// 转换成列表dto
|
||||||
|
List<AbnormalEmployeeListDTO> dtoList = getTaxDeclareEmployeeService(user).convert2AbnormalEmployeeList(taxDeclareRecord, taxDeclareEmployees);
|
||||||
|
ExcelSheetData excelSheetData = getExcelSheetData(AbnormalEmployeeListDTO.class, dtoList);
|
||||||
|
|
||||||
|
return ExcelUtil.genWorkbook(excelSheetData);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public XSSFWorkbook exportEmployee4Fail(AbnormalEmployeeListQueryParam queryParam) {
|
||||||
|
// 查询个税申报记录
|
||||||
|
TaxDeclareRecordPO taxDeclareRecord = getTaxDeclareRecordService(user).getById(queryParam.getTaxDeclareRecordId());
|
||||||
|
queryParam.setTaxAgentId(taxDeclareRecord.getTaxAgentId());
|
||||||
|
queryParam.setTaxCycle(taxDeclareRecord.getTaxCycle());
|
||||||
|
// 查询个税申报表明细中的人员
|
||||||
|
List<TaxDeclareFailPO> taxDeclareFails = getTaxDeclareFailService(user).listByTaxDeclareRecordIds(Collections.singleton(taxDeclareRecord.getId()));
|
||||||
|
// 转换成列表dto
|
||||||
|
List<FailEmployeeListDTO> dtoList = getTaxDeclareFailService(user).convert2FailEmployeeList(taxDeclareRecord, taxDeclareFails);
|
||||||
|
ExcelSheetData excelSheetData = getExcelSheetData(FailEmployeeListDTO.class, dtoList);
|
||||||
|
return ExcelUtil.genWorkbook(excelSheetData);
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T> ExcelSheetData getExcelSheetData(Class<T> clazz, List<T> dtoList) {
|
||||||
|
// 导出的表头
|
||||||
|
List<String> headerList = Lists.newArrayList();
|
||||||
|
List<String> dataIndexList = Lists.newArrayList();
|
||||||
|
parseHeader(clazz, headerList, dataIndexList);
|
||||||
|
// 导出的数据
|
||||||
|
List<List<Object>> rows = Lists.newArrayListWithExpectedSize(dtoList.size());
|
||||||
|
dtoList.forEach(dto -> {
|
||||||
|
Map<String, Object> map = JsonUtil.parseMap(dto, Object.class);
|
||||||
|
List<Object> row = Lists.newArrayListWithExpectedSize(dataIndexList.size());
|
||||||
|
dataIndexList.forEach(dataIndex -> row.add(map.get(dataIndex)));
|
||||||
|
rows.add(row);
|
||||||
|
});
|
||||||
|
// 组装excel导出数据
|
||||||
|
ExcelSheetData excelSheetData = new ExcelSheetData();
|
||||||
|
excelSheetData.setSheetName(SalaryI18nUtil.getI18nLabel(156423, "个税申报表人员"));
|
||||||
|
excelSheetData.setHeaders(headerList);
|
||||||
|
excelSheetData.setRows(rows);
|
||||||
|
return excelSheetData;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析表头
|
* 解析表头
|
||||||
*
|
*
|
||||||
|
|
@ -142,14 +165,14 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar
|
||||||
* @param dataIndexList
|
* @param dataIndexList
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
private <T> void parseHeader(Class<T> clazz, List<Object> headerList, List<String> dataIndexList) {
|
private <T> void parseHeader(Class<T> clazz, List<String> headerList, List<String> dataIndexList) {
|
||||||
Field[] declaredFields = clazz.getDeclaredFields();
|
Field[] declaredFields = clazz.getDeclaredFields();
|
||||||
for (Field declaredField : declaredFields) {
|
for (Field declaredField : declaredFields) {
|
||||||
if (!declaredField.isAnnotationPresent(SalaryTableColumn.class)) {
|
if (!declaredField.isAnnotationPresent(SalaryTableColumn.class)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
SalaryTableColumn annotation = declaredField.getAnnotation(SalaryTableColumn.class);
|
SalaryTableColumn annotation = declaredField.getAnnotation(SalaryTableColumn.class);
|
||||||
headerList.add(SalaryI18nUtil.getI18nLabel( annotation.labelId(), annotation.text()));
|
headerList.add(SalaryI18nUtil.getI18nLabel((int) annotation.labelId(), annotation.text()));
|
||||||
dataIndexList.add(declaredField.getName());
|
dataIndexList.add(declaredField.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.engine.salary.util.excel;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ExcelSheetData {
|
||||||
|
|
||||||
|
private String sheetName;
|
||||||
|
private List<String> headers;
|
||||||
|
private List<List<Object>> rows;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -9,7 +9,7 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||||
import org.apache.poi.xssf.usermodel.*;
|
import org.apache.poi.xssf.usermodel.*;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ExcelUtil {
|
public class ExcelUtil {
|
||||||
|
|
@ -266,4 +266,11 @@ public class ExcelUtil {
|
||||||
}
|
}
|
||||||
return workbook;
|
return workbook;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static XSSFWorkbook genWorkbook(ExcelSheetData excelSheetData) {
|
||||||
|
List<List<Object>> list = new ArrayList<>();
|
||||||
|
list.add(Collections.singletonList(excelSheetData.getHeaders()));
|
||||||
|
list.addAll( excelSheetData.getRows());
|
||||||
|
return genWorkbookV2(list, excelSheetData.getSheetName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,22 @@ package com.engine.salary.web;
|
||||||
import com.engine.common.util.ServiceUtil;
|
import com.engine.common.util.ServiceUtil;
|
||||||
import com.engine.salary.entity.taxdeclaration.dto.*;
|
import com.engine.salary.entity.taxdeclaration.dto.*;
|
||||||
import com.engine.salary.entity.taxdeclaration.param.*;
|
import com.engine.salary.entity.taxdeclaration.param.*;
|
||||||
|
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
|
||||||
import com.engine.salary.service.TaxDeclarationExcelService;
|
import com.engine.salary.service.TaxDeclarationExcelService;
|
||||||
import com.engine.salary.service.TaxDeclarationService;
|
import com.engine.salary.service.TaxDeclarationService;
|
||||||
import com.engine.salary.service.impl.TaxDeclarationExcelServiceImpl;
|
import com.engine.salary.service.impl.TaxDeclarationExcelServiceImpl;
|
||||||
import com.engine.salary.service.impl.TaxDeclarationServiceImpl;
|
import com.engine.salary.service.impl.TaxDeclarationServiceImpl;
|
||||||
import com.engine.salary.util.ResponseResult;
|
import com.engine.salary.util.ResponseResult;
|
||||||
|
import com.engine.salary.util.SalaryDateUtil;
|
||||||
|
import com.engine.salary.util.SalaryI18nUtil;
|
||||||
import com.engine.salary.util.page.PageInfo;
|
import com.engine.salary.util.page.PageInfo;
|
||||||
import com.engine.salary.wrapper.TaxDeclarationDetailWrapper;
|
import com.engine.salary.wrapper.TaxDeclarationDetailWrapper;
|
||||||
import com.engine.salary.wrapper.TaxDeclarationWrapper;
|
import com.engine.salary.wrapper.TaxDeclarationWrapper;
|
||||||
import com.engine.salary.wrapper.TaxDeclareRecordWrapper;
|
import com.engine.salary.wrapper.TaxDeclareRecordWrapper;
|
||||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import weaver.hrm.HrmUserVarify;
|
import weaver.hrm.HrmUserVarify;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
|
|
||||||
|
|
@ -22,6 +27,11 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.ws.rs.*;
|
import javax.ws.rs.*;
|
||||||
import javax.ws.rs.core.Context;
|
import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.StreamingOutput;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -51,93 +61,6 @@ public class TaxDeclarationController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// //个税申报表列表
|
|
||||||
// @POST
|
|
||||||
// @Path("/list")
|
|
||||||
// @Produces(MediaType.APPLICATION_JSON)
|
|
||||||
// public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclarationListQueryParam queryParam) throws ParseException {
|
|
||||||
// User user = HrmUserVarify.getUser(request, response);
|
|
||||||
// queryParam.setFromSalaryMonth(SalaryDateUtil.stringToDate(queryParam.getFromSalaryMonthStr() == null ? "" : queryParam.getFromSalaryMonthStr()));
|
|
||||||
// queryParam.setEndSalaryMonth(SalaryDateUtil.stringToDate(queryParam.getEndSalaryMonthStr() == null ? "" : queryParam.getEndSalaryMonthStr()));
|
|
||||||
// return new ResponseResult<TaxDeclarationListQueryParam, PageInfo<TaxDeclarationListDTO>>(user).run(getTaxDeclarationWrapper(user)::listPage, queryParam);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @POST
|
|
||||||
// @Path("/withDrawTaxDeclaration")
|
|
||||||
// @Produces(MediaType.APPLICATION_JSON)
|
|
||||||
// public String deleteTaxDeclaration(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclarationSaveParam param) {
|
|
||||||
// User user = HrmUserVarify.getUser(request, response);
|
|
||||||
// return new ResponseResult<Long, String>(user).run(getTaxDeclarationWrapper(user)::withDrawTaxDeclaration, param.getTaxDeclarationId());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// //个税申报表表单
|
|
||||||
// @GET
|
|
||||||
// @Path("/getForm")
|
|
||||||
// @Produces(MediaType.APPLICATION_JSON)
|
|
||||||
// public String getForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
|
|
||||||
// User user = HrmUserVarify.getUser(request, response);
|
|
||||||
// return new ResponseResult<Long, TaxDeclarationFormDTO>(user).run(getTaxDeclarationWrapper(user)::getForm, id);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //个税申报表相关信息
|
|
||||||
// @GET
|
|
||||||
// @Path("/getTaxDeclarationInfo")
|
|
||||||
// @Produces(MediaType.APPLICATION_JSON)
|
|
||||||
// public String getTaxDeclarationInfo(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "taxDeclarationId") Long taxDeclarationId) {
|
|
||||||
// User user = HrmUserVarify.getUser(request, response);
|
|
||||||
// return new ResponseResult<Long, TaxDeclarationInfoDTO>(user).run(getTaxDeclarationWrapper(user)::getTaxDeclarationInfoById, taxDeclarationId);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //个税申报表生成
|
|
||||||
// @POST
|
|
||||||
// @Path("/save")
|
|
||||||
// @Produces(MediaType.APPLICATION_JSON)
|
|
||||||
// public String save(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclarationSaveParam param) {
|
|
||||||
// User user = HrmUserVarify.getUser(request, response);
|
|
||||||
// param.setSalaryMonth(SalaryDateUtil.String2YearMonth(param.getSalaryMonthStr()));
|
|
||||||
// return new ResponseResult<TaxDeclarationSaveParam, Long>(user).run(getTaxDeclarationWrapper(user)::save, param);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //个税申报表详情列表
|
|
||||||
// @POST
|
|
||||||
// @Path("/detail/list")
|
|
||||||
// @Produces(MediaType.APPLICATION_JSON)
|
|
||||||
// public String listTaxDeclarationDetail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclarationDetailListQueryParam param) {
|
|
||||||
// User user = HrmUserVarify.getUser(request, response);
|
|
||||||
// param.setTaxDeclarationId(Long.parseLong(param.getTaxDeclarationIdStr()));
|
|
||||||
// return new ResponseResult<TaxDeclarationDetailListQueryParam, PageInfo>(user).run(getTaxDeclarationDetailWrapper(user)::listPage, param);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //个税申报表相关信息
|
|
||||||
// @GET
|
|
||||||
// @Path("/export")
|
|
||||||
// @Produces(MediaType.APPLICATION_OCTET_STREAM)
|
|
||||||
// public Response exportTaxDeclaration(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "taxDeclarationId") Long taxDeclarationId) {
|
|
||||||
// try {
|
|
||||||
// User user = HrmUserVarify.getUser(request, response);
|
|
||||||
// XSSFWorkbook workbook = getTaxDeclarationExcelService(user).exportTaxDeclaration(taxDeclarationId);
|
|
||||||
//
|
|
||||||
// String fileName = "个税申报表" + LocalDate.now();
|
|
||||||
// try {
|
|
||||||
// fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
|
||||||
// } catch (UnsupportedEncodingException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// StreamingOutput output = outputStream -> {
|
|
||||||
// workbook.write(outputStream);
|
|
||||||
// outputStream.flush();
|
|
||||||
// };
|
|
||||||
// response.setContentType("application/octet-stream");
|
|
||||||
// return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// log.error("个税申报表导出异常", e);
|
|
||||||
// throw e;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 个税申报表列表
|
* 个税申报表列表
|
||||||
*
|
*
|
||||||
|
|
@ -377,20 +300,70 @@ public class TaxDeclarationController {
|
||||||
return new ResponseResult<TaxDeclarationValueListQueryParam, PageInfo>(user).run(getTaxDeclareRecordWrapper(user)::listValuePage, queryParam);
|
return new ResponseResult<TaxDeclarationValueListQueryParam, PageInfo>(user).run(getTaxDeclareRecordWrapper(user)::listValuePage, queryParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * 导出个税申报表申报数据
|
* 导出个税申报表申报数据
|
||||||
// *
|
*
|
||||||
// * @param queryParam 导出参数
|
* @return
|
||||||
// * @return
|
*/
|
||||||
// */
|
@GET
|
||||||
// @POST
|
@Path("/detail/export")
|
||||||
// @Path("/detail/export")
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
// @Produces(MediaType.APPLICATION_JSON)
|
public Response exportDetail(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||||
// public String exportTaxDeclaration(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclarationValueListQueryParam queryParam) {
|
|
||||||
// User user = HrmUserVarify.getUser(request, response);
|
TaxDeclarationValueListQueryParam queryParam = genTaxDeclarationValueListQueryParam(request);
|
||||||
// return new ResponseResult<TaxDeclarationValueListQueryParam, PageInfo>(user).run(getTaxDeclareRecordWrapper(user)::exportTaxDeclarationValue, queryParam);
|
|
||||||
//
|
try {
|
||||||
// }
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
|
|
||||||
|
XSSFWorkbook workbook = getTaxDeclareRecordWrapper(user).exportTaxDeclarationValue(queryParam);
|
||||||
|
|
||||||
|
String fileName = SalaryI18nUtil.getI18nLabel(156419, "个税申报表明细") + "-" + SalaryDateUtil.getFormatLocalDate(LocalDateTime.now());
|
||||||
|
try {
|
||||||
|
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
StreamingOutput output = outputStream -> {
|
||||||
|
workbook.write(outputStream);
|
||||||
|
outputStream.flush();
|
||||||
|
};
|
||||||
|
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
return Response.ok(output)
|
||||||
|
.header("Content-disposition", "attachment;filename=" + fileName)
|
||||||
|
.header("Cache-Control", "no-cache").build();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("个税申报表明细导出异常", e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private TaxDeclarationValueListQueryParam genTaxDeclarationValueListQueryParam(HttpServletRequest request) {
|
||||||
|
TaxDeclarationValueListQueryParam param = new TaxDeclarationValueListQueryParam();
|
||||||
|
String current = request.getParameter("current");
|
||||||
|
if (StringUtils.isNotBlank(current)) {
|
||||||
|
param.setCurrent(Integer.valueOf(current));
|
||||||
|
}
|
||||||
|
String pageSize = request.getParameter("pageSize");
|
||||||
|
if (StringUtils.isNotBlank(pageSize)) {
|
||||||
|
param.setPageSize(Integer.valueOf(pageSize));
|
||||||
|
}
|
||||||
|
String taxDeclareRecordId = request.getParameter("taxDeclareRecordId");
|
||||||
|
if (StringUtils.isNotBlank(taxDeclareRecordId)) {
|
||||||
|
param.setTaxDeclareRecordId(Long.valueOf(taxDeclareRecordId));
|
||||||
|
}
|
||||||
|
String taxDeclarationId = request.getParameter("taxDeclarationId");
|
||||||
|
if (StringUtils.isNotBlank(taxDeclarationId)) {
|
||||||
|
param.setTaxDeclarationId(Long.valueOf(taxDeclarationId));
|
||||||
|
}
|
||||||
|
String incomeCategory = request.getParameter("incomeCategory");
|
||||||
|
if (StringUtils.isNotBlank(incomeCategory)) {
|
||||||
|
param.setIncomeCategory(IncomeCategoryEnum.valueOf(incomeCategory));
|
||||||
|
}
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 个税申报表申报数据-人员未报送列表
|
* 个税申报表申报数据-人员未报送列表
|
||||||
|
|
@ -434,47 +407,146 @@ public class TaxDeclarationController {
|
||||||
return new ResponseResult<AbnormalEmployeeListQueryParam, PageInfo<FailEmployeeListDTO>>(user).run(getTaxDeclareRecordWrapper(user)::listEmployeePage4Fail, queryParam);
|
return new ResponseResult<AbnormalEmployeeListQueryParam, PageInfo<FailEmployeeListDTO>>(user).run(getTaxDeclareRecordWrapper(user)::listEmployeePage4Fail, queryParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
private AbnormalEmployeeListQueryParam genAbnormalEmployeeListQueryParam(HttpServletRequest request) {
|
||||||
// * 个税申报表申报数据-导出人员未报送列表
|
AbnormalEmployeeListQueryParam param = new AbnormalEmployeeListQueryParam();
|
||||||
// *
|
String current = request.getParameter("current");
|
||||||
// * @param queryParam 查询条件
|
if (StringUtils.isNotBlank(current)) {
|
||||||
// * @return
|
param.setCurrent(Integer.valueOf(current));
|
||||||
// */
|
}
|
||||||
// @POST
|
String pageSize = request.getParameter("pageSize");
|
||||||
// @Path("/employee/export4NotDeclare")
|
if (StringUtils.isNotBlank(pageSize)) {
|
||||||
// @Produces(MediaType.APPLICATION_JSON)
|
param.setPageSize(Integer.valueOf(pageSize));
|
||||||
// public String exportEmployee4NotDeclare(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AbnormalEmployeeListQueryParam queryParam) {
|
}
|
||||||
//
|
String keyword = request.getParameter("keyword");
|
||||||
// Map<String, Object> map = taxDeclareRecordWrapper.exportEmployee4NotDeclare(queryParam, UserContext.getCurrentUser());
|
if (StringUtils.isNotBlank(keyword)) {
|
||||||
// return WeaResult.success(map);
|
param.setKeyword(keyword);
|
||||||
// }
|
}
|
||||||
|
String taxDeclareRecordId = request.getParameter("taxDeclareRecordId");
|
||||||
|
if (StringUtils.isNotBlank(taxDeclareRecordId)) {
|
||||||
|
param.setTaxDeclareRecordId(Long.valueOf(taxDeclareRecordId));
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
String taxAgentId = request.getParameter("taxAgentId");
|
||||||
// * 个税申报表申报数据-导出报送人员无申报数据列表
|
if (StringUtils.isNotBlank(taxAgentId)) {
|
||||||
// *
|
param.setTaxAgentId(Long.valueOf(taxAgentId));
|
||||||
// * @param queryParam 查询条件
|
}
|
||||||
// * @return
|
|
||||||
// */
|
String taxCycle = request.getParameter("taxCycle");
|
||||||
// @POST
|
if (StringUtils.isNotBlank(taxCycle)) {
|
||||||
// @Path("/employee/export4NoValue")
|
param.setTaxCycle(SalaryDateUtil.stringToDate(taxCycle));
|
||||||
// @Produces(MediaType.APPLICATION_JSON)
|
}
|
||||||
// public String exportEmployee4NoValue(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AbnormalEmployeeListQueryParam queryParam) {
|
|
||||||
// Map<String, Object> map = taxDeclareRecordWrapper.exportEmployee4NoValue(queryParam, UserContext.getCurrentUser());
|
return param;
|
||||||
// return WeaResult.success(map);
|
}
|
||||||
// }
|
|
||||||
//
|
/**
|
||||||
// /**
|
* 个税申报表申报数据-导出人员未报送列表
|
||||||
// * 个税申报表申报数据-导出申报失败列表
|
*
|
||||||
// *
|
* @return
|
||||||
// * @param queryParam 导出参数
|
*/
|
||||||
// * @return
|
@GET
|
||||||
// */
|
@Path("/employee/export4NotDeclare")
|
||||||
// @POST
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
// @Path("/employee/export4Fail")
|
public Response exportEmployee4NotDeclare(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||||
// @Produces(MediaType.APPLICATION_JSON)
|
try {
|
||||||
// public String exportEmployee4Fail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AbnormalEmployeeListQueryParam queryParam) {
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
// Map<String, Object> map = taxDeclareRecordWrapper.exportEmployee4Fail(queryParam, UserContext.getCurrentUser());
|
|
||||||
// return WeaResult.success(map);
|
AbnormalEmployeeListQueryParam queryParam = genAbnormalEmployeeListQueryParam(request);
|
||||||
// }
|
XSSFWorkbook workbook = getTaxDeclareRecordWrapper(user).exportEmployee4NotDeclare(queryParam);
|
||||||
|
|
||||||
|
String fileName = SalaryI18nUtil.getI18nLabel(156420, "未报送的人员") + "-" + SalaryDateUtil.getFormatLocalDate(LocalDateTime.now());
|
||||||
|
try {
|
||||||
|
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
StreamingOutput output = outputStream -> {
|
||||||
|
workbook.write(outputStream);
|
||||||
|
outputStream.flush();
|
||||||
|
};
|
||||||
|
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
return Response.ok(output)
|
||||||
|
.header("Content-disposition", "attachment;filename=" + fileName)
|
||||||
|
.header("Cache-Control", "no-cache").build();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("未报送的人员导出异常", e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个税申报表申报数据-导出报送人员无申报数据列表
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/employee/export4NoValue")
|
||||||
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
|
public Response exportEmployee4NoValue(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
|
AbnormalEmployeeListQueryParam queryParam = genAbnormalEmployeeListQueryParam(request);
|
||||||
|
XSSFWorkbook workbook = getTaxDeclareRecordWrapper(user).exportEmployee4NoValue(queryParam);
|
||||||
|
|
||||||
|
String fileName = SalaryI18nUtil.getI18nLabel(156421, "缺少申报数据的人员") + "-" + SalaryDateUtil.getFormatLocalDate(LocalDateTime.now());
|
||||||
|
try {
|
||||||
|
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
StreamingOutput output = outputStream -> {
|
||||||
|
workbook.write(outputStream);
|
||||||
|
outputStream.flush();
|
||||||
|
};
|
||||||
|
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
return Response.ok(output)
|
||||||
|
.header("Content-disposition", "attachment;filename=" + fileName)
|
||||||
|
.header("Cache-Control", "no-cache").build();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("缺少申报数据的人员导出异常", e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个税申报表申报数据-导出申报失败列表
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/employee/export4Fail")
|
||||||
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
|
public Response exportEmployee4Fail(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||||
|
try {
|
||||||
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
|
AbnormalEmployeeListQueryParam queryParam = genAbnormalEmployeeListQueryParam(request);
|
||||||
|
XSSFWorkbook workbook = getTaxDeclareRecordWrapper(user).exportEmployee4Fail(queryParam);
|
||||||
|
|
||||||
|
String fileName = SalaryI18nUtil.getI18nLabel(156422, "申报失败人员") + "-" + SalaryDateUtil.getFormatLocalDate(LocalDateTime.now());
|
||||||
|
try {
|
||||||
|
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
StreamingOutput output = outputStream -> {
|
||||||
|
workbook.write(outputStream);
|
||||||
|
outputStream.flush();
|
||||||
|
};
|
||||||
|
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
return Response.ok(output)
|
||||||
|
.header("Content-disposition", "attachment;filename=" + fileName)
|
||||||
|
.header("Cache-Control", "no-cache").build();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("申报失败人员导出异常", e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.compress.utils.Lists;
|
import org.apache.commons.compress.utils.Lists;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.math.NumberUtils;
|
import org.apache.commons.lang3.math.NumberUtils;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import weaver.general.Util;
|
import weaver.general.Util;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
|
|
@ -609,90 +610,43 @@ public class TaxDeclareRecordWrapper extends Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * 导出个税申报明细列表
|
* 导出个税申报明细列表
|
||||||
// *
|
*
|
||||||
// * @param queryParam
|
* @param queryParam
|
||||||
// * @return
|
* @return
|
||||||
// */
|
*/
|
||||||
// public Map<String, Object> exportTaxDeclarationValue(TaxDeclarationValueListQueryParam queryParam) {
|
public XSSFWorkbook exportTaxDeclarationValue(TaxDeclarationValueListQueryParam queryParam) {
|
||||||
// ExcelExportParam excelExportParam = new ExcelExportParam()
|
return getTaxDeclarationExcelService(user).exportTaxDeclarationValue(queryParam);
|
||||||
// .setBiz(String.valueOf(IdGenerator.generate()))
|
}
|
||||||
// .setModule(EntityType.hrmsalary.name())
|
|
||||||
// .setFunction("exportTaxDeclarationValue");
|
/**
|
||||||
// LocalRunnable localRunnable = new LocalRunnable() {
|
* 导出未报送的人员列表
|
||||||
// @Override
|
*
|
||||||
// public void execute() {
|
* @param queryParam
|
||||||
// getTaxDeclarationExcelService(user).exportTaxDeclarationValue(excelExportParam, queryParam, simpleEmployee);
|
* @return
|
||||||
// }
|
*/
|
||||||
// };
|
public XSSFWorkbook exportEmployee4NotDeclare(AbnormalEmployeeListQueryParam queryParam) {
|
||||||
// ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportTaxDeclarationValue", localRunnable);
|
return getTaxDeclarationExcelService(user).exportEmployee4NotDeclare(queryParam);
|
||||||
// return JsonUtil.parseMap(excelExportParam, Object.class);
|
}
|
||||||
// }
|
|
||||||
//
|
/**
|
||||||
// /**
|
* 导出没有申报数据的人员列表
|
||||||
// * 导出未报送的人员列表
|
*
|
||||||
// *
|
* @param queryParam
|
||||||
// * @param queryParam
|
* @return
|
||||||
// * @param simpleEmployee
|
*/
|
||||||
// * @return
|
public XSSFWorkbook exportEmployee4NoValue(AbnormalEmployeeListQueryParam queryParam) {
|
||||||
// */
|
return getTaxDeclarationExcelService(user).exportEmployee4NoValue(queryParam);
|
||||||
// public Map<String, Object> exportEmployee4NotDeclare(AbnormalEmployeeListQueryParam queryParam) {
|
}
|
||||||
// ExcelExportParam excelExportParam = new ExcelExportParam()
|
|
||||||
// .setBiz(String.valueOf(IdGenerator.generate()))
|
/**
|
||||||
// .setModule(EntityType.hrmsalary.name())
|
* 导出申报失败的人员列表
|
||||||
// .setFunction("exportEmployee4NotDeclare");
|
*
|
||||||
// LocalRunnable localRunnable = new LocalRunnable() {
|
* @param queryParam
|
||||||
// @Override
|
* @return
|
||||||
// public void execute() {
|
*/
|
||||||
// getTaxDeclarationExcelService(user).exportEmployee4NotDeclare(excelExportParam, queryParam, simpleEmployee);
|
public XSSFWorkbook exportEmployee4Fail(AbnormalEmployeeListQueryParam queryParam) {
|
||||||
// }
|
return getTaxDeclarationExcelService(user).exportEmployee4Fail(queryParam);
|
||||||
// };
|
}
|
||||||
// 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() {
|
|
||||||
// getTaxDeclarationExcelService(user).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() {
|
|
||||||
// getTaxDeclarationExcelService(user).exportEmployee4Fail(excelExportParam, queryParam, simpleEmployee);
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployee4Fail", localRunnable);
|
|
||||||
// return JsonUtil.parseMap(excelExportParam, Object.class);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue