EhrRpcService.java 22.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564
package cn.fw.morax.rpc.ehr;

import cn.fw.data.base.domain.common.Message;
import cn.fw.ehr.sdk.api.ManagerApi;
import cn.fw.ehr.sdk.api.PostApi;
import cn.fw.ehr.sdk.api.StaffApi;
import cn.fw.ehr.sdk.api.result.*;
import cn.fw.morax.common.utils.PublicUtil;
import cn.fw.morax.common.utils.StringUtils;
import cn.fw.morax.rpc.ehr.dto.*;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * @author : kurisu
 * @className : EhrRpcService
 * @description : 人事
 * @date: 2021-01-19 17:34
 */
@Slf4j
@RequiredArgsConstructor
@Service
public class EhrRpcService {
    private final ManagerApi managerApi;
    private final StaffApi staffApi;
    private final PostApi postApi;

    @Cacheable(cacheNames = "rpc_ehr", key = "':rpc:ehr:user:'+ #userId", unless = "#result == null")
    @Nullable
    public StaffInfoDTO queryStaffInfo(final Long userId) {
        if (userId == null) {
            return null;
        }
        try {
            final Message<StaffInfo> msg = staffApi.getStaffInfoById(userId);
            log.info("StaffApi.queryStaffInfo: param:[{}] msg.code={}, msg.result={}, msg.data={}", userId, msg.getCode(), msg.getResult(), msg.getData());
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                final StaffInfoDTO staffInfoDTO = new StaffInfoDTO();
                BeanUtils.copyProperties(msg.getData(), staffInfoDTO);
                return staffInfoDTO;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @Nullable
    public List<StaffInfoDTO> queryStaffInfos(final List<Long> userIds) {
        if (userIds == null) {
            return null;
        }
        try {
            final Message<List<StaffBaseInfo>> msg = staffApi.getBatchStaffBaseInfoList(userIds);
            log.info("StaffApi.getBatchStaffBaseInfoList: param:[{}] msg.code={}, msg.result={}, msg.data={}", userIds, msg.getCode(), msg.getResult(), msg.getData());
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                List<StaffInfoDTO> staffInfoDTOS = PublicUtil.copyList(msg.getData(), StaffInfoDTO.class);
                return staffInfoDTOS;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @Cacheable(cacheNames = "rpc_ehr", key = "':rpc:ehr:user_base:'+ #userId", unless = "#result == null")
    @Nullable
    public StaffBaseInfoDTO queryStaffBaseInfo(final Long userId) {
        if (userId == null) {
            return null;
        }
        try {
            final Message<StaffBaseInfo> msg = staffApi.getStaffBaseInfo(userId);
            log.info("StaffApi.StaffBaseInfo: param:[{}] msg.code={}, msg.result={}, msg.data={}", userId, msg.getCode(), msg.getResult(), msg.getData());
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                return this.convertStaffBaseDTO(msg.getData());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @Cacheable(cacheNames = "rpc_ehr", key = "':rpc:ehr:mobile:'+ #mobile", unless = "#result == null")
    @Nullable
    public StaffInfoDTO queryStaffInfoByMobile(final String mobile) {
        if (StringUtils.isEmpty(mobile)) {
            return null;
        }
        try {
            final Message<StaffInfo> msg = staffApi.getStaffInfoByMobile(mobile);
            log.info("StaffApi.queryStaffInfoByMobile: param:[{}] msg.code={}, msg.result={}, msg.data={}", mobile, msg.getCode(), msg.getResult(), msg.getData());
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                final StaffInfoDTO staffInfoDTO = new StaffInfoDTO();
                BeanUtils.copyProperties(msg.getData(), staffInfoDTO);
                return staffInfoDTO;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 查询门店岗位下的员工
     *
     * @param shopIds
     * @param postId
     * @return
     */
    @Nullable
    public <T> List<T> queryShopPostStaffs(final List<Long> shopIds, final Long postId, Class<T> c) {
        if (StringUtils.isEmpty(postId) || StringUtils.isEmpty(shopIds)) {
            return new ArrayList<>();
        }
        try {
            final Message<List<StaffBaseInfo>> msg = staffApi.getStaffListByShopPost(shopIds, postId);
            log.info("StaffApi.getStaffListByShopPost: msg.code={}, msg.result={}, msg.data={}", msg.getCode(), msg.getResult(), msg.getData());
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                final List<T> staffBaseInfoVos = PublicUtil.copyList(msg.getData(), c);
                return staffBaseInfoVos;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 查询管理范围下的员工
     *
     * @param userId
     * @return
     */
    @Nullable
    public List<StaffBaseInfoDTO> queryManageStaffs(final Long userId) {
        if (PublicUtil.isEmpty(userId)) {
            return new ArrayList<>();
        }
        try {
            final Message<ManagerVo> msg = managerApi.getRealTimeManagerScope(null, userId, true);
            log.info("ManagerApi.getRealTimeManagerScope: msg.code={}, msg.result={}, msg.data={}", msg.getCode(), msg.getResult(), msg.getData());
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                return this.convertStaffBaseDTOs(msg.getData().getManageStaffList());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 查询管理范围下的员工
     *
     * @param userId
     * @return
     */
    @Nullable
    public List<Long> queryManageShops(final Long userId) {
        if (PublicUtil.isEmpty(userId)) {
            return new ArrayList<>();
        }
        try {
            final Message<ManagerVo> msg = managerApi.getRealTimeManagerScope(null, userId, false);
            log.info("ManagerApi.getRealTimeManagerScope: msg.code={}, msg.result={}, msg.data={}", msg.getCode(), msg.getResult(), msg.getData());
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                return this.convertShopIds(msg.getData().getScopeList());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 查询门店实时管理者
     *
     * @param shopIds
     * @return
     */
    @Nullable
    public List<ManagerDTO> getRealTimeShopManager(final List<Long> shopIds) {
        if (PublicUtil.isEmpty(shopIds)) {
            return new ArrayList<>();
        }
        final Message<List<ManagerVo>> msg = managerApi.getRealTimeShopManager(shopIds, true);
        try {
            log.info("ManagerApi.getRealTimeShopManager: msg.code={}, msg.result={}, msg.data={}", msg.getCode(), msg.getResult(), msg.getData());
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                List<ManagerDTO> managerDTOS = new ArrayList<>(msg.getData().size());
                ManagerDTO managerDTO = null;
                for (ManagerVo managerVo : msg.getData()) {
                    managerDTO = PublicUtil.copy(managerVo, ManagerDTO.class);

                    if (PublicUtil.isNotEmpty(managerVo.getManageStaffList())) {
                        managerDTO.setManageStaffList(PublicUtil.copyList(managerVo.getManageStaffList(), StaffBaseInfoDTO.class));
                    }

                    List<ManagerStaffDTO> scopeList = new ArrayList<>();

                    for (ManagerStaffVo staffVo : managerVo.getScopeList()) {
                        ManagerStaffDTO managerStaffDTO = PublicUtil.copy(staffVo, ManagerStaffDTO.class);
                        if (PublicUtil.isNotEmpty(staffVo.getRoleList())) {
                            managerStaffDTO.setRoleList(PublicUtil.copyList(staffVo.getRoleList(), ManagerStaffRoleDTO.class));
                        }
                        if (PublicUtil.isNotEmpty(staffVo.getShopList())) {
                            managerStaffDTO.setShopList(PublicUtil.copyList(staffVo.getShopList(), ManagerStaffShopDTO.class));
                        }
                        scopeList.add(managerStaffDTO);
                    }

                    managerDTO.setScopeList(scopeList);
                    managerDTOS.add(managerDTO);
                }
                return managerDTOS;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 查询管理范围下的离职员工
     *
     * @param staffId
     * @return
     */
    @Nullable
    public List<StaffBaseInfoDTO> queryLeaveManageStaffs(final Long staffId, Date startLeaveTime, Date endLeaveTime) {
        if (PublicUtil.isEmpty(staffId)) {
            return new ArrayList<>();
        }
        try {
            final Message<ManagerVo> msg = managerApi.getRealTimeManagerLeaveScope(null, staffId, startLeaveTime.getTime(), endLeaveTime.getTime());
            log.info("ManagerApi.getRealTimeManagerLeaveScope: msg.code={}, msg.result={}, msg.data={}", msg.getCode(), msg.getResult(), msg.getData());
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                return this.convertStaffBaseDTOs(msg.getData().getManageStaffList());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 查询门店、岗位下的员工
     *
     * @param postId
     * @param shopIds
     * @param staffName
     * @return
     */
    @Nullable
    public List<PerformanceStaffDTO> queryKpiStaffByName(final Long postId, List<Long> shopIds, String staffName) {
        if (PublicUtil.isEmpty(postId) || PublicUtil.isEmpty(shopIds)) {
            return new ArrayList<>();
        }
        try {
            final Message<List<PerformanceStaffVo>> msg = staffApi.getPerformanceStaff(postId, shopIds);
            log.info("StaffApi.getPerformanceStaff: param:[postId:{},shopIds:{}] msg.code={}, msg.result={}, msg.data={}", postId, shopIds, msg.getCode(), msg.getResult(), msg.getData());
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                List<PerformanceStaffDTO> staffDTOS = new ArrayList<>(msg.getData().size());
                PerformanceStaffDTO staffDTO = null;
                for (PerformanceStaffVo staffVo : msg.getData()) {
                    if (PublicUtil.isNotEmpty(staffName) && (! staffVo.getName().contains(staffName))) {
                        continue;
                    }
                    staffDTO = PublicUtil.copy(staffVo, PerformanceStaffDTO.class);
                    ZoneId zoneId = ZoneId.systemDefault();
                    if (PublicUtil.isNotEmpty(staffVo.getEntryDate())) {
                        staffDTO.setEntryDate(staffVo.getEntryDate().toInstant().atZone(zoneId).toLocalDate());
                    }
                    if (PublicUtil.isNotEmpty(staffVo.getRegularDate())) {
                        staffDTO.setRegularDate(staffVo.getRegularDate().toInstant().atZone(zoneId).toLocalDate());
                    }
                    if (PublicUtil.isNotEmpty(staffVo.getGainPostTime())) {
                        staffDTO.setGainPostTime(staffVo.getGainPostTime().toInstant().atZone(zoneId).toLocalDate());
                    }
                    staffDTOS.add(staffDTO);
                }
                return staffDTOS;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new ArrayList<>();
    }

    /**
     * 查询门店、岗位下的员工
     *
     * @param postId
     * @param shopIds
     * @return
     */
    @Nullable
    public List<PerformanceStaffDTO> queryKpiStaff(final Long postId, List<Long> shopIds) {
        return this.queryKpiStaffByName(postId, shopIds, null);
    }


    /**
     * 查询员工试用期工资
     *
     * @param userId
     * @return
     */
    @Nullable
    public BigDecimal queryProbationerSalary(final Long userId, final LocalDate localDate) {
        if (userId == null) {
            return null;
        }
        try {
            List<Long> staffIds = new ArrayList<Long>(){{add(userId);}};
            Date date = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
            final Message<List<ProbationStaffSalaryVo>> msg = staffApi.getProbationSalary(staffIds, date.getTime());
            log.info("StaffApi.getProbationSalary: param:[userId:{}, date:{}] msg.code={}, msg.result={}, msg.data={}", JSON.toJSONString(staffIds), date, msg.getCode(), msg.getResult(), msg.getData());
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                final List<ProbationStaffSalaryVo> probationStaffSalaryVos = msg.getData();
                if ((probationStaffSalaryVos.size() == 0) || PublicUtil.isEmpty(probationStaffSalaryVos.get(0).getSalary())) {
                    return BigDecimal.ZERO;
                }
                return probationStaffSalaryVos.get(0).getSalary();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 获取岗位信息
     *
     * @param postIds
     * @return
     */
    @Nullable
    public List<PostInfoDTO> getPostInfoList(final List<Long> postIds) {
        if (PublicUtil.isEmpty(postIds)) {
            return new ArrayList<>();
        }
        try {
            final Message<List<PostInfo>> msg = postApi.getPostList(postIds);
            log.info("PostApi.getPostList: param:[{}] msg.code={}, msg.result={}, msg.data={}", postIds, msg.getCode(), msg.getResult(), msg.getData());
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                List<PostInfoDTO> postInfos = Lists.newArrayListWithCapacity(msg.getData().size());
                for (PostInfo postInfo : msg.getData()) {
                    PostInfoDTO postInfoDTO = PublicUtil.copy(postInfo, PostInfoDTO.class);
                    if (PublicUtil.isNotEmpty(postInfo.getRoleList())) {
                        List<PostRoleDTO> postRoleDTOS = PublicUtil.copyList(postInfo.getRoleList(), PostRoleDTO.class);
                        postInfoDTO.setRoleList(postRoleDTOS);
                    } else {
                        postInfoDTO.setRoleList(new ArrayList<>());
                    }
                    postInfos.add(postInfoDTO);
                }
                return postInfos;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 查询门店下离职员工
     *
     * @param shopIds
     * @param firstDayOfMonth
     * @param endDayOfMonth
     * @return
     */
    @Nullable
    public List<StaffBaseInfoDTO> queryShopLeaveStaff(final List<Long> shopIds, Date firstDayOfMonth, Date endDayOfMonth) {
        if (PublicUtil.isEmpty(shopIds)) {
            return new ArrayList<>();
        }
        try {
            final Message<List<StaffBaseInfo>> msg = staffApi.getLeaveStaff(shopIds, firstDayOfMonth.getTime(), endDayOfMonth.getTime());
            log.info("ManagerApi.getRealTimeManagerScope: param:[shopIds:{},firstDayOfMonth:{}.endDayOfMonth:{}] " +
                    "msg.code={}, msg.result={}, msg.data={}", shopIds, firstDayOfMonth, endDayOfMonth, msg.getCode(), msg.getResult(), msg.getData());
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                return this.convertStaffBaseDTOs(msg.getData());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 查询员工基础信息
     *
     * @param staffIds
     * @return
     */
    @Nullable
    public List<StaffBaseInfoDTO> queryStaffBaseInfo(final List<Long> staffIds) {
        if (PublicUtil.isEmpty(staffIds)) {
            return new ArrayList<>();
        }
        try {
            final Message<List<StaffBaseInfo>> msg = staffApi.getBatchStaffBaseInfoList(staffIds);
            log.info("ManagerApi.getBatchStaffBaseInfoList: param:[staffIds:{}], msg.code={}, msg.result={}, msg.data={}", staffIds, msg.getCode(), msg.getResult(), msg.getData());
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                return this.convertStaffBaseDTOs(msg.getData());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 转换为dto
     * @param staffBaseInfo
     * @return
     */
    public StaffBaseInfoDTO convertStaffBaseDTO(StaffBaseInfo staffBaseInfo) {
        StaffBaseInfoDTO staffBaseInfoDTO = PublicUtil.copy(staffBaseInfo, StaffBaseInfoDTO.class);
        List<StaffShopInfoDTO> staffShopList = new ArrayList<>();
        if (PublicUtil.isNotEmpty(staffBaseInfo.getStaffShopList())) {
            staffShopList = PublicUtil.copyList(staffBaseInfo.getStaffShopList(), StaffShopInfoDTO.class);
        }
        staffBaseInfoDTO.setStaffShopList(staffShopList);
        return staffBaseInfoDTO;
    }

    /**
     * 转换为dto
     * @param staffBaseInfos
     * @return
     */
    public List<StaffBaseInfoDTO> convertStaffBaseDTOs(List<StaffBaseInfo> staffBaseInfos) {
        if (PublicUtil.isEmpty(staffBaseInfos)) {
            return new ArrayList<>();
        }
        final List<StaffBaseInfoDTO> staffBaseInfoVos = Lists.newArrayListWithCapacity(staffBaseInfos.size());
        StaffBaseInfoDTO staffBaseInfoDTO = null;
        List<StaffShopInfoDTO> staffShopList = null;
        for (StaffBaseInfo staffBaseInfo :staffBaseInfos) {
            staffShopList = new ArrayList<>();
            staffBaseInfoDTO = PublicUtil.copy(staffBaseInfo, StaffBaseInfoDTO.class);
            if (PublicUtil.isNotEmpty(staffBaseInfo.getStaffShopList())) {
                staffShopList = PublicUtil.copyList(staffBaseInfo.getStaffShopList(), StaffShopInfoDTO.class);
            }
            staffBaseInfoDTO.setStaffShopList(staffShopList);
            staffBaseInfoVos.add(staffBaseInfoDTO);
        }
        return staffBaseInfoVos;
    }

    /**
     * 转换为dto
     * @param scopes
     * @return
     */
    public List<Long> convertShopIds(List<ManagerStaffVo> scopes) {
        if (PublicUtil.isEmpty(scopes)) {
            return new ArrayList<>();
        }
        List<Long> shopIds = scopes.stream().flatMap(managerStaffVo -> managerStaffVo.getShopList().stream())
                .map(ManagerStaffShopVo::getShopId).distinct()
                .collect(Collectors.toList());

        return shopIds;
    }


    /**
     * 根据身份证批量查询员工基础信息
     *
     * @param groupId
     * @param idNumbers
     * @return
     */
    @Nullable
    public List<StaffInfoDTO> queryStaffInfoByIdNumbers(final Long groupId, final List<String> idNumbers) {
        if (PublicUtil.isEmpty(idNumbers)) {
            return new ArrayList<>();
        }
        try {
            final Message<List<StaffInfo>> msg = staffApi.getStaffInfoByIdNumbers(groupId, idNumbers);
            log.info("ManagerApi.getBatchStaffBaseInfoList: param:[groupId:{},idNumbers:{}], msg.code={}, msg.result={}, msg.data={}",
                    groupId, JSON.toJSONString(idNumbers), msg.getCode(), msg.getResult(), msg.getData());
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                final List<StaffInfoDTO> staffInfoVos = Lists.newArrayListWithCapacity(msg.getData().size());
                StaffInfoDTO staffInfoDTO = null;
                for (StaffInfo staffInfo :msg.getData()) {
                    staffInfoDTO = PublicUtil.copy(staffInfo, StaffInfoDTO.class);
                    staffInfoVos.add(staffInfoDTO);
                }
                return staffInfoVos;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /***
     * 通过角色编码+管理人员id+门店列表id 获取管管理人员的所有员工列表
     * @param roleCode 角色编码
     * @param staffId 管理人员用户id
     * @param shopIdList 门店id列表
     * @return
     */
    public List<StaffBaseInfoDTO> getManagerScopeStaffs(String roleCode, Long staffId, List<Long> shopIdList) {
        if (PublicUtil.isEmpty(roleCode) || PublicUtil.isEmpty(staffId) || PublicUtil.isEmpty(shopIdList)) {
            return new ArrayList<>();
        }
        try {
            Message<List<StaffBaseInfo>> msg = staffApi.getManagerScopeStaffList(roleCode, staffId, shopIdList);
            log.info("获取ehr系统员工信息 staffApi.managerScopeStaffList 传入参数:roleCode:{}, staffId:{}, shopIdList:{} 返回结果:{}",
                    roleCode, staffId, JSON.toJSONString(shopIdList), JSON.toJSONString(msg));
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                return this.convertStaffBaseDTOs(msg.getData());
            }
        } catch (Exception e) {
            log.error("获取ehr系统员工信息 staffApi.getManagerScopeStaffList异常");
            e.printStackTrace();
        }
        return new ArrayList<>();
    }

    /***
     * 通过门店集合下岗所有员工列表
     * @param shopIdList 门店id列表
     * @return
     */
    public List<StaffBaseInfoDTO> getStaffListByShop(List<Long> shopIdList) {
        if (PublicUtil.isEmpty(shopIdList)) {
            return new ArrayList<>();
        }
        try {
            Message<List<StaffBaseInfo>> msg = staffApi.getStaffListByShopPost(shopIdList, null);
            log.info("获取ehr系统员工信息 staffApi.getStaffListByShopPost 传入参数: shopIdList:{} 返回结果:{}", JSON.toJSONString(shopIdList), JSON.toJSONString(msg));
            if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                return this.convertStaffBaseDTOs(msg.getData());
            }
        } catch (Exception e) {
            log.error("获取ehr系统员工信息 staffApi.getStaffListByShopPost异常");
            e.printStackTrace();
        }
        return new ArrayList<>();
    }

}