自动同步结束发薪日期temp
This commit is contained in:
parent
c1db3883b0
commit
c1893f9152
|
|
@ -161,4 +161,13 @@ public class EmployBiz extends BaseBean {
|
|||
}
|
||||
}
|
||||
|
||||
public List<DataCollectionEmployee> listByDismissDate(String dismissDate) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
|
||||
return mapper.listByDismissDate(dismissDate);
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,4 +131,6 @@ public interface SalaryArchiveMapper {
|
|||
void deleteSuspendTodo(@Param("ids") Collection<Long> ids);
|
||||
|
||||
void deleteByIds(@Param("ids")Collection<Long> deleteIds);
|
||||
|
||||
List<SalaryArchivePO> listPayEndDateIsNull(@Param("ids")List<Long> employeeIds);
|
||||
}
|
||||
|
|
@ -661,6 +661,18 @@
|
|||
WHERE run_status is null
|
||||
</select>
|
||||
|
||||
<select id="listPayEndDateIsNull" resultType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_salary_archive t
|
||||
WHERE t.delete_type=0
|
||||
AND pay_end_date is null
|
||||
AND employee_id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<update id="updateStatus" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
||||
UPDATE hrsa_salary_archive
|
||||
<set>
|
||||
|
|
|
|||
|
|
@ -102,4 +102,10 @@ public interface EmployMapper {
|
|||
* 根据部门id查询部门
|
||||
*/
|
||||
DeptInfo getDeptInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 获取大于离职日期的人员信息
|
||||
* @return
|
||||
*/
|
||||
List<DataCollectionEmployee> listByDismissDate(String dismissDate);
|
||||
}
|
||||
|
|
@ -372,4 +372,17 @@
|
|||
from hrmdepartment d
|
||||
where d.id = #{id}
|
||||
</select>
|
||||
<select id="listByDismissDate" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
|
||||
select e.id as employeeId,
|
||||
e.lastname as username,
|
||||
e.status as status,
|
||||
e.certificatenum as idNo,
|
||||
e.workcode as workcode,
|
||||
e.companystartdate as companystartdate,
|
||||
e.mobile as mobile,
|
||||
e.enddate as dismissdate,
|
||||
from hrmresource e
|
||||
where e.status not in (7)
|
||||
AND e.enddate >= #{dismissDate}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -233,4 +233,11 @@ public interface SalaryArchiveService {
|
|||
* @param salaryArchiveIds
|
||||
*/
|
||||
void deleteSalaryArchive(Collection<Long> salaryArchiveIds);
|
||||
|
||||
/**
|
||||
* 根据人员id查询薪资档案
|
||||
* @param employeeIds
|
||||
* @return
|
||||
*/
|
||||
List<SalaryArchivePO> listPayEndDateIsNull(List<Long> employeeIds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,9 @@ import com.engine.salary.entity.hrm.PositionInfo;
|
|||
import com.engine.salary.entity.hrm.SubCompanyInfo;
|
||||
import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
|
||||
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
|
||||
import com.engine.salary.entity.hrm.DeptInfo;
|
||||
import com.engine.salary.entity.hrm.PositionInfo;
|
||||
import com.engine.salary.entity.hrm.SubCompanyInfo;
|
||||
import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 人员信息
|
||||
|
|
@ -97,4 +94,9 @@ public interface SalaryEmployeeService {
|
|||
|
||||
List<DataCollectionEmployee> listByParams(List<SalarySobRangeEmpQueryParam> includeQueryParams);
|
||||
|
||||
/**
|
||||
* 根据离职日期获取离职信息
|
||||
* @param formatDate
|
||||
*/
|
||||
Map<Long, String> getResignationMapByDate(String formatDate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1285,4 +1285,11 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalaryArchivePO> listPayEndDateIsNull(List<Long> employeeIds) {
|
||||
if (CollectionUtils.isEmpty(employeeIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return getSalaryArchiveMapper().listPayEndDateIsNull(employeeIds);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,4 +269,18 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据离职日期获取离职信息
|
||||
* @param dismissDate
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<Long, String> getResignationMapByDate(String dismissDate) {
|
||||
if (StringUtils.isBlank(dismissDate)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
List<DataCollectionEmployee> employeeList = employBiz.listByDismissDate(dismissDate);
|
||||
return SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getDismissdate);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
package com.engine.salary.timer;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
|
||||
import com.engine.salary.mapper.archive.SalaryArchiveMapper;
|
||||
import com.engine.salary.service.SalaryArchiveService;
|
||||
import com.engine.salary.service.SalaryEmployeeService;
|
||||
import com.engine.salary.service.impl.SalaryArchiveServiceImpl;
|
||||
import com.engine.salary.service.impl.SalaryEmployeeServiceImpl;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName AutoSyncInsuranceArchiveJob
|
||||
* @date 2023/08/14 9:30
|
||||
* @description 自动同步离职人员社保福利档案内容
|
||||
*/
|
||||
public class AutoSyncResignationEmpArchiveJob extends BaseCronJob {
|
||||
|
||||
private SalaryArchiveService getSalaryArchiveService(User user) {
|
||||
return ServiceUtil.getService(SalaryArchiveServiceImpl.class,user);
|
||||
}
|
||||
|
||||
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
||||
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class,user);
|
||||
}
|
||||
|
||||
private SalaryArchiveMapper getSalaryArchiveMapper() {
|
||||
return MapperProxyFactory.getProxy(SalaryArchiveMapper.class);
|
||||
}
|
||||
|
||||
private Integer preMonth;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
User user = new User();
|
||||
user.setUid(1);
|
||||
user.setLoginid("sysadmin");
|
||||
// 获取当前日到前3个月期间离职的人员id
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(new Date());
|
||||
if (preMonth == null) {
|
||||
preMonth = 3;
|
||||
}
|
||||
cal.add(Calendar.MONTH, -preMonth);
|
||||
Map<Long, String> resignationMap = getSalaryEmployeeService(user).getResignationMapByDate(SalaryDateUtil.getFormatDate(cal.getTime()));
|
||||
// 获取离职人员中没有设置最后缴纳月的档案
|
||||
List<SalaryArchivePO> salaryArchivePOS = getSalaryArchiveService(user).listPayEndDateIsNull(new ArrayList<>(resignationMap.keySet()));
|
||||
Date now = new Date();
|
||||
List<SalaryArchivePO> needUpdateSalaryArchiveList = new ArrayList<>();
|
||||
for(SalaryArchivePO archive : salaryArchivePOS){
|
||||
String dismissDate = resignationMap.get(archive.getEmployeeId());
|
||||
if (StringUtils.isNotBlank(dismissDate)) {
|
||||
archive.setPayEndDate(SalaryDateUtil.dateStrToLocalDate(dismissDate));
|
||||
archive.setUpdateTime(now);
|
||||
needUpdateSalaryArchiveList.add(archive);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue