2022-03-08 13:17:54 +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.AddUpSituationBiz;
|
2022-05-09 14:11:07 +08:00
|
|
|
import com.engine.salary.biz.EmployBiz;
|
2022-03-10 11:09:08 +08:00
|
|
|
import com.engine.salary.cmd.datacollection.*;
|
2022-04-11 20:17:47 +08:00
|
|
|
import com.engine.salary.entity.datacollection.AddUpSituation;
|
2022-05-09 14:11:07 +08:00
|
|
|
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
2022-04-28 17:44:26 +08:00
|
|
|
import com.engine.salary.entity.datacollection.dto.AddUpSituationDTO;
|
|
|
|
|
import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam;
|
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.AddUpSituationMapper;
|
2022-03-08 13:17:54 +08:00
|
|
|
import com.engine.salary.service.AddUpSituationService;
|
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-05-09 14:11:07 +08:00
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
2022-03-10 11:09:08 +08:00
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
2022-03-08 13:17:54 +08:00
|
|
|
|
2022-04-11 20:17:47 +08:00
|
|
|
import java.time.YearMonth;
|
2022-05-09 14:11:07 +08:00
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
2022-03-08 13:17:54 +08:00
|
|
|
|
|
|
|
|
public class AddUpSituationServiceImpl extends Service implements AddUpSituationService {
|
|
|
|
|
|
2022-04-28 17:44:26 +08:00
|
|
|
private AddUpSituationMapper getAddUpSituationMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(AddUpSituationMapper.class);
|
|
|
|
|
}
|
2022-04-11 20:17:47 +08:00
|
|
|
|
2022-03-08 13:17:54 +08:00
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> list(Map<String, Object> params) {
|
2022-03-09 16:40:14 +08:00
|
|
|
return commandExecutor.execute(new AddUpSituationListCmd(params, user));
|
2022-03-08 13:17:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-03-10 11:09:08 +08:00
|
|
|
public XSSFWorkbook export(Map<String, Object> params) {
|
2022-05-09 14:11:07 +08:00
|
|
|
AddUpSituationQueryParam queryParam = (AddUpSituationQueryParam) params.get("queryParam");
|
|
|
|
|
AddUpSituationBiz biz = new AddUpSituationBiz();
|
|
|
|
|
XSSFWorkbook workbook = biz.export(queryParam);
|
|
|
|
|
return workbook;
|
|
|
|
|
// return commandExecutor.execute(new AddUpSituationExportCmd(params, user));
|
2022-03-08 13:17:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
|
|
|
|
|
return commandExecutor.execute(new AddUpSituationGetSearchConditionCmd(params, user));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> importAddUpSituation(Map<String, Object> params) {
|
2022-03-09 18:58:30 +08:00
|
|
|
return commandExecutor.execute(new AddUpSituationImportCmd(params, user));
|
2022-03-08 13:17:54 +08:00
|
|
|
}
|
2022-03-10 11:09:08 +08:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public XSSFWorkbook exportDetail(Map<String, Object> params) {
|
2022-05-09 14:11:07 +08:00
|
|
|
AddUpSituationQueryParam queryParam = (AddUpSituationQueryParam) params.get("queryParam");
|
|
|
|
|
AddUpSituationBiz biz = new AddUpSituationBiz();
|
|
|
|
|
EmployBiz employBiz = new EmployBiz();
|
|
|
|
|
|
|
|
|
|
Long id = queryParam.getAccumulatedSituationId();
|
|
|
|
|
if (id == null) {
|
|
|
|
|
throw new SalaryRunTimeException("id不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AddUpSituation po = biz.getById(id);
|
|
|
|
|
if (po == null) {
|
2022-05-09 17:47:19 +08:00
|
|
|
throw new SalaryRunTimeException(String.format("累计情况不存在" + "[id:%s]", id));
|
2022-05-09 14:11:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<DataCollectionEmployee> employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId()));
|
|
|
|
|
if (CollectionUtils.isEmpty(employeeList)) {
|
|
|
|
|
throw new SalaryRunTimeException("员工信息不存在");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查询参数
|
|
|
|
|
queryParam.setEmployeeId(po.getEmployeeId());
|
|
|
|
|
//申报月份
|
|
|
|
|
List<String> taxYearMonths = queryParam.getTaxYearMonth();
|
|
|
|
|
if (CollectionUtils.isNotEmpty(taxYearMonths)) {
|
|
|
|
|
queryParam.setTaxYearMonth(taxYearMonths.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XSSFWorkbook workbook = biz.exportDetail(queryParam);
|
|
|
|
|
return workbook;
|
|
|
|
|
// return commandExecutor.execute(new AddUpSituationExportDetailCmd(params, user));
|
2022-03-10 11:09:08 +08:00
|
|
|
}
|
2022-03-10 17:57:46 +08:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getDetailList(Map<String, Object> params) {
|
|
|
|
|
return commandExecutor.execute(new AddUpSituationGetDetailListCmd(params, user));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> preview(Map<String, Object> params) {
|
|
|
|
|
return commandExecutor.execute(new AddUpSituationPreviewCmd(params, user));
|
|
|
|
|
}
|
2022-04-11 20:17:47 +08:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<AddUpSituation> getAddUpSituationList(YearMonth taxYearMonth, List<Long> employeeIds) {
|
|
|
|
|
if (taxYearMonth == null) {
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100353, "参数有误:税款所属期必传"));
|
|
|
|
|
}
|
|
|
|
|
AddUpSituationBiz biz = new AddUpSituationBiz();
|
|
|
|
|
return biz.listSome(AddUpSituation.builder().taxYearMonth(SalaryDateUtil.toDateStartOfMonth(taxYearMonth)).employeeIds(employeeIds).build());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean deleteAddUpSituationList(YearMonth taxYearMonth, List<Long> employeeIds) {
|
|
|
|
|
if (taxYearMonth == null) {
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100353, "参数有误:税款所属期必传"));
|
|
|
|
|
}
|
|
|
|
|
AddUpSituationBiz biz = new AddUpSituationBiz();
|
|
|
|
|
biz.deleteSome(AddUpSituation.builder().employeeIds(employeeIds).taxYearMonth(SalaryDateUtil.toDateStartOfMonth(taxYearMonth)).build());
|
|
|
|
|
return Boolean.TRUE;
|
|
|
|
|
}
|
2022-04-28 17:44:26 +08:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public XSSFWorkbook downloadTemplate(AddUpSituationQueryParam queryParam) {
|
2022-05-09 17:47:19 +08:00
|
|
|
String sheetName = SalaryI18nUtil.getI18nLabel(101605, "往期累计情况导入模板");
|
2022-04-28 17:44:26 +08:00
|
|
|
String[] header = {
|
2022-05-09 17:47:19 +08:00
|
|
|
SalaryI18nUtil.getI18nLabel(85429, "姓名"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86185, "部门"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86186, "手机号"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86317, "工号"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86318, "证件号码"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86319, "入职日期"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86712, "累计收入额"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86711, "累计减除费用"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86710, "累计社保个人合计"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86709, "累计公积金个人合计"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86321, "累计子女教育"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86323, "累计继续教育"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86324, "累计住房贷款利息"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86325, "累计住房租金"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86326, "累计赡养老人"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(105142, "累计大病医疗"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(90567, "累计企业(职业)年金及其他福利"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(93902, "累计其他免税扣除"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86704, "累计免税收入"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86703, "累计准予扣除的捐赠额"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(105478, "累计减免税额"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86702, "累计已预扣预缴税额")
|
2022-04-28 17:44:26 +08:00
|
|
|
};
|
|
|
|
|
// 2.表头
|
|
|
|
|
List<Object> headerList = Arrays.asList(header);
|
|
|
|
|
|
|
|
|
|
// 获取累计情况
|
|
|
|
|
List<AddUpSituationDTO> list = getAddUpSituationMapper().list(queryParam);
|
|
|
|
|
// 人员信息赋值
|
2022-05-09 17:47:19 +08:00
|
|
|
list.forEach(m -> {
|
2022-04-28 17:44:26 +08:00
|
|
|
// todo 身份证号
|
|
|
|
|
m.setIdNo(null);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
List<List<Object>> rows = new ArrayList<>();
|
2022-05-09 17:47:19 +08:00
|
|
|
rows.add(headerList);
|
2022-04-28 17:44:26 +08:00
|
|
|
for (AddUpSituationDTO 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());
|
2022-05-09 17:47:19 +08:00
|
|
|
row.add(dto.getHiredate() + "");
|
2022-04-28 17:44:26 +08:00
|
|
|
row.add(dto.getAddUpIncome());
|
|
|
|
|
row.add(dto.getAddUpSubtraction());
|
|
|
|
|
row.add(dto.getAddUpSocialSecurityTotal());
|
|
|
|
|
row.add(dto.getAddUpAccumulationFundTotal());
|
|
|
|
|
row.add(dto.getAddUpChildEducation());
|
|
|
|
|
row.add(dto.getAddUpContinuingEducation());
|
|
|
|
|
row.add(dto.getAddUpHousingLoanInterest());
|
|
|
|
|
row.add(dto.getAddUpHousingRent());
|
|
|
|
|
row.add(dto.getAddUpSupportElderly());
|
|
|
|
|
row.add(dto.getAddUpIllnessMedical());
|
|
|
|
|
row.add(dto.getAddUpEnterpriseAndOther());
|
|
|
|
|
row.add(dto.getAddUpOtherDeduction());
|
|
|
|
|
row.add(dto.getAddUpTaxExemptIncome());
|
|
|
|
|
row.add(dto.getAddUpAllowedDonation());
|
|
|
|
|
row.add(dto.getAddUpTaxSavings());
|
|
|
|
|
row.add(dto.getAddUpAdvanceTax());
|
|
|
|
|
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, 14, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
excelComments.add(new ExcelComment(10, 0, 15, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
excelComments.add(new ExcelComment(11, 0, 16, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
excelComments.add(new ExcelComment(12, 0, 17, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
excelComments.add(new ExcelComment(13, 0, 18, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
excelComments.add(new ExcelComment(14, 0, 19, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
excelComments.add(new ExcelComment(15, 0, 20, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
excelComments.add(new ExcelComment(16, 0, 21, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
excelComments.add(new ExcelComment(17, 0, 22, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
excelComments.add(new ExcelComment(18, 0, 23, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
excelComments.add(new ExcelComment(19, 0, 24, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
excelComments.add(new ExcelComment(20, 0, 25, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
excelComments.add(new ExcelComment(21, 0, 26, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
excelComments.add(new ExcelComment(22, 0, 27, 2, SalaryI18nUtil.getI18nLabel(100344, "输入数字")));
|
|
|
|
|
|
|
|
|
|
XSSFWorkbook book = ExcelUtil.genWorkbookV2(rows, sheetName, excelComments);
|
|
|
|
|
|
|
|
|
|
return book;
|
|
|
|
|
}
|
2022-05-09 17:47:19 +08:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean deleteByTaxYearMonthAndTaxAgentIds(YearMonth taxYearMonth, Collection<Long> taxAgentIds) {
|
|
|
|
|
if (taxYearMonth == null) {
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100353, "参数有误:税款所属期必传"));
|
|
|
|
|
}
|
|
|
|
|
Date date = SalaryDateUtil.localDateToDate(taxYearMonth.atDay(1));
|
|
|
|
|
|
|
|
|
|
getAddUpSituationMapper().deleteByTaxYearMonthAndTaxAgentIds(AddUpSituation.builder().taxYearMonth(date).taxAgentIds(taxAgentIds).build());
|
|
|
|
|
|
|
|
|
|
return Boolean.TRUE;
|
|
|
|
|
}
|
2022-03-08 13:17:54 +08:00
|
|
|
}
|