薪资档案导入
This commit is contained in:
parent
4167cb55ee
commit
a8732708a8
|
|
@ -46,4 +46,15 @@ public class SalaryArchiveBiz {
|
|||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void batchInsert(List<SalaryArchivePO> salaryArchiveSaves) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalaryArchiveMapper mapper = sqlSession.getMapper(SalaryArchiveMapper.class);
|
||||
mapper.batchInsert(salaryArchiveSaves);
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,4 +106,15 @@ public class SalaryArchiveItemBiz {
|
|||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteBySalaryArchiveId(List<Long> salaryArchiveIds) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class);
|
||||
mapper.deleteBySalaryArchiveId(salaryArchiveIds);
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,52 @@ public class SalaryArchiveTaxAgentBiz {
|
|||
try {
|
||||
SalaryArchiveTaxAgentMapper mapper = sqlSession.getMapper(SalaryArchiveTaxAgentMapper.class);
|
||||
mapper.deleteBySalaryArchiveId(salaryArchiveIds);
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
public List<SalaryArchiveTaxAgentPO> getEffectiveTaxAgentList(SalaryArchiveTaxAgentQueryParam build) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalaryArchiveTaxAgentMapper mapper = sqlSession.getMapper(SalaryArchiveTaxAgentMapper.class);
|
||||
return mapper.getEffectiveTaxAgentList(build);
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
public List<SalaryArchiveTaxAgentPO> getIneffectiveTaxAgentList(SalaryArchiveTaxAgentQueryParam build) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalaryArchiveTaxAgentMapper mapper = sqlSession.getMapper(SalaryArchiveTaxAgentMapper.class);
|
||||
return mapper.getIneffectiveTaxAgentList(build);
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteBatchIds(List<Long> ids) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalaryArchiveTaxAgentMapper mapper = sqlSession.getMapper(SalaryArchiveTaxAgentMapper.class);
|
||||
mapper.deleteBatchIds(ids);
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void batchInsert(List<SalaryArchiveTaxAgentPO> salaryArchiveTaxAgentSaves) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalaryArchiveTaxAgentMapper mapper = sqlSession.getMapper(SalaryArchiveTaxAgentMapper.class);
|
||||
mapper.batchInsert(salaryArchiveTaxAgentSaves);
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class AddUpDeductionImportCmd extends AbstractCommonCommand<Map<String, O
|
|||
// }
|
||||
try {
|
||||
|
||||
List<AddUpDeductionDTO> addUpDeductions = ExcelParseHelper.parse(fileInputStream, AddUpDeductionDTO.class, 0, 1, 12, "addUpDeductionTemplate.xlsx");
|
||||
List<AddUpDeductionDTO> addUpDeductions = ExcelParseHelper.parse2Map(fileInputStream, AddUpDeductionDTO.class, 0, 1, 12, "addUpDeductionTemplate.xlsx");
|
||||
|
||||
int total = addUpDeductions.size();
|
||||
int index = 0;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class AddUpDeductionPreviewCmd extends AbstractCommonCommand<Map<String,
|
|||
// e.printStackTrace();
|
||||
// }
|
||||
try {
|
||||
List<AddUpDeductionDTO> addUpDeductions = ExcelParseHelper.parse(fileInputStream, AddUpDeductionDTO.class, 0, 1, 12, "addUpDeductionTemplate.xlsx");
|
||||
List<AddUpDeductionDTO> addUpDeductions = ExcelParseHelper.parse2Map(fileInputStream, AddUpDeductionDTO.class, 0, 1, 12, "addUpDeductionTemplate.xlsx");
|
||||
apidatas.put("preview", addUpDeductions);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(fileInputStream);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public class AddUpSituationImportCmd extends AbstractCommonCommand<Map<String, O
|
|||
// }
|
||||
try {
|
||||
|
||||
List<AddUpSituationDTO> excelDates = ExcelParseHelper.parse(fileInputStream, AddUpSituationDTO.class, 0, 1, 21, "template.xlsx");
|
||||
List<AddUpSituationDTO> excelDates = ExcelParseHelper.parse2Map(fileInputStream, AddUpSituationDTO.class, 0, 1, 21, "template.xlsx");
|
||||
|
||||
int total = excelDates.size();
|
||||
int index = 0;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class AddUpSituationPreviewCmd extends AbstractCommonCommand<Map<String,
|
|||
// e.printStackTrace();
|
||||
// }
|
||||
try {
|
||||
List<AddUpSituationDTO> excelDates = ExcelParseHelper.parse(fileInputStream, AddUpSituationDTO.class, 0, 1, 21, "template.xlsx");
|
||||
List<AddUpSituationDTO> excelDates = ExcelParseHelper.parse2Map(fileInputStream, AddUpSituationDTO.class, 0, 1, 21, "template.xlsx");
|
||||
apidatas.put("preview", excelDates);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(fileInputStream);
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class OtherDeductionImportCmd extends AbstractCommonCommand<Map<String, O
|
|||
// }
|
||||
try {
|
||||
|
||||
List<OtherDeductionListDTO> OtherDeductions = ExcelParseHelper.parse(fileInputStream, OtherDeductionListDTO.class, 0, 1, 11, "OtherDeductionTemplate.xlsx");
|
||||
List<OtherDeductionListDTO> OtherDeductions = ExcelParseHelper.parse2Map(fileInputStream, OtherDeductionListDTO.class, 0, 1, 11, "OtherDeductionTemplate.xlsx");
|
||||
|
||||
int total = OtherDeductions.size();
|
||||
int index = 0;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class OtherDeductionPreviewCmd extends AbstractCommonCommand<Map<String,
|
|||
// e.printStackTrace();
|
||||
// }
|
||||
try {
|
||||
List<OtherDeductionListDTO> OtherDeductions = ExcelParseHelper.parse(fileInputStream, OtherDeductionListDTO.class, 0, 1, 11, "OtherDeductionTemplate.xlsx");
|
||||
List<OtherDeductionListDTO> OtherDeductions = ExcelParseHelper.parse2Map(fileInputStream, OtherDeductionListDTO.class, 0, 1, 11, "OtherDeductionTemplate.xlsx");
|
||||
apidatas.put("preview", OtherDeductions);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(fileInputStream);
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ public class SalaryArchiveTaxAgentPO {
|
|||
//调整原因")
|
||||
private String adjustReason;
|
||||
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 个税扣缴义务人的主键id
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ alter table hrsa_salary_sob_emp_field modify id bigint auto_increment;
|
|||
alter table hrsa_salary_sob_adjust_rule modify id bigint auto_increment;
|
||||
alter table hrsa_salary_sob_check_rule modify id bigint auto_increment;
|
||||
alter table hrsa_salary_archive_dimission modify id bigint auto_increment;
|
||||
|
||||
alter table hrsa_salary_archive modify id bigint auto_increment;
|
||||
alter table hrsa_salary_archive_tax_agent modify id bigint auto_increment;
|
||||
alter table hrsa_salary_archive_item modify id bigint auto_increment;
|
||||
|
||||
|
||||
--福利方案主键自增增加
|
||||
|
|
|
|||
|
|
@ -73,16 +73,6 @@ public interface SalaryArchiveItemMapper {
|
|||
*/
|
||||
void batchInsert(@Param("collection") List<SalaryArchiveItemPO> salaryArchiveItemSaves);
|
||||
|
||||
/**
|
||||
* 分页查询薪资项目调整记录列表
|
||||
* @param page
|
||||
* @param param
|
||||
* @param salaryItemIds
|
||||
* @param tenantKey
|
||||
* @return
|
||||
*/
|
||||
// IPage<SalaryItemAdjustRecordListDTO> salaryItemAdjustRecordList(Page<SalaryItemAdjustRecordListDTO> page, @Param("param") SalaryItemAdjustRecordQueryParam param, @Param("salaryItemIds") List<Long> salaryItemIds, @Param("tenantKey") String tenantKey);
|
||||
|
||||
/**
|
||||
* 查询薪资项目调整记录列表
|
||||
* @param param
|
||||
|
|
@ -98,7 +88,8 @@ public interface SalaryArchiveItemMapper {
|
|||
|
||||
List<SalaryArchiveItemPO> getEffectiveSalaryItems(@Param("param") SalaryArchiveItemQueryParam build);
|
||||
|
||||
void deleteBatchIds(@Param("param") List<Long> effectiveSalaryItemDels);
|
||||
void deleteBatchIds(@Param("effectiveSalaryItemDels") List<Long> effectiveSalaryItemDels);
|
||||
|
||||
|
||||
void deleteBySalaryArchiveId(@Param("salaryArchiveIds") List<Long> salaryArchiveIds);
|
||||
}
|
||||
|
|
@ -920,7 +920,7 @@
|
|||
</if>
|
||||
<if test="param.salaryItemIds != null and param.salaryItemIds.size()>0">
|
||||
AND t.salary_item_id IN
|
||||
<foreach collection="param.ids" open="(" item="salaryItemId" separator="," close=")">
|
||||
<foreach collection="param.salaryItemIds" open="(" item="salaryItemId" separator="," close=")">
|
||||
#{param.salaryItemId}
|
||||
</foreach>
|
||||
</if>
|
||||
|
|
@ -944,7 +944,7 @@
|
|||
</if>
|
||||
<if test="param.salaryItemIds != null and param.salaryItemIds.size()>0">
|
||||
AND t.salary_item_id IN
|
||||
<foreach collection="param.ids" open="(" item="salaryItemId" separator="," close=")">
|
||||
<foreach collection="param.salaryItemIds" open="(" item="salaryItemId" separator="," close=")">
|
||||
#{param.salaryItemId}
|
||||
</foreach>
|
||||
</if>
|
||||
|
|
@ -965,5 +965,16 @@
|
|||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="deleteBySalaryArchiveId">
|
||||
UPDATE hrsa_salary_archive_item
|
||||
SET delete_type = 1
|
||||
WHERE delete_type = 0
|
||||
AND salary_archive_id IN
|
||||
<foreach collection="salaryArchiveIds" open="(" item="salaryArchiveId" separator="," close=")">
|
||||
#{salaryArchiveId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -2,7 +2,6 @@ package com.engine.salary.mapper.archive;
|
|||
|
||||
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO;
|
||||
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveQueryParam;
|
||||
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveEmployeePO;
|
||||
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
|
@ -74,14 +73,6 @@ public interface SalaryArchiveMapper {
|
|||
*/
|
||||
List<SalaryArchiveListDTO> list(@Param("param") SalaryArchiveQueryParam param);
|
||||
|
||||
/**
|
||||
* 分页查询薪资档案列表
|
||||
* @param page
|
||||
* @param param
|
||||
* @param tenantKey
|
||||
* @return
|
||||
*/
|
||||
// IPage<SalaryArchiveListDTO> list(Page<SalaryArchiveListDTO> page, @Param("param") SalaryArchiveQueryParam param);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -96,10 +87,5 @@ public interface SalaryArchiveMapper {
|
|||
*/
|
||||
void batchInsert(@Param("collection") List<SalaryArchivePO> salaryArchiveSaves);
|
||||
|
||||
/**
|
||||
* 员工信息列表
|
||||
* @return
|
||||
*/
|
||||
List<SalaryArchiveEmployeePO> listEmployee();
|
||||
|
||||
}
|
||||
|
|
@ -65,5 +65,17 @@ public interface SalaryArchiveTaxAgentMapper {
|
|||
|
||||
List<SalaryArchiveTaxAgentPO> listByParam(@Param("param") SalaryArchiveTaxAgentQueryParam build);
|
||||
|
||||
void deleteBySalaryArchiveId(List<Long> salaryArchiveIds);
|
||||
void deleteBySalaryArchiveId(@Param("collection")List<Long> salaryArchiveIds);
|
||||
|
||||
List<SalaryArchiveTaxAgentPO> getEffectiveTaxAgentList(SalaryArchiveTaxAgentQueryParam build);
|
||||
|
||||
List<SalaryArchiveTaxAgentPO> getIneffectiveTaxAgentList(SalaryArchiveTaxAgentQueryParam build);
|
||||
|
||||
void deleteBatchIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
* @param salaryArchiveTaxAgentSaves
|
||||
*/
|
||||
void batchInsert(@Param("collection") List<SalaryArchiveTaxAgentPO> salaryArchiveTaxAgentSaves);
|
||||
}
|
||||
|
|
@ -321,10 +321,120 @@
|
|||
SET delete_type = 1
|
||||
WHERE delete_type = 0
|
||||
AND salary_archive_id IN
|
||||
<foreach collection="salaryArchiveIds" open="(" item="salaryArchiveIds" separator="," close=")">
|
||||
#{salaryArchiveIds}
|
||||
<foreach collection="collection" open="(" item="salaryArchiveId" separator="," close=")">
|
||||
#{salaryArchiveId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getEffectiveTaxAgentList" resultMap="BaseResultMap"
|
||||
parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_salary_archive_tax_agent t
|
||||
WHERE delete_type = 0
|
||||
AND t.effective_time <= #{effectiveTime}
|
||||
ORDER BY t.effective_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getIneffectiveTaxAgentList" resultMap="BaseResultMap"
|
||||
parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_salary_archive_tax_agent t
|
||||
WHERE delete_type = 0
|
||||
AND t.effective_time >= #{effectiveTime}
|
||||
ORDER BY t.effective_time DESC
|
||||
</select>
|
||||
|
||||
<update id="deleteBatchIds">
|
||||
UPDATE hrsa_salary_archive_tax_agent
|
||||
SET delete_type = 1
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<sql id="salaryArchiveTaxAgentColumn">
|
||||
salary_archive_id
|
||||
,
|
||||
employee_id,
|
||||
effective_time,
|
||||
adjust_reason,
|
||||
tax_agent_id,
|
||||
operator,
|
||||
operate_time,
|
||||
create_time,
|
||||
update_time,
|
||||
creator,
|
||||
tenant_key
|
||||
</sql>
|
||||
|
||||
|
||||
<insert id="batchInsert">
|
||||
INSERT INTO hrsa_salary_archive_tax_agent (
|
||||
<include refid="salaryArchiveTaxAgentColumn"/>
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="collection" item="item" separator=",">
|
||||
(
|
||||
#{item.salaryArchiveId},
|
||||
#{item.employeeId},
|
||||
#{item.effectiveTime},
|
||||
#{item.adjustReason},
|
||||
#{item.taxAgentId},
|
||||
#{item.operator},
|
||||
#{item.operateTime},
|
||||
#{item.createTime},
|
||||
#{item.updateTime},
|
||||
#{item.creator},
|
||||
#{item.tenantKey}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchInsert" databaseId="oracle">
|
||||
INSERT INTO hrsa_salary_archive_tax_agent (
|
||||
<include refid="salaryArchiveTaxAgentColumn"/>
|
||||
)
|
||||
<foreach collection="collection" item="item" separator="union all">
|
||||
select
|
||||
#{item.salaryArchiveId},
|
||||
#{item.employeeId},
|
||||
#{item.effectiveTime},
|
||||
#{item.adjustReason},
|
||||
#{item.taxAgentId},
|
||||
#{item.operator},
|
||||
#{item.operateTime},
|
||||
#{item.createTime},
|
||||
#{item.updateTime},
|
||||
#{item.creator},
|
||||
#{item.tenantKey}
|
||||
from dual
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchInsert" databaseId="sqlserver">
|
||||
INSERT INTO hrsa_salary_archive_tax_agent (
|
||||
<include refid="salaryArchiveTaxAgentColumn"/>
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="collection" item="item" separator=",">
|
||||
(
|
||||
#{item.salaryArchiveId},
|
||||
#{item.employeeId},
|
||||
#{item.effectiveTime},
|
||||
#{item.adjustReason},
|
||||
#{item.taxAgentId},
|
||||
#{item.operator},
|
||||
#{item.operateTime},
|
||||
#{item.createTime},
|
||||
#{item.updateTime},
|
||||
#{item.creator},
|
||||
#{item.tenantKey}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -4,6 +4,7 @@ import com.engine.salary.common.LocalDateRange;
|
|||
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveDataDTO;
|
||||
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO;
|
||||
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveDimissionSaveParam;
|
||||
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveImportHandleParam;
|
||||
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveQueryParam;
|
||||
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveDimissionPO;
|
||||
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
|
||||
|
|
@ -86,9 +87,6 @@ public interface SalaryArchiveService {
|
|||
/**
|
||||
* 下载导入模板
|
||||
*
|
||||
* @param map
|
||||
* @param username
|
||||
* @param eteamsId
|
||||
* @param salaryArchiveImportTypeEnum
|
||||
* @param queryParam
|
||||
* @return
|
||||
|
|
@ -126,4 +124,10 @@ public interface SalaryArchiveService {
|
|||
* @return
|
||||
*/
|
||||
List<SalaryArchiveDataDTO> getSalaryArchiveTaxAgentData(LocalDateRange localDateRange, Collection<Long> employeeIds);
|
||||
|
||||
void importSalaryArchive(SalaryArchiveImportHandleParam param);
|
||||
|
||||
Map<String, Object> preview(SalaryArchiveImportHandleParam param);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -38,8 +38,8 @@ public class ExcelParseHelper {
|
|||
* @param standardCellNum 模板验证,该sheet应有多少列
|
||||
* @return
|
||||
*/
|
||||
public static <T> List<T> parse(MultipartFile file, Class<T> clazz, int sheetIndex, int rowIndex, int standardCellNum) {
|
||||
List<List<String>> result = parse(file, sheetIndex, rowIndex, standardCellNum);
|
||||
public static <T> List<T> parse2Map(MultipartFile file, Class<T> clazz, int sheetIndex, int rowIndex, int standardCellNum) {
|
||||
List<List<String>> result = parse2Map(file, sheetIndex, rowIndex, standardCellNum);
|
||||
List<T> list = new ArrayList<T>();
|
||||
for (List<String> rowDatas : result) {
|
||||
T t = setField(clazz, rowDatas);
|
||||
|
|
@ -59,8 +59,8 @@ public class ExcelParseHelper {
|
|||
* @param fileName 文件名
|
||||
* @return
|
||||
*/
|
||||
public static <T> List<T> parse(InputStream file, Class<T> clazz, int sheetIndex, int rowIndex, int standardCellNum, String fileName) {
|
||||
List<List<String>> result = parse(file, sheetIndex, rowIndex, standardCellNum, fileName);
|
||||
public static <T> List<T> parse2Map(InputStream file, Class<T> clazz, int sheetIndex, int rowIndex, int standardCellNum, String fileName) {
|
||||
List<List<String>> result = parse2Map(file, sheetIndex, rowIndex, standardCellNum, fileName);
|
||||
List<T> list = new ArrayList<T>();
|
||||
for (List<String> rowDatas : result) {
|
||||
T t = setField(clazz, rowDatas);
|
||||
|
|
@ -77,7 +77,7 @@ public class ExcelParseHelper {
|
|||
* @param rowIndex 从第几行开始解析,第一行为 0,依次类推
|
||||
* @return 二维数据集合
|
||||
*/
|
||||
private static List<List<String>> parse(MultipartFile file, int sheetIndex, int rowIndex, int standardCellNum) {
|
||||
private static List<List<String>> parse2Map(MultipartFile file, int sheetIndex, int rowIndex, int standardCellNum) {
|
||||
Sheet sheet = ExcelSupport.parseFile(file, sheetIndex);
|
||||
int rowCount = sheet.getPhysicalNumberOfRows(); // 总行数
|
||||
int cellCount = sheet.getRow(PARSE_EXCEL_ROW_VALID_CELL_INDEX).getPhysicalNumberOfCells(); // 总列数
|
||||
|
|
@ -103,7 +103,7 @@ public class ExcelParseHelper {
|
|||
* @param rowIndex 从第几行开始解析,第一行为 0,依次类推
|
||||
* @return 二维数据集合
|
||||
*/
|
||||
private static List<List<String>> parse(InputStream file, int sheetIndex, int rowIndex, int standardCellNum, String fileName) {
|
||||
private static List<List<String>> parse2Map(InputStream file, int sheetIndex, int rowIndex, int standardCellNum, String fileName) {
|
||||
Sheet sheet = ExcelSupport.parseFile(file, sheetIndex, fileName);
|
||||
int rowCount = sheet.getPhysicalNumberOfRows(); // 总行数
|
||||
int cellCount = sheet.getRow(PARSE_EXCEL_ROW_VALID_CELL_INDEX).getPhysicalNumberOfCells(); // 总列数
|
||||
|
|
@ -129,7 +129,7 @@ public class ExcelParseHelper {
|
|||
* @param rowIndex 从哪行开始解析
|
||||
* @return
|
||||
*/
|
||||
public static List<Map<String, Object>> parse(InputStream file, int sheetIndex, int rowIndex) {
|
||||
public static List<Map<String, Object>> parse2Map(InputStream file, int sheetIndex, int rowIndex) {
|
||||
Sheet sheet = ExcelSupport.parseFile(file, sheetIndex, EXCEL_TYPE_XLSX);
|
||||
int rowCount = sheet.getPhysicalNumberOfRows(); // 总行数
|
||||
int cellCount = sheet.getRow(PARSE_EXCEL_ROW_VALID_CELL_INDEX).getPhysicalNumberOfCells(); // 总列数
|
||||
|
|
@ -150,6 +150,51 @@ public class ExcelParseHelper {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* 将sheet数据转为map
|
||||
* @param rowIndex 从哪行开始解析
|
||||
* @return
|
||||
*/
|
||||
public static List<Map<String, Object>> parse2Map(Sheet sheet, int rowIndex) {
|
||||
int rowCount = sheet.getPhysicalNumberOfRows(); // 总行数
|
||||
int cellCount = sheet.getRow(PARSE_EXCEL_ROW_VALID_CELL_INDEX).getPhysicalNumberOfCells(); // 总列数
|
||||
|
||||
List<String> sheetHeader = ExcelSupport.getSheetHeader(sheet, PARSE_EXCEL_ROW_VALID_CELL_INDEX);
|
||||
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (; rowIndex < rowCount; rowIndex++) {
|
||||
Map<String, Object> cellResult = new HashMap<>();
|
||||
for (int j = 0; j < cellCount; j++) {
|
||||
String key = sheetHeader.get(j);
|
||||
cellResult.put(key, ExcelSupport.getCellValue(sheet, rowIndex, j));
|
||||
}
|
||||
result.add(cellResult);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将sheet数据转为List
|
||||
* @param rowIndex 从哪行开始解析
|
||||
* @return
|
||||
*/
|
||||
public static List<List<String>> parse2List(Sheet sheet, int rowIndex) {
|
||||
int rowCount = sheet.getPhysicalNumberOfRows(); // 总行数
|
||||
int cellCount = sheet.getRow(PARSE_EXCEL_ROW_VALID_CELL_INDEX).getPhysicalNumberOfCells(); // 总列数
|
||||
|
||||
List<List<String>> result = new ArrayList<List<String>>();
|
||||
for (; rowIndex < rowCount; rowIndex++) {
|
||||
List<String> cellResult = new ArrayList<String>();
|
||||
for (int j = 0; j < cellCount; j++) {
|
||||
cellResult.add(ExcelSupport.getCellValue(sheet, rowIndex, j));
|
||||
}
|
||||
result.add(cellResult);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 为对象的每一个属性赋值
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ package com.engine.salary.web;
|
|||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveDimissionSaveParam;
|
||||
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveImportHandleParam;
|
||||
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveQueryParam;
|
||||
import com.engine.salary.enums.salaryarchive.SalaryArchiveImportTypeEnum;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import com.engine.salary.wrapper.SalaryArchiveWrapper;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
|
|
@ -63,8 +65,6 @@ public class SalaryArchiveController {
|
|||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 薪资档案列表
|
||||
*
|
||||
|
|
@ -165,9 +165,12 @@ public class SalaryArchiveController {
|
|||
|
||||
XSSFWorkbook workbook = getSalaryArchiveWrapper(user).downloadTemplate(queryParam);
|
||||
|
||||
String fileName = null;
|
||||
SalaryArchiveImportTypeEnum importTypeEnum = SalaryArchiveImportTypeEnum.parseByValue(queryParam.getImportType());
|
||||
|
||||
String fileName = "薪资档案导入模板-" + importTypeEnum.getDefaultLabel();
|
||||
|
||||
try {
|
||||
fileName = URLEncoder.encode("累计情况.xlsx", "UTF-8");
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
@ -178,9 +181,7 @@ public class SalaryArchiveController {
|
|||
};
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output)
|
||||
.header("Content-disposition", "attachment;filename=" + fileName)
|
||||
.header("Cache-Control", "no-cache").build();
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
@ -221,17 +222,25 @@ public class SalaryArchiveController {
|
|||
return param;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 获取导入参数
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// @GetMapping("/getImportParams")
|
||||
// @ApiOperation("获取导入参数")
|
||||
// @WeaPermission
|
||||
// public WeaResult<ExcelImportParam> getImportParams() {
|
||||
// return WeaResult.success(salaryArchiveWrapper.getImportParams());
|
||||
// }
|
||||
|
||||
@POST
|
||||
@Path("/preview")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String preview(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryArchiveImportHandleParam importParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SalaryArchiveImportHandleParam, Map<String, Object>>().run(getSalaryArchiveWrapper(user)::preview, importParam);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/importSalaryArchive")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String importSalaryArchive(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryArchiveImportHandleParam importParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SalaryArchiveImportHandleParam, Map<String, Object>>().run(getSalaryArchiveWrapper(user)::importSalaryArchive, importParam);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// /******** 薪资档案主表 end ***********************************************************************************************/
|
||||
//
|
||||
// /******** 薪资项目调整 start ***********************************************************************************************/
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveBaseInfoFormDTO;
|
|||
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveFormDTO;
|
||||
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO;
|
||||
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveDimissionSaveParam;
|
||||
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveImportHandleParam;
|
||||
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveQueryParam;
|
||||
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveDimissionPO;
|
||||
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
|
||||
|
|
@ -21,6 +22,7 @@ import com.engine.salary.service.SalaryArchiveItemService;
|
|||
import com.engine.salary.service.SalaryArchiveService;
|
||||
import com.engine.salary.service.TaxAgentService;
|
||||
import com.engine.salary.service.impl.SalaryArchiveItemServiceImpl;
|
||||
import com.engine.salary.service.impl.SalaryArchiveServiceImpl;
|
||||
import com.engine.salary.service.impl.TaxAgentServiceImpl;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
|
|
@ -44,8 +46,7 @@ import java.util.stream.Collectors;
|
|||
public class SalaryArchiveWrapper extends Service {
|
||||
|
||||
private SalaryArchiveService getSalaryArchiveService(User user) {
|
||||
// return (SalaryArchiveService) ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
|
||||
return null;
|
||||
return (SalaryArchiveService) ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryArchiveItemService getSalaryArchiveItemService(User user) {
|
||||
|
|
@ -229,6 +230,16 @@ public class SalaryArchiveWrapper extends Service {
|
|||
|
||||
return getSalaryArchiveService(user).downloadTemplate(SalaryArchiveImportTypeEnum.parseByValue(queryParam.getImportType()), queryParam);
|
||||
}
|
||||
|
||||
public Map<String, Object> preview(SalaryArchiveImportHandleParam param) {
|
||||
return getSalaryArchiveService(user).preview(param);
|
||||
}
|
||||
|
||||
public void importSalaryArchive(SalaryArchiveImportHandleParam param) {
|
||||
getSalaryArchiveService(user).importSalaryArchive(param);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// /**
|
||||
// * 获取导入参数
|
||||
|
|
|
|||
Loading…
Reference in New Issue