update feishu logic
This commit is contained in:
parent
dc48f9978d
commit
f75bc6c30e
33
.idea/workspace.xml
generated
33
.idea/workspace.xml
generated
@ -3,10 +3,25 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e4baaf01-a2c2-445d-98a1-9f4c50c148cf" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/dao/DepartmentsStaffRelateDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/dao/DepartmentsStaffRelateDao.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/dao/StaffOccupationDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/dao/StaffOccupationDao.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/DepartmentsStaffRelateService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/DepartmentsStaffRelateService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/StaffOccupationService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/StaffOccupationService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/impl/DepartmentsStaffRelateServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/impl/DepartmentsStaffRelateServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/impl/StaffOccupationServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/impl/StaffOccupationServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/job/business/FeishuBusiness.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/job/business/FeishuBusiness.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/sys/oauth2/OAuth2Filter.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/sys/oauth2/OAuth2Filter.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/mapper/generator/StaffDao.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/mapper/generator/StaffDao.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/controller/StaffController.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/controller/StaffController.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/mapper/generator/StaffDao.xml" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/mapper/generator/StaffDao.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/mapper/generator/DepartmentsStaffRelateDao.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/mapper/generator/DepartmentsStaffRelateDao.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/mapper/generator/StaffOccupationDao.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/mapper/generator/StaffOccupationDao.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/dao/DepartmentsStaffRelateDao.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/dao/DepartmentsStaffRelateDao.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/dao/StaffOccupationDao.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/dao/StaffOccupationDao.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/service/DepartmentsStaffRelateService.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/service/DepartmentsStaffRelateService.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/service/StaffOccupationService.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/service/StaffOccupationService.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/service/impl/DepartmentsStaffRelateServiceImpl.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/service/impl/DepartmentsStaffRelateServiceImpl.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/service/impl/StaffOccupationServiceImpl.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/service/impl/StaffOccupationServiceImpl.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/job/business/FeishuBusiness.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/job/business/FeishuBusiness.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/mapper/generator/DepartmentsStaffRelateDao.xml" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/mapper/generator/DepartmentsStaffRelateDao.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/mapper/generator/StaffOccupationDao.xml" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/mapper/generator/StaffOccupationDao.xml" afterDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
@ -154,7 +169,7 @@
|
||||
<workItem from="1588159936850" duration="1226000" />
|
||||
<workItem from="1588161274115" duration="1691000" />
|
||||
<workItem from="1588163384182" duration="74761000" />
|
||||
<workItem from="1588936950753" duration="62703000" />
|
||||
<workItem from="1588936950753" duration="69525000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@ -212,6 +227,16 @@
|
||||
<line>79</line>
|
||||
<option name="timeStamp" value="62" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/test/java/com/lz/FumeiaiTest.java</url>
|
||||
<line>42</line>
|
||||
<option name="timeStamp" value="66" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/lz/modules/job/business/FeishuBusiness.java</url>
|
||||
<line>80</line>
|
||||
<option name="timeStamp" value="67" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
|
||||
@ -32,10 +32,15 @@ public interface DepartmentsStaffRelateDao extends BaseMapper<DepartmentsStaffRe
|
||||
|
||||
/**
|
||||
* 根据staffId修改departmentId
|
||||
*
|
||||
* @param departmentId
|
||||
* @param staffId
|
||||
* @return
|
||||
*/
|
||||
int updateByStaffId(@Param("departmentId") String departmentId, @Param("staffId") Long staffId);
|
||||
|
||||
void deleteAllRelates();
|
||||
|
||||
String getRelateByStaffIdAndDepartmentId(@Param("staffId") Long staffId, @Param("departmentId") String departmentId);
|
||||
|
||||
}
|
||||
|
||||
@ -27,5 +27,6 @@ public interface StaffOccupationDao extends BaseMapper<StaffOccupationEntity> {
|
||||
|
||||
StaffOccupationInfoDto getOccupationByStaffId(@Param("staffId") Long staffId);
|
||||
|
||||
void updateAllOccupation();
|
||||
|
||||
}
|
||||
|
||||
@ -24,5 +24,8 @@ public interface DepartmentsStaffRelateService extends IService<DepartmentsStaff
|
||||
void addRelateInfos(String departmentId, List<Long> staffIds);
|
||||
|
||||
|
||||
void deleteAllRelates();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -26,5 +26,7 @@ public interface StaffOccupationService extends IService<StaffOccupationEntity>
|
||||
int addStaffOccupationBatch(List<StaffOccupationEntity> staffs);
|
||||
|
||||
StaffOccupationInfoDto getOccupationByStaffId(Long id);
|
||||
|
||||
void updateAllOccupation();
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ public class DepartmentsStaffRelateServiceImpl extends ServiceImpl<DepartmentsSt
|
||||
public void addRelateInfos(String departmentId, List<Long> staffIds) {
|
||||
List<DepartmentsStaffRelateEntity> departStaffRelateList = Lists.newArrayList();
|
||||
for (Long staffId : staffIds) {
|
||||
String departId = departmentsStaffRelateDao.getRelateInfoByStaffId(staffId);
|
||||
String departId = departmentsStaffRelateDao.getRelateByStaffIdAndDepartmentId(staffId, departmentId);
|
||||
if (StringUtil.isEmpty(departId)) {
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateBo = new DepartmentsStaffRelateEntity();
|
||||
departmentsStaffRelateBo.setDepartmentId(departmentId);
|
||||
@ -53,5 +53,10 @@ public class DepartmentsStaffRelateServiceImpl extends ServiceImpl<DepartmentsSt
|
||||
saveBatch(departStaffRelateList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAllRelates() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -49,7 +49,12 @@ public class StaffOccupationServiceImpl extends ServiceImpl<StaffOccupationDao,
|
||||
|
||||
@Override
|
||||
public StaffOccupationInfoDto getOccupationByStaffId(Long staffId) {
|
||||
return null;
|
||||
return staffOccupationDao.getOccupationByStaffId(staffId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAllOccupation() {
|
||||
staffOccupationDao.updateAllOccupation();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.lz.modules.job.business;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.lz.common.utils.DateUtils;
|
||||
import com.lz.common.utils.FeishuUtil;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.entity.StaffOccupationEntity;
|
||||
@ -73,11 +74,14 @@ public class FeishuBusiness {
|
||||
List<DepartmentInfosBo> departmentInfosBos = feishuUtil.getDepartmentDetails(token, topDepartmentIds);
|
||||
//更新数据库中的部门相关信息
|
||||
departmentsService.updateDepartmentInfos(departmentInfosBos);
|
||||
departmentsStaffRelateService.deleteAllRelates();
|
||||
//未在飞书组织架构里的成员,置为离职(全部置为离职,再把在职的恢复)
|
||||
staffOccupationService.updateAllOccupation();
|
||||
//获取飞书部门对应的用户详情
|
||||
for (DepartmentInfosBo departmentInfo : departmentInfosBos) {
|
||||
//获取部门用户详情
|
||||
List<DepartmentStaffBo> staffs = feishuUtil.getDepartmentStaffDetails(token, departmentInfo.getId());
|
||||
|
||||
System.out.println("=============================" + departmentInfo.getName() + "================================");
|
||||
for (DepartmentStaffBo staff : staffs)
|
||||
System.out.println(staff.getName());
|
||||
//循环录入到员工信息表中
|
||||
@ -88,8 +92,6 @@ public class FeishuBusiness {
|
||||
//录入员工职业信息表
|
||||
enterStaffOccupationInfos(staffs);
|
||||
|
||||
//未在飞书组织架构里的成员,置为离职
|
||||
|
||||
}
|
||||
|
||||
System.out.println(departmentInfosBos.size());
|
||||
@ -108,8 +110,9 @@ public class FeishuBusiness {
|
||||
staffOccupation.setEmployeeNo(departmentStaffBo.getEmployeeNo());
|
||||
staffOccupation.setStaffType(departmentStaffBo.getEmployeeType());
|
||||
staffOccupation.setStaffStatus(departmentStaffBo.getStatus());
|
||||
staffOccupation.setEntryTime(DateUtils.getCurrentDate());
|
||||
StaffOccupations.add(staffOccupation);
|
||||
} else if (staffOccupationEntity.getStaffStatus().intValue() != departmentStaffBo.getStatus().intValue()) {
|
||||
} else {
|
||||
staffOccupationService.updateStatusByStaffId(staffId, departmentStaffBo.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,12 +21,20 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="deleteAllRelates">
|
||||
update lz_departments_staff_relate set is_delete=1
|
||||
</update>
|
||||
|
||||
<select id="getRelateInfoByStaffId" resultType="String">
|
||||
select department_id from lz_departments_staff_relate where is_delete=0 and staff_id = #{staffId}
|
||||
</select>
|
||||
|
||||
<select id="getRelateByStaffIdAndDepartmentId" resultType="java.lang.String">
|
||||
select department_id from lz_departments_staff_relate where is_delete=0 and staff_id = #{staffId} and department_id=#{departmentId}
|
||||
</select>
|
||||
|
||||
<update id="updateByStaffId">
|
||||
update lz_departments_staff_relate set update_time=now(), department_id=#{departmentId} where is_delete=0 and staff_id = #{staffId}
|
||||
update lz_departments_staff_relate set is_delete=0 and update_time=now(), department_id=#{departmentId} where is_delete=0 and staff_id = #{staffId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -37,7 +37,11 @@
|
||||
</select>
|
||||
|
||||
<update id="updateStatusByStaffId">
|
||||
update lz_staff_occupation set status=#{status} where is_delete=0 and staff_id = #{staffId}
|
||||
update lz_staff_occupation set staff_status=#{status},resignation_time=null where is_delete=0 and staff_id = #{staffId}
|
||||
</update>
|
||||
|
||||
<update id="updateAllOccupation">
|
||||
update lz_staff_occupation set staff_status=1,resignation_time=now() where is_delete=0 and staff_status=0
|
||||
</update>
|
||||
|
||||
<insert id="addStaffOccupationBatch">
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -21,12 +21,20 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="deleteAllRelates">
|
||||
update lz_departments_staff_relate set is_delete=1
|
||||
</update>
|
||||
|
||||
<select id="getRelateInfoByStaffId" resultType="String">
|
||||
select department_id from lz_departments_staff_relate where is_delete=0 and staff_id = #{staffId}
|
||||
</select>
|
||||
|
||||
<select id="getRelateByStaffIdAndDepartmentId" resultType="java.lang.String">
|
||||
select department_id from lz_departments_staff_relate where is_delete=0 and staff_id = #{staffId} and department_id=#{departmentId}
|
||||
</select>
|
||||
|
||||
<update id="updateByStaffId">
|
||||
update lz_departments_staff_relate set update_time=now(), department_id=#{departmentId} where is_delete=0 and staff_id = #{staffId}
|
||||
update lz_departments_staff_relate set is_delete=0 and update_time=now(), department_id=#{departmentId} where is_delete=0 and staff_id = #{staffId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -37,7 +37,11 @@
|
||||
</select>
|
||||
|
||||
<update id="updateStatusByStaffId">
|
||||
update lz_staff_occupation set status=#{status} where is_delete=0 and staff_id = #{staffId}
|
||||
update lz_staff_occupation set staff_status=#{status},resignation_time=null where is_delete=0 and staff_id = #{staffId}
|
||||
</update>
|
||||
|
||||
<update id="updateAllOccupation">
|
||||
update lz_staff_occupation set staff_status=1,resignation_time=now() where is_delete=0 and staff_status=0
|
||||
</update>
|
||||
|
||||
<insert id="addStaffOccupationBatch">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user