档案导入
This commit is contained in:
parent
bb665500ae
commit
758e64e6bc
|
|
@ -30,10 +30,6 @@ public class SalaryArchiveListDTO {
|
|||
@TableTitle(title = "id", dataIndex = "id", key = "id")
|
||||
private Long id;
|
||||
|
||||
// @WeaFormat(
|
||||
// label = "人员信息表的主键id",
|
||||
// tableColumn = @TableColumn(width = "20%")
|
||||
// )
|
||||
@TableTitle(title = "人员信息表的主键id", dataIndex = "employeeId", key = "employeeId")
|
||||
private Long employeeId;
|
||||
|
||||
|
|
@ -66,9 +62,4 @@ public class SalaryArchiveListDTO {
|
|||
*/
|
||||
@TableTitle(title = "员工状态", dataIndex = "employeeStatus", key = "employeeStatus")
|
||||
private String employeeStatus;
|
||||
//
|
||||
// /**
|
||||
// * 薪资项目调整id
|
||||
// */
|
||||
// private Long salaryArchiveItemId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
|
|||
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
|
||||
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.salaryarchive.SalaryArchiveImportTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -57,6 +58,11 @@ public class SalaryArchiveImportHandleParam {
|
|||
*/
|
||||
Collection<TaxAgentPO> taxAgentList;
|
||||
|
||||
/**
|
||||
* 管理的个税扣缴义务人和人员范围
|
||||
*/
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> listTaxAgentAndEmployeeTree;
|
||||
|
||||
/**
|
||||
* 获取所有可被引用的薪资项目
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -46,4 +46,6 @@ public class SalaryArchiveQueryParam extends BaseQueryParam {
|
|||
|
||||
//导入类型
|
||||
private String importType;
|
||||
|
||||
private Collection<Long> employeeIds;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,7 +194,16 @@
|
|||
</sql>
|
||||
|
||||
|
||||
<sql id="paramSql">
|
||||
<!-- 薪资档案列表 -->
|
||||
<select id="list" resultType="com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO">
|
||||
SELECT
|
||||
<include refid="salaryArchiveColumn"/>
|
||||
FROM
|
||||
hrsa_salary_archive t1
|
||||
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
||||
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
|
||||
WHERE t1.delete_type = 0
|
||||
|
||||
<if test="param.ids != null and param.ids.size()>0">
|
||||
AND t1.id IN
|
||||
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
||||
|
|
@ -205,10 +214,6 @@
|
|||
<if test="param.username != null and param.username != ''">
|
||||
AND e.lastname like CONCAT('%',#{param.username},'%')
|
||||
</if>
|
||||
<!-- 个税扣缴义务人id todo 业务上处理 -->
|
||||
<!-- <if test="param.taxAgentId != null">-->
|
||||
<!-- AND t4.id = #{param.taxAgentId}-->
|
||||
<!-- </if>-->
|
||||
<!-- 部门 -->
|
||||
<if test="param.departmentIds != null and param.departmentIds.size()>0">
|
||||
AND d.id IN
|
||||
|
|
@ -231,88 +236,7 @@
|
|||
<if test="param.hiredate != null and param.hiredate.size() == 2">
|
||||
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
|
||||
</if>
|
||||
</sql>
|
||||
<sql id="paramSql" databaseId="oracle">
|
||||
<if test="param.ids != null and param.ids.size()>0">
|
||||
AND t1.id IN
|
||||
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.username != null and param.username != ''">
|
||||
AND e.lastname like '%'||#{param.username}||'%'
|
||||
</if>
|
||||
|
||||
|
||||
<if test="param.departmentIds != null and param.departmentIds.size()>0">
|
||||
AND d.id IN
|
||||
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.positionIds != null and param.positionIds.size()>0">
|
||||
AND e.jobtitle IN
|
||||
<foreach collection="param.positionIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.userstatus != null and param.userstatus != ''">
|
||||
AND e.status = #{param.userstatus}
|
||||
</if>
|
||||
|
||||
<if test="param.hiredate != null and param.hiredate.size() == 2">
|
||||
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
|
||||
</if>
|
||||
</sql>
|
||||
<sql id="paramSql" databaseId="sqlserver">
|
||||
<if test="param.ids != null and param.ids.size()>0">
|
||||
AND t1.id IN
|
||||
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.username != null and param.username != ''">
|
||||
AND e.lastname like '%'+#{param.username}+'%'
|
||||
</if>
|
||||
|
||||
|
||||
<if test="param.departmentIds != null and param.departmentIds.size()>0">
|
||||
AND d.id IN
|
||||
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.positionIds != null and param.positionIds.size()>0">
|
||||
AND e.jobtitle IN
|
||||
<foreach collection="param.positionIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.userstatus != null and param.userstatus != ''">
|
||||
AND e.status = #{param.userstatus}
|
||||
</if>
|
||||
|
||||
<if test="param.hiredate != null and param.hiredate.size() == 2">
|
||||
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<!-- 薪资档案列表 -->
|
||||
<select id="list" resultType="com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO">
|
||||
SELECT
|
||||
<include refid="salaryArchiveColumn"/>
|
||||
FROM
|
||||
hrsa_salary_archive t1
|
||||
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
||||
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
|
||||
WHERE t1.delete_type = 0
|
||||
<include refid="paramSql"/>
|
||||
ORDER BY t1.id DESC
|
||||
</select>
|
||||
<select id="list" resultType="com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO" databaseId="oracle">
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public interface SalaryArchiveService {
|
|||
*/
|
||||
PageInfo<SalaryArchiveListDTO> listPage(SalaryArchiveQueryParam queryParam);
|
||||
|
||||
List<SalaryArchiveListDTO> list(SalaryArchiveQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 构建薪资档案数据
|
||||
*
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
|||
|
||||
Boolean adminEnable = getTaxAgentService(user).isAdminEnable(currentEmployeeId);
|
||||
//不是管理员看不到数据,返回空
|
||||
if(!adminEnable){
|
||||
if (!adminEnable) {
|
||||
PageInfo<SalaryArchiveListDTO> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), SalaryArchiveListDTO.class);
|
||||
return pageInfo;
|
||||
}
|
||||
|
|
@ -124,6 +124,31 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalaryArchiveListDTO> list(SalaryArchiveQueryParam queryParam) {
|
||||
long currentEmployeeId = user.getUID();
|
||||
|
||||
Boolean needAuth = getTaxAgentService(user).isNeedAuth(currentEmployeeId);
|
||||
if (needAuth) {
|
||||
|
||||
Boolean adminEnable = getTaxAgentService(user).isAdminEnable(currentEmployeeId);
|
||||
//不是管理员看不到数据,返回空
|
||||
if (!adminEnable) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
//获取管理的人员范围
|
||||
List<TaxAgentEmployeeDTO> taxAgentEmployeeDTOS = getTaxAgentService(user).listTaxAgentAndEmployee(currentEmployeeId);
|
||||
Set<Long> employeeId = SalaryEntityUtil.properties(taxAgentEmployeeDTOS, TaxAgentEmployeeDTO::getEmployeeId);
|
||||
//获取所有薪资档案
|
||||
List<SalaryArchiveListDTO> list = getSalaryArchiveMapper().list(queryParam);
|
||||
List<SalaryArchiveListDTO> finalAllArchive = list.stream().filter(dto -> employeeId.contains(dto.getEmployeeId())).collect(Collectors.toList());
|
||||
return finalAllArchive;
|
||||
} else {
|
||||
return getSalaryArchiveMapper().list(queryParam);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取薪资档案对应的当前生效的薪资项目
|
||||
*
|
||||
|
|
@ -247,7 +272,19 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
|||
Collection<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAll();
|
||||
Collection<SalaryArchiveListDTO> salaryArchives = salaryArchiveMapper.list(queryParam);
|
||||
|
||||
List<TaxAgentEmployeeDTO> taxAgentEmployeeDTOS = getTaxAgentService(user).listTaxAgentAndEmployee(employeeId);
|
||||
//分权
|
||||
Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId);
|
||||
if (needAuth) {
|
||||
Boolean adminEnable = getTaxAgentService(user).isAdminEnable(employeeId);
|
||||
if (!adminEnable) {
|
||||
salaryArchives = new ArrayList<>();
|
||||
} else {
|
||||
//管理范围内的人员
|
||||
List<TaxAgentEmployeeDTO> taxAgentEmployeeDTOS = getTaxAgentService(user).listTaxAgentAndEmployee(employeeId);
|
||||
Set<Long> employeeIds = SalaryEntityUtil.properties(taxAgentEmployeeDTOS, TaxAgentEmployeeDTO::getEmployeeId);
|
||||
salaryArchives = salaryArchives.stream().filter(salaryArchive -> employeeIds.contains(salaryArchive.getEmployeeId())).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
List<Map<String, Object>> listMaps = buildSalaryArchiveData(salaryArchives, taxAgentList, salaryItems, Boolean.FALSE);
|
||||
// 组装数据
|
||||
|
|
@ -560,19 +597,21 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
|||
* @return
|
||||
*/
|
||||
private SalaryArchiveImportHandleParam buildImportHandleParam() {
|
||||
long employeeId = user.getUID();
|
||||
// 获取所有可被引用的薪资项目
|
||||
List<SalaryItemPO> salaryItems = salaryItemMapper.getCanAdjustSalaryItems();
|
||||
|
||||
Collection<Long> salaryItemIds = salaryItems.stream().map(SalaryItemPO::getId).collect(Collectors.toList());
|
||||
Date now = new Date();
|
||||
return SalaryArchiveImportHandleParam.builder()
|
||||
.listTaxAgentAndEmployeeTree(getTaxAgentService(user).listTaxAgentAndEmployeeTree(employeeId))
|
||||
// 获取租户下所有的人员
|
||||
.employees(employBiz.listEmployee())
|
||||
// 获取所有个税扣缴义务人
|
||||
.taxAgentList(getTaxAgentService(user).listAll())
|
||||
.taxAgentList(getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId))
|
||||
.salaryItems(salaryItems)
|
||||
// 查询已有的薪资档案基本数据
|
||||
.salaryArchives(salaryArchiveMapper.list(SalaryArchiveQueryParam.builder().build()))
|
||||
.salaryArchives(list(SalaryArchiveQueryParam.builder().build()))
|
||||
.salaryItemIds(salaryItemIds)
|
||||
// 查询已生效的薪资项目数据
|
||||
.effectiveItemList(getEffectiveItemList(salaryItemIds))
|
||||
|
|
@ -911,12 +950,19 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
|||
Long taxAgentId, Date effectiveTime, SalaryArchivePO finalSalaryArchive, String taxAgentAdjustReason, SalaryArchiveImportHandleParam importHandleParam, Map<String, Object> map) {
|
||||
String rowindex = "第" + map.get("index") + "行";
|
||||
|
||||
Collection<TaxAgentPO> taxAgentList = importHandleParam.getTaxAgentList();
|
||||
Set<Long> taxAgents = SalaryEntityUtil.properties(taxAgentList, TaxAgentPO::getId);
|
||||
if (taxAgentId == null) {
|
||||
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100545, "个税扣缴义务人不存在"), errorCount + 1, errorCount + 1, j, j);
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", rowindex + "个税扣缴义务人不存在");
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
}else if(!taxAgents.contains(taxAgentId)){
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", rowindex + "没有该个税扣缴义务人的权限");
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
} else if (effectiveTime != null && finalSalaryArchive != null) {
|
||||
boolean isBeforeError = false;
|
||||
if (!isInit) {
|
||||
|
|
@ -1168,15 +1214,21 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
|||
}
|
||||
|
||||
private List<SalaryArchiveItemPO> getEffectiveItemList(Collection<Long> salaryItemIds) {
|
||||
long currentEmployeeId = user.getUID();
|
||||
// 没有薪资项目时,给个不存在的,否则加载所有不合理
|
||||
salaryItemIds = CollectionUtils.isEmpty(salaryItemIds) ? Collections.singletonList(0L) : salaryItemIds;
|
||||
if (CollectionUtils.isEmpty(salaryItemIds)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Date truncate = DateUtils.truncate(new Date(), Calendar.DATE);
|
||||
return salaryArchiveItemMapper.getEffectiveSalaryItems(SalaryArchiveItemQueryParam.builder().effectiveTime(truncate).salaryItemIds(salaryItemIds).build());
|
||||
}
|
||||
|
||||
private List<SalaryArchiveItemPO> getIneffectiveItemList(Collection<Long> salaryItemIds) {
|
||||
long currentEmployeeId = user.getUID();
|
||||
// 没有薪资项目时,给个不存在的,否则加载所有不合理
|
||||
salaryItemIds = CollectionUtils.isEmpty(salaryItemIds) ? Collections.singletonList(0L) : salaryItemIds;
|
||||
if (CollectionUtils.isEmpty(salaryItemIds)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Date truncate = DateUtils.truncate(new Date(), Calendar.DATE);
|
||||
return salaryArchiveItemMapper.getIneffectiveSalaryItems(SalaryArchiveItemQueryParam.builder().salaryItemIds(salaryItemIds).effectiveTime(truncate).build());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue