优化代码:String leaderAccount = null; 发送给部门负责人 try HrUnit unit = orgFeignunitDetailByCodepersongetTenantId persongetShrDepartment
String leaderAccount = null; try { HrUnit unit = orgFeign.unitDetailByCode(person.getTenantId(), person.getShrDepartmentCode()).getBody(); if (unit != null && unit.getDescription() != null) { String unitLeader = unit.getLeader(); EmployeeInfoDTO leaderInfo = orgFeign.getEmployeeInfoEmployeeNum(person.getTenantId(), unitLeader).getBody(); if (leaderInfo != null) { leaderAccount = leaderInfo.getDomainAccount(); log.info("次日入职人员[{}]提醒部门负责人:{}({})", person.getName(), leaderInfo.getName(), leaderAccount); hrMessageService.sendFeishu(0L, "ANONYMOUS_LETTER_NEW_EMPLOYEE", leaderAccount, args); } } } catch (Exception e) { log.error("次日入职人员[{}]提醒部门负责人失败:{}", person.getName(), e.getMessage()); }
try { PersonWorkOrder workOrder = personWorkOrderMapper.selectByEmpId(person.getId(), WorkOrderTypeEnum.ON_DUTY_COACH.getCode()); if (workOrder != null && StringUtils.isNotBlank(workOrder.getSolutionJson())) { OnDutyCoach onDutyCoach = JSON.parseObject(workOrder.getSolutionJson(), OnDutyCoach.class); EmployeeInfoDTO employeeInfo = orgFeign.getEmployeeInfoEmployeeNum(workOrder.getTenantId(), onDutyCoach.getEmployeeNum()).getBody(); if (employeeInfo != null) { String coachAccount = employeeInfo.getDomainAccount(); if (coachAccount != null && coachAccount.equals(leaderAccount)) { log.info("次日入职人员[{}]提醒带岗教练:{}({})", person.getName(), employeeInfo.getName(), employeeInfo.getDomainAccount()); hrMessageService.sendFeishu(0L, "ANONYMOUS_LETTER_NEW_EMPLOYEE", coachAccount, args); } } } } catch (Exception e) { log.error("次日入职人员[{}]提醒带岗教练失败:{}", person.getName(), e.getMessage());
原文地址: https://www.cveoy.top/t/topic/hwKA 著作权归作者所有。请勿转载和采集!