Blame view

fw-morax-rpc/src/main/java/cn/fw/morax/rpc/ehr/EhrRpcService.java 22.2 KB
a94d3715   张志伟   :rocket:
1
2
  package cn.fw.morax.rpc.ehr;
  
a94d3715   张志伟   :rocket:
3
  import cn.fw.data.base.domain.common.Message;
5bca06a2   姜超   feature(*): 绩效池接口
4
  import cn.fw.ehr.sdk.api.ManagerApi;
2436d2f9   姜超   feature(*): 根据岗位查...
5
  import cn.fw.ehr.sdk.api.PostApi;
a94d3715   张志伟   :rocket:
6
  import cn.fw.ehr.sdk.api.StaffApi;
2436d2f9   姜超   feature(*): 根据岗位查...
7
  import cn.fw.ehr.sdk.api.result.*;
3743789f   姜超   [jiangchao] 绩效组查询接口
8
  import cn.fw.morax.common.utils.PublicUtil;
a94d3715   张志伟   :rocket:
9
  import cn.fw.morax.common.utils.StringUtils;
a3dd2862   姜超   feature(*): corn修改
10
  import cn.fw.morax.rpc.ehr.dto.*;
2f26f193   姜超   feature(*): 个税导入、...
11
  import com.alibaba.fastjson.JSON;
a3dd2862   姜超   feature(*): corn修改
12
  import com.google.common.collect.Lists;
5bca06a2   姜超   feature(*): 绩效池接口
13
  import lombok.RequiredArgsConstructor;
a94d3715   张志伟   :rocket:
14
15
  import lombok.extern.slf4j.Slf4j;
  import org.springframework.beans.BeanUtils;
660b014e   张志伟   :sparkles:
16
  import org.springframework.cache.annotation.Cacheable;
a94d3715   张志伟   :rocket:
17
18
  import org.springframework.lang.Nullable;
  import org.springframework.stereotype.Service;
a94d3715   张志伟   :rocket:
19
  
bb9bf27c   张志伟   feature(*): 修复启动报错
20
  import java.math.BigDecimal;
794e370c   姜超   feature(*): 删除无用代码
21
22
  import java.time.LocalDate;
  import java.time.ZoneId;
3743789f   姜超   [jiangchao] 绩效组查询接口
23
  import java.util.ArrayList;
a207ee2d   姜超   feature(*): 星级调整查询人员
24
  import java.util.Date;
3743789f   姜超   [jiangchao] 绩效组查询接口
25
  import java.util.List;
a94d3715   张志伟   :rocket:
26
  import java.util.Objects;
c1b3c16f   姜超   feature(*): 门店考评池查询
27
  import java.util.stream.Collectors;
a94d3715   张志伟   :rocket:
28
  
a94d3715   张志伟   :rocket:
29
30
31
32
33
34
35
  /**
   * @author : kurisu
   * @className : EhrRpcService
   * @description : 人事
   * @date: 2021-01-19 17:34
   */
  @Slf4j
5bca06a2   姜超   feature(*): 绩效池接口
36
  @RequiredArgsConstructor
660b014e   张志伟   :sparkles:
37
38
  @Service
  public class EhrRpcService {
5bca06a2   姜超   feature(*): 绩效池接口
39
      private final ManagerApi managerApi;
2436d2f9   姜超   feature(*): 根据岗位查...
40
41
      private final StaffApi staffApi;
      private final PostApi postApi;
a94d3715   张志伟   :rocket:
42
  
660b014e   张志伟   :sparkles:
43
      @Cacheable(cacheNames = "rpc_ehr", key = "':rpc:ehr:user:'+ #userId", unless = "#result == null")
a94d3715   张志伟   :rocket:
44
45
46
47
48
      @Nullable
      public StaffInfoDTO queryStaffInfo(final Long userId) {
          if (userId == null) {
              return null;
          }
a94d3715   张志伟   :rocket:
49
50
          try {
              final Message<StaffInfo> msg = staffApi.getStaffInfoById(userId);
660b014e   张志伟   :sparkles:
51
              log.info("StaffApi.queryStaffInfo: param:[{}] msg.code={}, msg.result={}, msg.data={}", userId, msg.getCode(), msg.getResult(), msg.getData());
a94d3715   张志伟   :rocket:
52
53
54
              if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                  final StaffInfoDTO staffInfoDTO = new StaffInfoDTO();
                  BeanUtils.copyProperties(msg.getData(), staffInfoDTO);
a94d3715   张志伟   :rocket:
55
56
57
58
59
60
61
62
                  return staffInfoDTO;
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
          return null;
      }
  
95684bc2   姜超   feature(*): 推送财务添...
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
      @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;
      }
  
4b07306b   姜超   feature(*): 星级特殊调整申请
81
82
83
84
85
86
87
88
89
90
      @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())) {
12be9b2a   姜超   fix(rpc): 修改rpc方法
91
                  return this.convertStaffBaseDTO(msg.getData());
4b07306b   姜超   feature(*): 星级特殊调整申请
92
93
94
95
96
97
98
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
          return null;
      }
  
660b014e   张志伟   :sparkles:
99
      @Cacheable(cacheNames = "rpc_ehr", key = "':rpc:ehr:mobile:'+ #mobile", unless = "#result == null")
a94d3715   张志伟   :rocket:
100
101
102
103
104
      @Nullable
      public StaffInfoDTO queryStaffInfoByMobile(final String mobile) {
          if (StringUtils.isEmpty(mobile)) {
              return null;
          }
a94d3715   张志伟   :rocket:
105
106
          try {
              final Message<StaffInfo> msg = staffApi.getStaffInfoByMobile(mobile);
660b014e   张志伟   :sparkles:
107
              log.info("StaffApi.queryStaffInfoByMobile: param:[{}] msg.code={}, msg.result={}, msg.data={}", mobile, msg.getCode(), msg.getResult(), msg.getData());
a94d3715   张志伟   :rocket:
108
109
110
              if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
                  final StaffInfoDTO staffInfoDTO = new StaffInfoDTO();
                  BeanUtils.copyProperties(msg.getData(), staffInfoDTO);
a94d3715   张志伟   :rocket:
111
112
113
114
115
116
117
118
                  return staffInfoDTO;
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
          return null;
      }
  
3743789f   姜超   [jiangchao] 绩效组查询接口
119
120
      /**
       * 查询门店岗位下的员工
660b014e   张志伟   :sparkles:
121
       *
dc2eb3fa   姜超   feature(*): 绩效组人员查看
122
       * @param shopIds
3743789f   姜超   [jiangchao] 绩效组查询接口
123
       * @param postId
3743789f   姜超   [jiangchao] 绩效组查询接口
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
       * @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;
      }
  
5bca06a2   姜超   feature(*): 绩效池接口
144
145
      /**
       * 查询管理范围下的员工
660b014e   张志伟   :sparkles:
146
       *
a207ee2d   姜超   feature(*): 星级调整查询人员
147
       * @param userId
5bca06a2   姜超   feature(*): 绩效池接口
148
149
150
       * @return
       */
      @Nullable
a207ee2d   姜超   feature(*): 星级调整查询人员
151
152
      public List<StaffBaseInfoDTO> queryManageStaffs(final Long userId) {
          if (PublicUtil.isEmpty(userId)) {
a62491d2   姜超   feature(*): 绩效池查询...
153
154
              return new ArrayList<>();
          }
5bca06a2   姜超   feature(*): 绩效池接口
155
          try {
a207ee2d   姜超   feature(*): 星级调整查询人员
156
157
158
              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())) {
12be9b2a   姜超   fix(rpc): 修改rpc方法
159
                  return this.convertStaffBaseDTOs(msg.getData().getManageStaffList());
a207ee2d   姜超   feature(*): 星级调整查询人员
160
161
162
163
164
165
166
167
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
          return null;
      }
  
      /**
c1b3c16f   姜超   feature(*): 门店考评池查询
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
       * 查询管理范围下的员工
       *
       * @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;
      }
  
      /**
60d0b5db   姜超   feature(*): 绩效报表抽取
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
       * 查询门店实时管理者
       *
       * @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;
      }
  
      /**
a207ee2d   姜超   feature(*): 星级调整查询人员
239
240
241
242
243
244
245
246
247
248
249
       * 查询管理范围下的离职员工
       *
       * @param staffId
       * @return
       */
      @Nullable
      public List<StaffBaseInfoDTO> queryLeaveManageStaffs(final Long staffId, Date startLeaveTime, Date endLeaveTime) {
          if (PublicUtil.isEmpty(staffId)) {
              return new ArrayList<>();
          }
          try {
62ac994f   姜超   fix(ehrrpc): get ...
250
              final Message<ManagerVo> msg = managerApi.getRealTimeManagerLeaveScope(null, staffId, startLeaveTime.getTime(), endLeaveTime.getTime());
e376b24c   姜超   feature(*): 修改个人考评
251
              log.info("ManagerApi.getRealTimeManagerLeaveScope: msg.code={}, msg.result={}, msg.data={}", msg.getCode(), msg.getResult(), msg.getData());
5bca06a2   姜超   feature(*): 绩效池接口
252
              if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
12be9b2a   姜超   fix(rpc): 修改rpc方法
253
                  return this.convertStaffBaseDTOs(msg.getData().getManageStaffList());
5bca06a2   姜超   feature(*): 绩效池接口
254
255
256
257
258
259
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
          return null;
      }
3083fec7   姜超   feature(*): 薪酬组保存...
260
261
262
263
264
265
  
      /**
       * 查询门店、岗位下的员工
       *
       * @param postId
       * @param shopIds
52f8739f   姜超   feature(*): 绩效组实时...
266
       * @param staffName
3083fec7   姜超   feature(*): 薪酬组保存...
267
268
269
       * @return
       */
      @Nullable
52f8739f   姜超   feature(*): 绩效组实时...
270
      public List<PerformanceStaffDTO> queryKpiStaffByName(final Long postId, List<Long> shopIds, String staffName) {
3083fec7   姜超   feature(*): 薪酬组保存...
271
272
273
274
          if (PublicUtil.isEmpty(postId) || PublicUtil.isEmpty(shopIds)) {
              return new ArrayList<>();
          }
          try {
2cf55b41   姜超   feature(*): 保存绩效人...
275
              final Message<List<PerformanceStaffVo>> msg = staffApi.getPerformanceStaff(postId, shopIds);
3083fec7   姜超   feature(*): 薪酬组保存...
276
277
              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())) {
1feefdd3   姜超   feature(*): 绩效组人员构建
278
279
280
                  List<PerformanceStaffDTO> staffDTOS = new ArrayList<>(msg.getData().size());
                  PerformanceStaffDTO staffDTO = null;
                  for (PerformanceStaffVo staffVo : msg.getData()) {
a207ee2d   姜超   feature(*): 星级调整查询人员
281
                      if (PublicUtil.isNotEmpty(staffName) && (! staffVo.getName().contains(staffName))) {
f643dda5   姜超   feature(*): 模糊查询绩...
282
283
                          continue;
                      }
1feefdd3   姜超   feature(*): 绩效组人员构建
284
                      staffDTO = PublicUtil.copy(staffVo, PerformanceStaffDTO.class);
f643dda5   姜超   feature(*): 模糊查询绩...
285
                      ZoneId zoneId = ZoneId.systemDefault();
59d58c08   姜超   feature(*): excel...
286
                      if (PublicUtil.isNotEmpty(staffVo.getEntryDate())) {
f643dda5   姜超   feature(*): 模糊查询绩...
287
                          staffDTO.setEntryDate(staffVo.getEntryDate().toInstant().atZone(zoneId).toLocalDate());
59d58c08   姜超   feature(*): excel...
288
289
                      }
                      if (PublicUtil.isNotEmpty(staffVo.getRegularDate())) {
f643dda5   姜超   feature(*): 模糊查询绩...
290
                          staffDTO.setRegularDate(staffVo.getRegularDate().toInstant().atZone(zoneId).toLocalDate());
59d58c08   姜超   feature(*): excel...
291
292
                      }
                      if (PublicUtil.isNotEmpty(staffVo.getGainPostTime())) {
f643dda5   姜超   feature(*): 模糊查询绩...
293
                          staffDTO.setGainPostTime(staffVo.getGainPostTime().toInstant().atZone(zoneId).toLocalDate());
59d58c08   姜超   feature(*): excel...
294
                      }
1feefdd3   姜超   feature(*): 绩效组人员构建
295
296
                      staffDTOS.add(staffDTO);
                  }
3083fec7   姜超   feature(*): 薪酬组保存...
297
298
299
300
301
302
303
                  return staffDTOS;
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
          return new ArrayList<>();
      }
bb9bf27c   张志伟   feature(*): 修复启动报错
304
  
52f8739f   姜超   feature(*): 绩效组实时...
305
306
307
308
309
310
311
312
313
      /**
       * 查询门店、岗位下的员工
       *
       * @param postId
       * @param shopIds
       * @return
       */
      @Nullable
      public List<PerformanceStaffDTO> queryKpiStaff(final Long postId, List<Long> shopIds) {
83fc9174   姜超   feature(*): 薪酬项查询...
314
          return this.queryKpiStaffByName(postId, shopIds, null);
52f8739f   姜超   feature(*): 绩效组实时...
315
316
      }
  
bb9bf27c   张志伟   feature(*): 修复启动报错
317
318
319
320
321
322
323
  
      /**
       * 查询员工试用期工资
       *
       * @param userId
       * @return
       */
bb9bf27c   张志伟   feature(*): 修复启动报错
324
      @Nullable
baf571c2   姜超   feature(*): 查询员工星...
325
      public BigDecimal queryProbationerSalary(final Long userId, final LocalDate localDate) {
bb9bf27c   张志伟   feature(*): 修复启动报错
326
327
328
329
          if (userId == null) {
              return null;
          }
          try {
baf571c2   姜超   feature(*): 查询员工星...
330
331
              List<Long> staffIds = new ArrayList<Long>(){{add(userId);}};
              Date date = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
62ac994f   姜超   fix(ehrrpc): get ...
332
              final Message<List<ProbationStaffSalaryVo>> msg = staffApi.getProbationSalary(staffIds, date.getTime());
0185237a   姜超   feature(*): 查询管理员工
333
              log.info("StaffApi.getProbationSalary: param:[userId:{}, date:{}] msg.code={}, msg.result={}, msg.data={}", JSON.toJSONString(staffIds), date, msg.getCode(), msg.getResult(), msg.getData());
bb9bf27c   张志伟   feature(*): 修复启动报错
334
              if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
baf571c2   姜超   feature(*): 查询员工星...
335
336
337
338
339
                  final List<ProbationStaffSalaryVo> probationStaffSalaryVos = msg.getData();
                  if ((probationStaffSalaryVos.size() == 0) || PublicUtil.isEmpty(probationStaffSalaryVos.get(0).getSalary())) {
                      return BigDecimal.ZERO;
                  }
                  return probationStaffSalaryVos.get(0).getSalary();
bb9bf27c   张志伟   feature(*): 修复启动报错
340
341
342
343
344
345
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
          return null;
      }
2436d2f9   姜超   feature(*): 根据岗位查...
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
  
      /**
       * 获取岗位信息
       *
       * @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())) {
c62ad9c0   姜超   feature(*): 计算薪酬修改
362
363
364
365
366
367
368
369
370
371
372
373
                  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;
2436d2f9   姜超   feature(*): 根据岗位查...
374
375
376
377
378
379
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
          return null;
      }
a7a26e53   姜超   feature(*): 支付薪酬查看
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
  
      /**
       * 查询门店下离职员工
       *
       * @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 {
62ac994f   姜超   fix(ehrrpc): get ...
395
              final Message<List<StaffBaseInfo>> msg = staffApi.getLeaveStaff(shopIds, firstDayOfMonth.getTime(), endDayOfMonth.getTime());
c574c94a   姜超   feature(*): 推送财务的...
396
397
398
              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())) {
12be9b2a   姜超   fix(rpc): 修改rpc方法
399
                  return this.convertStaffBaseDTOs(msg.getData());
c574c94a   姜超   feature(*): 推送财务的...
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
              }
          } 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());
a7a26e53   姜超   feature(*): 支付薪酬查看
421
              if (msg.isSuccess() && !Objects.isNull(msg.getData())) {
12be9b2a   姜超   fix(rpc): 修改rpc方法
422
                  return this.convertStaffBaseDTOs(msg.getData());
a7a26e53   姜超   feature(*): 支付薪酬查看
423
424
425
426
427
428
429
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
          return null;
      }
  
2f26f193   姜超   feature(*): 个税导入、...
430
      /**
12be9b2a   姜超   fix(rpc): 修改rpc方法
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
       * 转换为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) {
c88c36e2   姜超   feature(kpi): 绩效池...
451
452
453
          if (PublicUtil.isEmpty(staffBaseInfos)) {
              return new ArrayList<>();
          }
12be9b2a   姜超   fix(rpc): 修改rpc方法
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
          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;
      }
  
c1b3c16f   姜超   feature(*): 门店考评池查询
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
      /**
       * 转换为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;
      }
  
12be9b2a   姜超   fix(rpc): 修改rpc方法
485
486
  
      /**
2f26f193   姜超   feature(*): 个税导入、...
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
       * 根据身份证批量查询员工基础信息
       *
       * @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;
      }
  
f487dd65   姜超   feature(*): 人员质量评测接口
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
      /***
       * 通过角色编码+管理人员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<>();
      }
  
19f21837   姜超   feature(bug): 保存人...
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
      /***
       * 通过门店集合下岗所有员工列表
       * @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<>();
      }
  
a94d3715   张志伟   :rocket:
564
  }