diff --git a/src/com/engine/salary/biz/AddUpDeductionBiz.java b/src/com/engine/salary/biz/AddUpDeductionBiz.java index ef512160b..14ba5933c 100644 --- a/src/com/engine/salary/biz/AddUpDeductionBiz.java +++ b/src/com/engine/salary/biz/AddUpDeductionBiz.java @@ -6,6 +6,7 @@ import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; import com.engine.salary.mapper.datacollection.AddUpDeductionMapper; +import com.engine.salary.util.SalaryI18nUtil; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.ibatis.session.SqlSession; @@ -31,7 +32,8 @@ public class AddUpDeductionBiz extends BaseBean { try { AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class); List list = mapper.list(param); - list = encryptUtil.decryptList(list, AddUpDeductionDTO.class); + encryptUtil.decryptList(list, AddUpDeductionDTO.class); + SalaryI18nUtil.i18nList(list); return list; } finally { sqlSession.close(); diff --git a/src/com/engine/salary/biz/AttendQuoteDataBiz.java b/src/com/engine/salary/biz/AttendQuoteDataBiz.java index 8af27e8ba..f3b456fdf 100644 --- a/src/com/engine/salary/biz/AttendQuoteDataBiz.java +++ b/src/com/engine/salary/biz/AttendQuoteDataBiz.java @@ -4,6 +4,7 @@ import com.engine.salary.entity.datacollection.dto.AttendQuoteDataBaseDTO; import com.engine.salary.entity.datacollection.param.AttendQuoteDataQueryParam; import com.engine.salary.entity.datacollection.po.AttendQuoteDataPO; import com.engine.salary.mapper.datacollection.AttendQuoteDataMapper; +import com.engine.salary.util.SalaryI18nUtil; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.ibatis.session.SqlSession; @@ -17,7 +18,8 @@ public class AttendQuoteDataBiz { SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); try { AttendQuoteDataMapper mapper = sqlSession.getMapper(AttendQuoteDataMapper.class); - return mapper.list(param); + List list = mapper.list(param); + return SalaryI18nUtil.i18nList(list); } finally { sqlSession.close(); } diff --git a/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionDTO.java b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionDTO.java index c44181818..b16ebacf6 100644 --- a/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionDTO.java +++ b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionDTO.java @@ -43,6 +43,7 @@ public class AddUpDeductionDTO { @ExcelProperty(index = 0) @SalaryTableColumn(text = "姓名", width = "10%", column = "username") @TableTitle(title = "姓名", dataIndex = "username", key = "username") + @I18n private String username; /** @@ -64,6 +65,7 @@ public class AddUpDeductionDTO { @ExcelProperty(index = 2) @SalaryTableColumn(text = "部门", width = "10%", column = "departmentName") @TableTitle(title = "部门", dataIndex = "departmentName", key = "departmentName") + @I18n private String departmentName; /** diff --git a/src/com/engine/salary/entity/datacollection/dto/AttendQuoteDataBaseDTO.java b/src/com/engine/salary/entity/datacollection/dto/AttendQuoteDataBaseDTO.java index e261a0f59..a3b7ea962 100644 --- a/src/com/engine/salary/entity/datacollection/dto/AttendQuoteDataBaseDTO.java +++ b/src/com/engine/salary/entity/datacollection/dto/AttendQuoteDataBaseDTO.java @@ -1,5 +1,6 @@ package com.engine.salary.entity.datacollection.dto; +import com.engine.salary.annotation.I18n; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -34,11 +35,13 @@ public class AttendQuoteDataBaseDTO { /** * 姓名 */ + @I18n private String username; /** * 部门 */ + @I18n private String departmentName; /** diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index 5817e89de..f2bf7b9d8 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -46,6 +46,7 @@ import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelComment; import com.engine.salary.util.excel.ExcelParseHelper; +import com.engine.salary.util.excel.ExcelSupport; import com.engine.salary.util.excel.ExcelUtil; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; @@ -54,6 +55,7 @@ import com.google.common.collect.Maps; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; +import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.file.ImageFileManager; @@ -67,6 +69,7 @@ import java.util.*; import java.util.stream.Collectors; import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY; +import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX; /** * 累计专项 @@ -700,12 +703,12 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction .map(TaxAgentManageRangeEmployeeDTO::getTaxAgentName).collect(Collectors.toList()); String name = declareMonthStr + " " + StringUtils.join(taxAgentNames, ","); LoggerContext loggerContext = new LoggerContext<>(); + loggerContext.setUser(user); loggerContext.setTargetName(name); loggerContext.setOperateType(OperateTypeEnum.CLEAR.getValue()); loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "一键清空")); loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "累计专项附加扣除") + "-" + SalaryI18nUtil .getI18nLabel(0, "一键清空:") + name); - loggerContext.setUser(user); SalaryElogConfig.addUpDeductionLoggerTemplate.write(loggerContext); } @@ -939,14 +942,17 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction Validate.notBlank(imageId, "imageId为空"); InputStream fileInputStream = null; + try { fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId)); - List addUpDeductions = ExcelParseHelper.parse2Map(fileInputStream, AddUpDeductionDTO.class, 0, 1, 14, "addUpDeductionTemplate.xlsx"); - apidatas.put("preview", addUpDeductions); + Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX); + apidatas.put("headers", ExcelSupport.getSheetHeader(sheet, 0)); + apidatas.put("list", ExcelParseHelper.parse2List(sheet, 1, 0)); + return apidatas; + } finally { IOUtils.closeQuietly(fileInputStream); } - return apidatas; } diff --git a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java index 5f503572d..9c7994261 100644 --- a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java @@ -41,6 +41,7 @@ import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelComment; import com.engine.salary.util.excel.ExcelParseHelper; +import com.engine.salary.util.excel.ExcelSupport; import com.engine.salary.util.excel.ExcelUtil; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; @@ -48,6 +49,7 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.file.ImageFileManager; @@ -63,6 +65,7 @@ import java.util.*; import java.util.stream.Collectors; import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY; +import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX; public class AddUpSituationServiceImpl extends Service implements AddUpSituationService { private EncryptUtil encryptUtil = new EncryptUtil(); @@ -507,12 +510,13 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation InputStream fileInputStream = null; try { fileInputStream = ImageFileManager.getInputStreamById(Integer.valueOf(imageId)); - List excelDates = ExcelParseHelper.parse2Map(fileInputStream, AddUpSituationDTO.class, 0, 1, 25, "template.xlsx"); - apidatas.put("preview", excelDates); + Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX); + apidatas.put("headers", ExcelSupport.getSheetHeader(sheet, 0)); + apidatas.put("list", ExcelParseHelper.parse2List(sheet, 1, 0)); + return apidatas; } finally { IOUtils.closeQuietly(fileInputStream); } - return apidatas; } diff --git a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java index 0a88f9b0d..6ac7b89cf 100644 --- a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java @@ -37,6 +37,7 @@ import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelComment; import com.engine.salary.util.excel.ExcelParseHelper; +import com.engine.salary.util.excel.ExcelSupport; import com.engine.salary.util.excel.ExcelUtil; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; @@ -45,6 +46,7 @@ import com.google.common.collect.Maps; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; +import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.file.ImageFileManager; @@ -59,6 +61,7 @@ import java.util.*; import java.util.stream.Collectors; import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY; +import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX; public class OtherDeductionServiceImpl extends Service implements OtherDeductionService { private EncryptUtil encryptUtil = new EncryptUtil(); @@ -165,12 +168,13 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction InputStream fileInputStream = null; try { fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId)); - List OtherDeductions = ExcelParseHelper.parse2Map(fileInputStream, OtherDeductionListDTO.class, 0, 1, 12, "OtherDeductionTemplate.xlsx"); - apidatas.put("preview", OtherDeductions); + Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX); + apidatas.put("headers", ExcelSupport.getSheetHeader(sheet, 0)); + apidatas.put("list", ExcelParseHelper.parse2List(sheet, 1, 0)); + return apidatas; } finally { IOUtils.closeQuietly(fileInputStream); } - return apidatas; } @@ -472,7 +476,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction public XSSFWorkbook export(OtherDeductionQueryParam param) { //获取操作按钮资源 - List> rowList = getExcelRowList(param,true); + List> rowList = getExcelRowList(param, true); // 记录日志 String name = SalaryI18nUtil.getI18nLabel(0, "导出"); @@ -1004,7 +1008,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction // 1.工作簿名称 String sheetName = SalaryI18nUtil.getI18nLabel(101604, "其他免税扣除导入模板"); //获取操作按钮资源 - List> rowList = getExcelRowList(param,param.isHasData()); + List> rowList = getExcelRowList(param, param.isHasData()); // 4.注释 List excelComments = Lists.newArrayList(); diff --git a/src/com/engine/salary/service/impl/SpecialAddDeductionServiceImpl.java b/src/com/engine/salary/service/impl/SpecialAddDeductionServiceImpl.java index a645ab054..cd8cc1c83 100644 --- a/src/com/engine/salary/service/impl/SpecialAddDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/SpecialAddDeductionServiceImpl.java @@ -37,6 +37,7 @@ import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelParseHelper; +import com.engine.salary.util.excel.ExcelSupport; import com.engine.salary.util.excel.ExcelUtil; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; @@ -44,6 +45,7 @@ import com.google.common.collect.Maps; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; +import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.file.ImageFileManager; @@ -57,6 +59,7 @@ import java.util.*; import java.util.stream.Collectors; import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY; +import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX; public class SpecialAddDeductionServiceImpl extends Service implements SpecialAddDeductionService { private EncryptUtil encryptUtil = new EncryptUtil(); @@ -162,14 +165,13 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd InputStream fileInputStream = null; try { fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId)); - List SpecialAddDeductions = - ExcelParseHelper.parse2Map(fileInputStream, SpecialAddDeductionListDTO.class, 0, 1, 14, - "SpecialAddDeductionTemplate.xlsx"); - apidatas.put("preview", SpecialAddDeductions); + Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX); + apidatas.put("headers", ExcelSupport.getSheetHeader(sheet, 0)); + apidatas.put("list", ExcelParseHelper.parse2List(sheet, 1, 0)); + return apidatas; } finally { IOUtils.closeQuietly(fileInputStream); } - return apidatas; }