Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0
This commit is contained in:
commit
c169efe152
@ -57,4 +57,6 @@ public interface DepartmentsDao extends BaseMapper<DepartmentsEntity> {
|
|||||||
List<DepartmentsEntity> selectEntityByParentDepartmentIds(@Param("dIds") List<DepartmentsEntity> dIds);
|
List<DepartmentsEntity> selectEntityByParentDepartmentIds(@Param("dIds") List<DepartmentsEntity> dIds);
|
||||||
|
|
||||||
DepartmentsEntity selectParentDepartmentByDepartmentId(String departmentId);
|
DepartmentsEntity selectParentDepartmentByDepartmentId(String departmentId);
|
||||||
|
|
||||||
|
int delDepartments(@Param("list") List<DepartmentsEntity> departmentsEntities);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,5 +57,9 @@ public interface DepartmentsService extends IService<DepartmentsEntity> {
|
|||||||
|
|
||||||
//查找父级部门
|
//查找父级部门
|
||||||
DepartmentsEntity selectParentDepartmentByDepartmentId(String departmentId);
|
DepartmentsEntity selectParentDepartmentByDepartmentId(String departmentId);
|
||||||
|
|
||||||
|
List<DepartmentsEntity> selectAll();
|
||||||
|
|
||||||
|
int delDepartments(List<DepartmentsEntity> departmentsEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -295,5 +295,15 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
|
|||||||
public DepartmentsEntity selectParentDepartmentByDepartmentId(String departmentId){
|
public DepartmentsEntity selectParentDepartmentByDepartmentId(String departmentId){
|
||||||
return departmentsDao.selectParentDepartmentByDepartmentId(departmentId);
|
return departmentsDao.selectParentDepartmentByDepartmentId(departmentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DepartmentsEntity> selectAll(){
|
||||||
|
return departmentsDao.selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int delDepartments(List<DepartmentsEntity> departmentsEntities){
|
||||||
|
return departmentsDao.delDepartments(departmentsEntities);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import com.lz.common.utils.DateUtils;
|
|||||||
import com.lz.common.utils.DingTalkUtil;
|
import com.lz.common.utils.DingTalkUtil;
|
||||||
import com.lz.common.utils.R;
|
import com.lz.common.utils.R;
|
||||||
import com.lz.modules.app.dao.StaffDao;
|
import com.lz.modules.app.dao.StaffDao;
|
||||||
|
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||||
import com.lz.modules.app.entity.StaffEntity;
|
import com.lz.modules.app.entity.StaffEntity;
|
||||||
import com.lz.modules.app.entity.StaffOccupationEntity;
|
import com.lz.modules.app.entity.StaffOccupationEntity;
|
||||||
import com.lz.modules.app.entity.StaffSimpleInfo;
|
import com.lz.modules.app.entity.StaffSimpleInfo;
|
||||||
@ -30,6 +31,7 @@ import com.lz.modules.third.entity.ThirdMsgSendRecord;
|
|||||||
import com.lz.modules.third.entity.WorkMsg;
|
import com.lz.modules.third.entity.WorkMsg;
|
||||||
import com.lz.modules.third.service.ThirdAppConfigService;
|
import com.lz.modules.third.service.ThirdAppConfigService;
|
||||||
import com.lz.modules.third.service.ThirdMsgSendRecordService;
|
import com.lz.modules.third.service.ThirdMsgSendRecordService;
|
||||||
|
import org.apache.commons.collections.map.CompositeMap;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@ -131,7 +133,12 @@ public class DingtalkBusiness {
|
|||||||
if(token != null && token.length() > 0){
|
if(token != null && token.length() > 0){
|
||||||
//获取所有的部门详情
|
//获取所有的部门详情
|
||||||
Map<String, DepartmentInfosBo> departmentInfosBos = dingTalkUtil.getDepartmentDetails(token, "1");
|
Map<String, DepartmentInfosBo> departmentInfosBos = dingTalkUtil.getDepartmentDetails(token, "1");
|
||||||
|
|
||||||
if(departmentInfosBos.size() > 0){
|
if(departmentInfosBos.size() > 0){
|
||||||
|
//获取所有部门信息
|
||||||
|
List<DepartmentsEntity> departmentsEntities = departmentsService.selectAll();
|
||||||
|
Map<String, DepartmentsEntity> mapDeparts =
|
||||||
|
departmentsEntities.stream().collect(Collectors.toMap(DepartmentsEntity::getDepartmentId, Function.identity(), (e, r) -> e));
|
||||||
//更新数据库中的部门相关信息
|
//更新数据库中的部门相关信息
|
||||||
//departmentsService.updateDepartmentInfos(departmentInfosBos);
|
//departmentsService.updateDepartmentInfos(departmentInfosBos);
|
||||||
//删除原有的对应关系下面在更新
|
//删除原有的对应关系下面在更新
|
||||||
@ -140,6 +147,10 @@ public class DingtalkBusiness {
|
|||||||
staffOccupationService.updateAllOccupation();
|
staffOccupationService.updateAllOccupation();
|
||||||
//获取飞书部门对应的用户详情
|
//获取飞书部门对应的用户详情
|
||||||
for (String key : departmentInfosBos.keySet()) {
|
for (String key : departmentInfosBos.keySet()) {
|
||||||
|
if(mapDeparts.containsKey(key)){
|
||||||
|
//部门存在
|
||||||
|
mapDeparts.remove(key);
|
||||||
|
}
|
||||||
DepartmentInfosBo departmentInfo = departmentInfosBos.get(key);
|
DepartmentInfosBo departmentInfo = departmentInfosBos.get(key);
|
||||||
//获取部门用户详情
|
//获取部门用户详情
|
||||||
List<DepartmentStaffBo> staffs = dingTalkUtil.getDepartmentStaffDetails(token, departmentInfo.getId());
|
List<DepartmentStaffBo> staffs = dingTalkUtil.getDepartmentStaffDetails(token, departmentInfo.getId());
|
||||||
@ -178,6 +189,10 @@ public class DingtalkBusiness {
|
|||||||
DepartmentInfosBo departmentInfo = departmentInfosBos.get(key);
|
DepartmentInfosBo departmentInfo = departmentInfosBos.get(key);
|
||||||
departmentsService.updateDepartmentInfo(departmentInfo);
|
departmentsService.updateDepartmentInfo(departmentInfo);
|
||||||
}
|
}
|
||||||
|
if(mapDeparts.size() > 0){//有需要删除的部门信息
|
||||||
|
departmentsEntities = mapDeparts.values().stream().collect(Collectors.toList());
|
||||||
|
departmentsService.delDepartments(departmentsEntities);
|
||||||
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
logger.info("部门信息为空");
|
logger.info("部门信息为空");
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDepartmentsByparentId" resultType="com.lz.modules.app.dto.DepartmentsDto">
|
<select id="getDepartmentsByparentId" resultType="com.lz.modules.app.dto.DepartmentsDto">
|
||||||
select id, department_id,department_parent_id,member_count,department_name from lz_departments where department_parent_id=#{parentId}
|
select id, department_id,department_parent_id,member_count,department_name from lz_departments where department_parent_id=#{parentId} and is_delete=0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="updateDepartment">
|
<update id="updateDepartment">
|
||||||
@ -179,5 +179,13 @@
|
|||||||
and is_delete=0 limit 1
|
and is_delete=0 limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="delDepartments">
|
||||||
|
UPDATE lz_departments set is_delete = 1 WHERE id in(
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
#{item.id}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user