导入功能

This commit is contained in:
钱涛 2023-12-28 15:36:27 +08:00
parent 4e0a5b4b7f
commit fefb8264c8
6 changed files with 74 additions and 11 deletions

View File

@ -2,6 +2,7 @@ package com.engine.salary.entity.taxdeclaration.dto;
import com.engine.salary.annotation.TableTitle;
import com.engine.salary.enums.employeedeclare.DeclareStatusEnum;
import com.engine.salary.util.excel.ExcelHead;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
@ -32,18 +33,22 @@ public class AbnormalEmployeeListDTO {
//姓名")
@TableTitle(title = "姓名",dataIndex = "employeeName",key = "employeeName")
@ExcelHead(title = "姓名",dataIndex = "employeeName")
private String employeeName;
//工号")
@TableTitle(title = "工号",dataIndex = "jobNum",key = "jobNum")
@ExcelHead(title = "工号",dataIndex = "jobNum")
private String jobNum;
//证件类型")
@TableTitle(title = "证件类型",dataIndex = "cardType",key = "cardType")
@ExcelHead(title = "证件类型",dataIndex = "cardType")
private String cardType;
//证件号码")
@TableTitle(title = "证件号码",dataIndex = "cardNum",key = "cardNum")
@ExcelHead(title = "证件号码",dataIndex = "cardNum")
private String cardNum;
//报送状态")
@ -51,5 +56,6 @@ public class AbnormalEmployeeListDTO {
//报送状态")
@TableTitle(title = "报送状态",dataIndex = "declareStatusDesc",key = "declareStatusDesc")
@ExcelHead(title = "报送状态",dataIndex = "declareStatusDesc")
private String declareStatusDesc;
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.taxdeclaration.dto;
import com.engine.salary.annotation.TableTitle;
import com.engine.salary.util.excel.ExcelHead;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
@ -23,7 +24,8 @@ public class FailEmployeeListDTO {
private Long id;
//姓名
@TableTitle(title = "姓名",dataIndex = "employeeName",key = "employeeName")
@TableTitle(title = "姓名", dataIndex = "employeeName", key = "employeeName")
@ExcelHead(title = "姓名", dataIndex = "employeeName")
private String employeeName;
//个税扣缴义务人id
@ -31,18 +33,22 @@ public class FailEmployeeListDTO {
private Long taxAgentId;
//个税扣缴义务人名称
@TableTitle(title = "个税扣缴义务人名称",dataIndex = "taxAgentName",key = "taxAgentName")
@TableTitle(title = "个税扣缴义务人名称", dataIndex = "taxAgentName", key = "taxAgentName")
@ExcelHead(title = "个税扣缴义务人名称", dataIndex = "taxAgentName")
private String taxAgentName;
//证件号码
@TableTitle(title = "证件号码",dataIndex = "cardNum",key = "cardNum")
@TableTitle(title = "证件号码", dataIndex = "cardNum", key = "cardNum")
@ExcelHead(title = "证件号码", dataIndex = "cardNum")
private String cardNum;
//失败原因
@TableTitle(title = "失败原因",dataIndex = "errorMsg",key = "errorMsg")
@TableTitle(title = "失败原因", dataIndex = "errorMsg", key = "errorMsg")
@ExcelHead(title = "失败原因", dataIndex = "errorMsg")
private String errorMsg;
//所得项目
@TableTitle(title = "所得项目",dataIndex = "incomeCategory",key = "incomeCategory")
@TableTitle(title = "所得项目", dataIndex = "incomeCategory", key = "incomeCategory")
@ExcelHead(title = "所得项目", dataIndex = "incomeCategory")
private String incomeCategory;
}

View File

@ -3,7 +3,6 @@ package com.engine.salary.service.impl;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.entity.taxdeclaration.dto.AbnormalEmployeeListDTO;
import com.engine.salary.entity.taxdeclaration.dto.FailEmployeeListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationValueListDTO;
@ -13,6 +12,7 @@ import com.engine.salary.entity.taxdeclaration.po.*;
import com.engine.salary.service.*;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.excel.ExcelHead;
import com.engine.salary.util.excel.ExcelSheetData;
import com.engine.salary.util.excel.ExcelUtil;
import com.google.common.collect.Lists;
@ -168,11 +168,11 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar
private <T> void parseHeader(Class<T> clazz, List<Object> headerList, List<String> dataIndexList) {
Field[] declaredFields = clazz.getDeclaredFields();
for (Field declaredField : declaredFields) {
if (!declaredField.isAnnotationPresent(SalaryTableColumn.class)) {
if (!declaredField.isAnnotationPresent(ExcelHead.class)) {
continue;
}
SalaryTableColumn annotation = declaredField.getAnnotation(SalaryTableColumn.class);
headerList.add(SalaryI18nUtil.getI18nLabel(annotation.labelId(), annotation.text()));
ExcelHead annotation = declaredField.getAnnotation(ExcelHead.class);
headerList.add(SalaryI18nUtil.getI18nLabel(annotation.labelId(), annotation.title()));
dataIndexList.add(declaredField.getName());
}
}

View File

@ -23,6 +23,7 @@ import com.engine.salary.enums.sicategory.DeleteTypeEnum;
import com.engine.salary.enums.taxdeclaration.SourceEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationValueMapper;
import com.engine.salary.mapper.taxdeclaration.TaxDeclareRecordMapper;
import com.engine.salary.service.*;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryEntityUtil;
@ -56,6 +57,10 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
return MapperProxyFactory.getProxy(TaxDeclarationValueMapper.class);
}
private TaxDeclareRecordMapper getTaxDeclareRecordMapper() {
return MapperProxyFactory.getProxy(TaxDeclareRecordMapper.class);
}
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
@ -151,10 +156,16 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
throw new SalaryRunTimeException("个税申报表不存在!");
}
Long taxDeclareRecordId = taxDeclaration.getTaxDeclareRecordId();
TaxDeclareRecordPO declareRecordPO = getTaxDeclareRecordMapper().getById(taxDeclareRecordId);
if (declareRecordPO == null) {
throw new SalaryRunTimeException("个税申报记录不存在!");
}
TaxDeclarationValuePO po = TaxDeclarationValuePO.builder()
.id(IdGenerator.generate())
.taxDeclarationId(param.getTaxDeclarationId())
.taxDeclareRecordId(taxDeclaration.getTaxDeclareRecordId())
.taxDeclareRecordId(taxDeclareRecordId)
.employeeId(param.getEmployeeId())
.employeeType(param.getEmployeeType())
.resultValue(param.getTaxReportColumnValues())
@ -167,9 +178,12 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
encryptUtil.encrypt(po, TaxDeclarationValuePO.class);
getTaxDeclarationValueMapper().insertIgnoreNull(po);
//新增年终奖
if (IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue().equals(taxDeclaration.getIncomeCategory())) {
autoAddWagesDeclare(declareRecordPO);
}
}
@Override

View File

@ -309,6 +309,12 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
}
}
//补充正常工资薪金的申报人员
newTaxDeclareRecords.forEach(taxDeclareRecordPO -> {
getTaxDeclarationValueService(user).autoAddWagesDeclare(taxDeclareRecordPO);
});
//更新核算记录状态
getSalaryAcctRecordService(user).updateStatusByIds(salaryAcctRecordIds, SalaryAcctRecordStatusEnum.DECLARED);
// // 记录日志

View File

@ -653,4 +653,35 @@ public class TaxDeclarationController {
}
}
// @POST
// @Path("/downloadTemplate")
// @Produces(MediaType.APPLICATION_OCTET_STREAM)
// public Response getAll(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody DownloadTemplateParam param) {
// try {
// User user = HrmUserVarify.getUser(request, response);
//
//
// XSSFWorkbook workbook = getTaxDeclareRecordWrapper(user).downloadTemplate(queryParam);
//
// String fileName = "往期累计情况导入模板" + LocalDate.now();
//
// try {
// fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
// } catch (UnsupportedEncodingException e) {
// log.error(e.getMessage(), e);
// }
//
// 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;
// }
// }
}