package com.engine.salary.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.employeedeclare.dto.EmployeeDeclareListDTO;
import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareImportParam;
import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareListQueryParam;
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
import com.engine.salary.enums.employeedeclare.CardTypeEnum;
import com.engine.salary.enums.employeedeclare.EmploymentStatusEnum;
import com.engine.salary.enums.employeedeclare.EmploymentTypeEnum;
import com.engine.salary.service.EmployeeDeclareExcelService;
import com.engine.salary.service.EmployeeDeclareService;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.util.SalaryEnumUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.excel.ExcelSheetData;
import com.engine.salary.util.excel.ExcelUtil;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 人员报送(人员)导入导出
*
Copyright: Copyright (c) 2023
* Company: 泛微软件
*
* @author qiantao
* @version 1.0
**/
@Slf4j
public class EmployeeDeclareExcelServiceImpl extends Service implements EmployeeDeclareExcelService {
private EmployeeDeclareService getEmployeeDeclareService(User user) {
return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user);
}
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
// private ExtEmployeeService extEmployeeService;
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
@Override
public XSSFWorkbook exportTemplate(EmployeeDeclareImportParam importParam) {
// 查询人员
List employeeDeclares = Collections.emptyList();
if (StringUtils.equalsIgnoreCase(importParam.getExportData(), "true")) {
employeeDeclares = getEmployeeDeclareService(user).listByParam(importParam);
}
String yesI18 = SalaryI18nUtil.getI18nLabel(84967, "是");
String noI18 = SalaryI18nUtil.getI18nLabel(84968, "否");
List> rows = Lists.newArrayList();
for (EmployeeDeclarePO employeeDeclare : employeeDeclares) {
EmploymentStatusEnum employmentStatusEnum = SalaryEnumUtil.enumMatchByValue(employeeDeclare.getEmploymentStatus(), EmploymentStatusEnum.class);
EmploymentTypeEnum employmentTypeEnum = SalaryEnumUtil.enumMatchByValue(employeeDeclare.getEmploymentType(), EmploymentTypeEnum.class);
List