2022-03-03 13:50:03 +08:00
|
|
|
|
package com.engine.salary.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import com.engine.core.impl.Service;
|
2022-04-11 20:17:47 +08:00
|
|
|
|
import com.engine.salary.biz.AddUpDeductionBiz;
|
2022-03-08 15:40:26 +08:00
|
|
|
|
import com.engine.salary.cmd.datacollection.*;
|
2022-04-11 20:17:47 +08:00
|
|
|
|
import com.engine.salary.entity.datacollection.AddUpDeduction;
|
2022-04-28 17:44:26 +08:00
|
|
|
|
import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO;
|
|
|
|
|
|
import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam;
|
2022-04-11 20:17:47 +08:00
|
|
|
|
import com.engine.salary.exception.SalaryRunTimeException;
|
2022-04-28 17:44:26 +08:00
|
|
|
|
import com.engine.salary.mapper.datacollection.AddUpDeductionMapper;
|
2022-03-03 13:50:03 +08:00
|
|
|
|
import com.engine.salary.service.AddUpDeductionService;
|
2022-04-11 20:17:47 +08:00
|
|
|
|
import com.engine.salary.util.SalaryDateUtil;
|
|
|
|
|
|
import com.engine.salary.util.SalaryI18nUtil;
|
2022-04-28 17:44:26 +08:00
|
|
|
|
import com.engine.salary.util.db.MapperProxyFactory;
|
|
|
|
|
|
import com.engine.salary.util.excel.ExcelComment;
|
|
|
|
|
|
import com.engine.salary.util.excel.ExcelUtil;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
2022-03-10 11:09:08 +08:00
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
2022-03-03 13:50:03 +08:00
|
|
|
|
|
2022-04-11 20:17:47 +08:00
|
|
|
|
import java.time.YearMonth;
|
2022-04-28 17:44:26 +08:00
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
import java.util.Arrays;
|
2022-04-11 20:17:47 +08:00
|
|
|
|
import java.util.List;
|
2022-03-03 13:50:03 +08:00
|
|
|
|
import java.util.Map;
|
2022-04-28 17:44:26 +08:00
|
|
|
|
import java.util.stream.Collectors;
|
2022-03-03 13:50:03 +08:00
|
|
|
|
|
|
|
|
|
|
public class AddUpDeductionServiceImpl extends Service implements AddUpDeductionService {
|
|
|
|
|
|
|
2022-04-28 17:44:26 +08:00
|
|
|
|
private AddUpDeductionMapper getAddUpDeductionMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(AddUpDeductionMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-03 13:50:03 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> list(Map<String, Object> params) {
|
2022-03-07 15:08:56 +08:00
|
|
|
|
return commandExecutor.execute(new AddUpDeductionListCmd(params, user));
|
2022-03-03 13:50:03 +08:00
|
|
|
|
}
|
2022-03-04 10:10:38 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-03-10 11:09:08 +08:00
|
|
|
|
public XSSFWorkbook export(Map<String, Object> params) {
|
2022-03-07 15:08:56 +08:00
|
|
|
|
return commandExecutor.execute(new AddUpDeductionExportCmd(params, user));
|
2022-03-04 10:10:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
|
2022-03-07 15:08:56 +08:00
|
|
|
|
return commandExecutor.execute(new AddUpDeductionGetSearchConditionCmd(params, user));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> importAddUpDeduction(Map<String, Object> params) {
|
|
|
|
|
|
return commandExecutor.execute(new AddUpDeductionImportCmd(params, user));
|
2022-03-04 10:10:38 +08:00
|
|
|
|
}
|
2022-03-08 15:40:26 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> getDetailList(Map<String, Object> params) {
|
|
|
|
|
|
return commandExecutor.execute(new AddUpDeductionGetDetailListCmd(params, user));
|
|
|
|
|
|
}
|
2022-03-09 16:40:14 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> preview(Map<String, Object> params) {
|
|
|
|
|
|
return commandExecutor.execute(new AddUpDeductionPreviewCmd(params, user));
|
|
|
|
|
|
}
|
2022-03-10 11:09:08 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public XSSFWorkbook exportDetail(Map<String, Object> params) {
|
|
|
|
|
|
return commandExecutor.execute(new AddUpDeductionExportDetailCmd(params, user));
|
|
|
|
|
|
}
|
2022-04-11 20:17:47 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public List<AddUpDeduction> getAddUpDeductionList(YearMonth declareMonth, List<Long> employeeIds) {
|
|
|
|
|
|
AddUpDeductionBiz addUpDeductionBiz = new AddUpDeductionBiz();
|
|
|
|
|
|
if (declareMonth == null) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100342, "参数有误:申报月份、租户key必传"));
|
|
|
|
|
|
}
|
|
|
|
|
|
return addUpDeductionBiz.listSome(AddUpDeduction.builder().declareMonth(SalaryDateUtil.toDateStartOfMonth(declareMonth)).employeeIds(employeeIds).build());
|
|
|
|
|
|
}
|
2022-04-28 17:44:26 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public XSSFWorkbook downloadTemplate(AddUpDeductionQueryParam queryParam) {
|
|
|
|
|
|
|
|
|
|
|
|
String sheetName = SalaryI18nUtil.getI18nLabel(101603, "累计专项附加扣除导入模板");
|
|
|
|
|
|
String[] header = {
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(85429, "姓名"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86185, "部门"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86186, "手机号"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86317, "工号"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86318, "证件号码"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86319, "入职日期"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86321, "累计子女教育"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86323, "累计继续教育"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86324, "累计住房贷款利息"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86325, "累计住房租金"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86326, "累计赡养老人"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(105142, "累计大病医疗")
|
|
|
|
|
|
};
|
|
|
|
|
|
List<Object> headerList = Arrays.asList(header);
|
|
|
|
|
|
// 2.表头
|
|
|
|
|
|
if (queryParam.getDeclareMonth() != null) {
|
|
|
|
|
|
queryParam.setDeclareMonth(queryParam.getDeclareMonth().stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
|
|
|
|
|
|
}
|
|
|
|
|
|
// 获取累计专项附加扣除
|
|
|
|
|
|
List<AddUpDeductionDTO> list = getAddUpDeductionMapper().list(queryParam);
|
|
|
|
|
|
// 人员信息赋值
|
|
|
|
|
|
list.forEach(m -> {
|
|
|
|
|
|
// todo 身份证号
|
|
|
|
|
|
m.setIdNo("");
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
List<List<Object>> rows = new ArrayList<>();
|
|
|
|
|
|
rows.add(headerList);
|
|
|
|
|
|
for (AddUpDeductionDTO dto : list) {
|
|
|
|
|
|
List<Object> row = new ArrayList<>();
|
|
|
|
|
|
row.add(dto.getUsername());
|
|
|
|
|
|
row.add(dto.getTaxAgentName());
|
|
|
|
|
|
row.add(dto.getDepartmentName());
|
|
|
|
|
|
row.add(dto.getMobile());
|
|
|
|
|
|
row.add(dto.getJobNum());
|
|
|
|
|
|
row.add(dto.getIdNo());
|
|
|
|
|
|
row.add(dto.getHiredate());
|
|
|
|
|
|
row.add(dto.getAddUpChildEducation());
|
|
|
|
|
|
row.add(dto.getAddUpContinuingEducation());
|
|
|
|
|
|
row.add(dto.getAddUpHousingLoanInterest());
|
|
|
|
|
|
row.add(dto.getAddUpHousingRent());
|
|
|
|
|
|
row.add(dto.getAddUpSupportElderly());
|
|
|
|
|
|
row.add(dto.getAddUpIllnessMedical());
|
|
|
|
|
|
rows.add(row);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 4.注释
|
|
|
|
|
|
List<ExcelComment> excelComments = Lists.newArrayList();
|
|
|
|
|
|
excelComments.add(new ExcelComment(0, 0, 3, 2, SalaryI18nUtil.getI18nLabel(100344, "必填")));
|
|
|
|
|
|
excelComments.add(new ExcelComment(1, 0, 4, 2, SalaryI18nUtil.getI18nLabel(100344, "必填")));
|
|
|
|
|
|
excelComments.add(new ExcelComment(7, 0, 10, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
|
excelComments.add(new ExcelComment(8, 0, 11, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
|
excelComments.add(new ExcelComment(9, 0, 12, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
|
excelComments.add(new ExcelComment(10, 0, 13, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
|
excelComments.add(new ExcelComment(11, 0, 14, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
|
excelComments.add(new ExcelComment(12, 0, 15, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
XSSFWorkbook book = ExcelUtil.genWorkbookV2(rows, sheetName, excelComments);
|
|
|
|
|
|
|
|
|
|
|
|
return book;
|
|
|
|
|
|
}
|
2022-03-03 13:50:03 +08:00
|
|
|
|
}
|