人员信息同步2.0

master
zhaoxiaolin 10 months ago
parent 8a0a9b7634
commit eacf18a4a8

@ -168,17 +168,13 @@ public class RyTask {
logger.info("++hr人力基础数据同步+开始++syncUserInfoTask+++++"); logger.info("++hr人力基础数据同步+开始++syncUserInfoTask+++++");
remoteUserService.syncUserInfoTask(); remoteUserService.syncUserInfoTask();
} }
/************hr 人力基础数据定时任务结束*****************/
/************岗位基础数据定时任务开始*****************/
//岗位基本数据同步每天 //岗位基本数据同步每天
public void sysPostInfoTask(){ public void sysPostInfoTask(){
logger.info("++hr岗位基础数据同步+开始++sysPostInfoTask+++++"); logger.info("++hr岗位基础数据同步+开始++sysPostInfoTask+++++");
remoteUserService.sysPostInfoTask(); remoteUserService.sysPostInfoTask();
} }
/************岗位基础数据定时任务开始*****************/
/************部门基础数据定时任务开始*****************/
//部门基本数据同步每天 //部门基本数据同步每天
public void sysDeptInfoTask(){ public void sysDeptInfoTask(){
logger.info("++hr部门基础数据同步+开始++sysPostInfoTask+++++"); logger.info("++hr部门基础数据同步+开始++sysPostInfoTask+++++");

@ -603,6 +603,20 @@ public class SysUserServiceImpl implements ISysUserService {
.collect(Collectors.toList()); .collect(Collectors.toList());
if(!CollectionUtils.isEmpty(updates)){ if(!CollectionUtils.isEmpty(updates)){
int allsize = updates.size();
int inserttimes = allsize/150+1;
for(int m=0;m<inserttimes;m++){
List<HRInfo> everyList;
if(m<(inserttimes-1)){
everyList = updates.subList(m*150,(m+1)*150);
}else{
everyList = updates.subList(m*150,allsize);
}
if(everyList.size()>0){
m = userMapper.updateUserBatchs(everyList);
System.out.println("人员新增成功条数:"+ m);
}
}
int m = userMapper.updateUserBatchs(updates); int m = userMapper.updateUserBatchs(updates);
System.out.println("人员更新成功条数:"+m); System.out.println("人员更新成功条数:"+m);
} }
@ -611,8 +625,20 @@ public class SysUserServiceImpl implements ISysUserService {
.collect(Collectors.toList()); .collect(Collectors.toList());
if(!CollectionUtils.isEmpty(adds)){ if(!CollectionUtils.isEmpty(adds)){
n = userMapper.addUserBatchs(adds); int allsize = adds.size();
System.out.println("人员新增成功条数:"+ n); int inserttimes = allsize/150+1;
for(int m=0;m<inserttimes;m++){
List<HRInfo> everyList;
if(m<(inserttimes-1)){
everyList = adds.subList(m*150,(m+1)*160);
}else{
everyList = adds.subList(m*150,allsize);
}
if(everyList.size()>0){
n = userMapper.addUserBatchs(everyList);
System.out.println("人员新增成功条数:"+ n);
}
}
} }
return n; return n;

@ -187,13 +187,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert> </insert>
<insert id="addUserBatchs"> <insert id="addUserBatchs">
insert into sys_user insert into sys_user
(user_name,nick_name, (user_name,nick_name,post,dept_id,
post,section,dept_id, phonenumber,sex,status,
create_by,create_time,del_flag) create_by,create_time,del_flag)
VALUES VALUES
<foreach collection="list" index="index" item="item" separator=","> <foreach collection="list" index="index" item="item" separator=",">
(#{item.userCode},#{item.userName},#{item.post}, (#{item.userName},#{item.nickName},#{item.post},#{item.deptId},
#{item.section},#{item.deptId}, #{item.phonenumber},#{item.sex},#{item.status},
#{item.createBy},#{item.createTime},'0') #{item.createBy},#{item.createTime},'0')
</foreach> </foreach>
</insert> </insert>
@ -235,8 +235,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<foreach collection="list" item="item" separator=";"> <foreach collection="list" item="item" separator=";">
update sys_user update sys_user
set set
<if test="item.section!=null">section = #{item.section},</if> <if test="item.deptId!=null">section = #{item.deptId},</if>
<if test="item.post!=null">post = #{item.post},</if> <if test="item.post!=null">post = #{item.post},</if>
<if test="item.phonenumber!=null">phonenumber = #{item.phonenumber},</if>
sex = #{item.sex},
del_flag = #{item.delFlag},
update_by = #{item.updateBy}, update_by = #{item.updateBy},
update_time = #{updateTime} update_time = #{updateTime}
where where

Loading…
Cancel
Save