168b0458
张志伟
feature(*): 薪酬模块数...
|
1
2
|
package cn.fw.morax.service.biz.salary;
|
c585efc3
姜超
fix(*): 试用期员工不保存
|
3
4
|
import cn.fw.common.exception.BusinessException;
import cn.fw.ehr.sdk.api.enums.StaffShopTypeEnum;
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
5
|
import cn.fw.morax.common.utils.DateUtil;
|
c574c94a
姜超
feature(*): 推送财务的...
|
6
|
import cn.fw.morax.common.utils.PublicUtil;
|
4020c162
张志伟
feature(*): 对接财务 ...
|
7
|
import cn.fw.morax.domain.db.PayrollRecord;
|
a894da58
张志伟
feature(*): 重新规划指...
|
8
9
10
11
|
import cn.fw.morax.domain.db.salary.SalaryExtraProject;
import cn.fw.morax.domain.db.salary.SalaryGroupUser;
import cn.fw.morax.domain.db.salary.SalaryPool;
import cn.fw.morax.domain.db.salary.SalaryProject;
|
ead23336
姜超
feature(*): 新增实体类...
|
12
|
import cn.fw.morax.domain.dto.salary.SalaryExtraDTO;
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
13
|
import cn.fw.morax.domain.enums.ExtraSalaryTypeEnum;
|
4020c162
张志伟
feature(*): 对接财务 ...
|
14
|
import cn.fw.morax.domain.enums.SalaryPayrollStatusEnum;
|
c585efc3
姜超
fix(*): 试用期员工不保存
|
15
16
17
|
import cn.fw.morax.rpc.ehr.EhrRpcService;
import cn.fw.morax.rpc.ehr.dto.StaffBaseInfoDTO;
import cn.fw.morax.rpc.ehr.dto.StaffShopInfoDTO;
|
4020c162
张志伟
feature(*): 对接财务 ...
|
18
19
|
import cn.fw.morax.rpc.oop.OopRpcService;
import cn.fw.morax.rpc.oop.dto.ShopDTO;
|
e8197bf7
张志伟
feature(*): 重新规划指...
|
20
21
22
23
|
import cn.fw.morax.sdk.dto.salary.GeneralSalaryProjectReq;
import cn.fw.morax.sdk.dto.salary.SalaryGroupUserQuery;
import cn.fw.morax.sdk.dto.salary.SalaryGroupUserResult;
import cn.fw.morax.sdk.dto.salary.SalaryRewardReq;
|
dfb12c32
张志伟
feature(*): 对接财务 ...
|
24
|
import cn.fw.morax.service.data.PayrollRecordService;
|
f044b7a6
姜超
feature(*): 薪酬组人员查询
|
25
26
|
import cn.fw.morax.service.data.salary.*;
import com.alibaba.fastjson.JSON;
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
27
28
29
|
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.Getter;
|
168b0458
张志伟
feature(*): 薪酬模块数...
|
30
31
|
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
32
33
|
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.BoundListOperations;
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
34
|
import org.springframework.data.redis.core.ListOperations;
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
35
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
168b0458
张志伟
feature(*): 薪酬模块数...
|
36
|
import org.springframework.stereotype.Service;
|
76b97ee1
姜超
feature(bug): 额外...
|
37
38
39
|
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
40
|
import org.springframework.transaction.annotation.Transactional;
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
41
|
import org.springframework.util.CollectionUtils;
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
42
|
|
a310d67e
姜超
feature(*): 绩效薪酬 ...
|
43
|
import java.text.SimpleDateFormat;
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
44
|
import java.time.YearMonth;
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
45
|
import java.util.*;
|
f044b7a6
姜超
feature(*): 薪酬组人员查询
|
46
|
import java.util.stream.Collectors;
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
47
48
|
import static cn.fw.common.businessvalidator.Validator.BV;
|
168b0458
张志伟
feature(*): 薪酬模块数...
|
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/**
* @author : kurisu
* @version : 1.0
* @className : SalaryReportService
* @description : 薪酬数据上报
* @date : 2022-04-22 10:28
*/
@RequiredArgsConstructor
@Slf4j
@Service
public class SalaryReportService {
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
62
|
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
63
64
65
|
private final SalaryExtraProjectService salaryExtraProjectService;
private final SalaryGroupUserService salaryGroupUserService;
private final SalaryPoolService salaryPoolService;
|
4020c162
张志伟
feature(*): 对接财务 ...
|
66
|
private final OopRpcService oopRpcService;
|
c585efc3
姜超
fix(*): 试用期员工不保存
|
67
|
private final EhrRpcService ehrRpcService;
|
dfb12c32
张志伟
feature(*): 对接财务 ...
|
68
|
private final PayrollRecordService payrollRecordService;
|
f044b7a6
姜超
feature(*): 薪酬组人员查询
|
69
70
|
private final SalaryProjectService salaryProjectService;
private final SalaryGroupService salaryGroupService;
|
742b79d4
姜超
feature(calculato...
|
71
|
private final SalaryPoolCommonService salaryPoolCommonService;
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
72
|
private final StringRedisTemplate stringRedisTemplate;
|
76b97ee1
姜超
feature(bug): 额外...
|
73
74
|
private final PlatformTransactionManager platformTransactionManager;
private final TransactionDefinition transactionDefinition;
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
75
76
77
78
|
@Value("${spring.cache.custom.global-prefix}:extra-salary")
@Getter
private String extraSalaryKey;
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
/**
* 额外薪资数据保存失败的重试
*/
public void retrySaveReward() {
ListOperations<String, String> listOps = stringRedisTemplate.opsForList();
String str;
List<String> failList = new ArrayList<>();
while ((str = listOps.leftPop(getExtraSalaryKey())) != null) {
try {
SalaryExtraDTO dto = JSONObject.parseObject(str, SalaryExtraDTO.class);
if (Objects.isNull(dto)) {
continue;
}
|
76b97ee1
姜超
feature(bug): 额外...
|
93
|
saveExtraProjectTX(dto);
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
94
95
|
} catch (Exception e) {
failList.add(str);
|
8dcb0cae
姜超
fix(salaryService...
|
96
|
log.error("薪酬额外薪资数据保存失败", e);
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
97
98
99
100
|
}
}
if (!CollectionUtils.isEmpty(failList)) {
|
8dcb0cae
姜超
fix(salaryService...
|
101
|
listOps.rightPushAll(getExtraSalaryKey(), failList);
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
102
103
104
|
}
}
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
105
|
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
106
107
108
109
110
111
112
113
|
/**
* 奖惩项薪资上报
*
* @param req
*/
public void salaryRewardReport(SalaryRewardReq req) {
SalaryExtraDTO extraDTO = transferExtraProject(req);
try {
|
76b97ee1
姜超
feature(bug): 额外...
|
114
|
saveExtraProjectTX(extraDTO);
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
115
|
} catch (Exception e) {
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
116
|
cacheFailProject(extraDTO, getExtraSalaryKey());
|
ec5fcaf5
张志伟
feature(*): 额外薪酬项...
|
117
|
log.error("奖惩项薪资上报数据处理失败", e);
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
118
119
120
121
122
123
124
125
126
|
}
}
/**
* 社保项上报
*
* @param req
*/
public void socialSecurityProject(GeneralSalaryProjectReq req) {
|
022c7dcd
张志伟
feature(*): 薪资数据上...
|
127
|
SalaryExtraDTO extraDTO = transferExtraProject(req, ExtraSalaryTypeEnum.NECESSARY);
|
2f26f193
姜超
feature(*): 个税导入、...
|
128
|
try {
|
76b97ee1
姜超
feature(bug): 额外...
|
129
|
saveExtraProjectTX(extraDTO);
|
2f26f193
姜超
feature(*): 个税导入、...
|
130
131
132
133
134
135
136
137
138
139
140
141
|
} catch (Exception e) {
cacheFailProject(extraDTO, getExtraSalaryKey());
log.error("社保项上报数据处理失败", e);
}
}
/**
* 个税上报
*
* @param req
*/
public void personTaxProject(GeneralSalaryProjectReq req) {
|
022c7dcd
张志伟
feature(*): 薪资数据上...
|
142
|
SalaryExtraDTO extraDTO = transferExtraProject(req, ExtraSalaryTypeEnum.PERSON_TAX);
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
143
|
try {
|
76b97ee1
姜超
feature(bug): 额外...
|
144
|
saveExtraProjectTX(extraDTO);
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
145
|
} catch (Exception e) {
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
146
|
cacheFailProject(extraDTO, getExtraSalaryKey());
|
ec5fcaf5
张志伟
feature(*): 额外薪酬项...
|
147
|
log.error("社保项上报数据处理失败", e);
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
148
149
150
151
|
}
}
/**
|
ec5fcaf5
张志伟
feature(*): 额外薪酬项...
|
152
|
* 补贴项上报
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
153
154
155
156
|
*
* @param req
*/
public void subsidyProject(GeneralSalaryProjectReq req) {
|
022c7dcd
张志伟
feature(*): 薪资数据上...
|
157
|
SalaryExtraDTO extraDTO = transferExtraProject(req, ExtraSalaryTypeEnum.SUBSIDY);
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
158
|
try {
|
76b97ee1
姜超
feature(bug): 额外...
|
159
|
saveExtraProjectTX(extraDTO);
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
160
|
} catch (Exception e) {
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
161
|
cacheFailProject(extraDTO, getExtraSalaryKey());
|
ec5fcaf5
张志伟
feature(*): 额外薪酬项...
|
162
|
log.error("补贴项薪资上报数据处理失败", e);
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
163
164
165
|
}
}
|
76b97ee1
姜超
feature(bug): 额外...
|
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
/**
* 事务保存额外薪酬项
*
* @param extraDTO
*/
public void saveExtraProjectTX(SalaryExtraDTO extraDTO) {
TransactionStatus transactionStatus = platformTransactionManager.getTransaction(transactionDefinition);
try {
saveExtraProject(extraDTO);
platformTransactionManager.commit(transactionStatus);
} catch (Exception e) {
platformTransactionManager.rollback(transactionStatus);
throw e;
}
}
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
181
182
183
184
185
186
|
/**
* 保存额外薪酬项
*
* @param extraDTO
*/
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
187
|
public void saveExtraProject(SalaryExtraDTO extraDTO) {
|
dd3b8316
姜超
feature(salaryser...
|
188
|
Optional<SalaryPool> optional = queryPoolByUser(extraDTO.getUserId(), extraDTO.getPostId(), extraDTO.getShopId(), extraDTO.getDataDate());
|
a894da58
张志伟
feature(*): 重新规划指...
|
189
190
191
192
|
Long fundShopId;
Long shopId;
Long groupId;
String userName;
|
c585efc3
姜超
fix(*): 试用期员工不保存
|
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
if (optional.isPresent()) {
SalaryPool salaryPool = optional.get();
fundShopId = PublicUtil.isNotEmpty(salaryPool.getFundShopId()) ? salaryPool.getFundShopId() : salaryPool.getShopId();
groupId = salaryPool.getGroupId();
shopId = salaryPool.getShopId();
userName = salaryPool.getUserName();
} else {
StaffBaseInfoDTO staff = ehrRpcService.queryStaffBaseInfo(extraDTO.getUserId());
if (PublicUtil.isEmpty(staff)) {
log.error("保存额外薪酬项,人员信息未找到:{}", JSON.toJSONString(extraDTO));
throw new BusinessException("人员信息未找到");
}
if (PublicUtil.isEmpty(staff.getStaffShopList())) {
log.error("保存额外薪酬项,员工门店列表为空:{}", JSON.toJSONString(extraDTO));
throw new BusinessException("员工门店列表为空");
}
Optional<StaffShopInfoDTO> fundShop = staff.getStaffShopList().stream()
.filter(shop -> StaffShopTypeEnum.FUND_SHOP.getValue().equals(shop.getType()))
.findFirst();
fundShopId = fundShop.isPresent() ? fundShop.get().getShopId() : staff.getShopId();
groupId = staff.getGroupId();
shopId = staff.getShopId();
userName = staff.getName();
|
dd3b8316
姜超
feature(salaryser...
|
217
|
}
|
c585efc3
姜超
fix(*): 试用期员工不保存
|
218
|
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
219
220
221
222
|
SalaryExtraProject extraProject = transferBaseExtra(extraDTO);
if (Objects.isNull(extraProject)) {
return;
}
|
6a050328
张志伟
feature(*): 完善薪酬绩...
|
223
|
extraProject.setPostId(extraDTO.getPostId());
|
8515e19e
姜超
feature(salary): ...
|
224
|
extraProject.setShopId(extraDTO.getShopId());
|
c585efc3
姜超
fix(*): 试用期员工不保存
|
225
|
extraProject.setGroupId(groupId);
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
226
|
salaryExtraProjectService.save(extraProject);
|
4020c162
张志伟
feature(*): 对接财务 ...
|
227
|
if (Boolean.TRUE.equals(extraDTO.getTimely())) {
|
c574c94a
姜超
feature(*): 推送财务的...
|
228
|
Long dealerId = Optional.ofNullable(oopRpcService.queryShop(fundShopId)).map(ShopDTO::getDealerId).orElse(null);
|
4020c162
张志伟
feature(*): 对接财务 ...
|
229
230
|
PayrollRecord pr = PayrollRecord.builder()
.userId(extraProject.getUserId())
|
c585efc3
姜超
fix(*): 试用期员工不保存
|
231
232
|
.userName(userName)
.shopId(shopId)
|
c574c94a
姜超
feature(*): 推送财务的...
|
233
|
.fundShopId(fundShopId)
|
4020c162
张志伟
feature(*): 对接财务 ...
|
234
235
236
|
.dealerId(dealerId)
.bizId(String.valueOf(extraProject.getId()))
.payment(ExtraSalaryTypeEnum.AWARD.equals(extraProject.getSalaryType()) || ExtraSalaryTypeEnum.SUBSIDY.equals(extraProject.getSalaryType()))
|
4020c162
张志伟
feature(*): 对接财务 ...
|
237
238
239
|
.salary(Boolean.FALSE)
.payrollStatus(SalaryPayrollStatusEnum.WAITING)
.monthly(YearMonth.from(extraProject.getDataDate()))
|
c585efc3
姜超
fix(*): 试用期员工不保存
|
240
|
.groupId(groupId)
|
4020c162
张志伟
feature(*): 对接财务 ...
|
241
|
.build();
|
022c7dcd
张志伟
feature(*): 薪资数据上...
|
242
|
pr.setAmount(extraProject.getMoney());
|
4020c162
张志伟
feature(*): 对接财务 ...
|
243
244
|
payrollRecordService.save(pr);
}
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
245
246
247
248
249
250
251
252
253
254
255
|
}
/**
* 查询薪酬池
*
* @param userId
* @param postId
* @param shopId
* @param date
* @return
*/
|
dd3b8316
姜超
feature(salaryser...
|
256
|
private Optional<SalaryPool> queryPoolByUser(Long userId, Long postId, Long shopId, Date date) {
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
257
|
SalaryGroupUser user = salaryGroupUserService.queryUserByPostShopAndUserId(userId, postId, shopId, date);
|
dd3b8316
姜超
feature(salaryser...
|
258
259
260
|
if (PublicUtil.isEmpty(user)) {
return Optional.empty();
}
|
742b79d4
姜超
feature(calculato...
|
261
|
SalaryPool salaryPool = salaryPoolCommonService.inspectionPool(user);
|
dd3b8316
姜超
feature(salaryser...
|
262
263
264
265
|
if (PublicUtil.isEmpty(salaryPool)) {
return Optional.empty();
}
return Optional.of(salaryPool);
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
266
267
|
}
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
268
269
270
271
272
273
274
275
|
/**
* 缓存处理失败的数据
*
* @param dto
*/
private <T> void cacheFailProject(T dto, String key) {
BoundListOperations<String, String> listOps = stringRedisTemplate.boundListOps(key);
String jsonString = JSONObject.toJSONString(dto);
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
276
277
278
|
listOps.rightPush(jsonString);
}
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
279
280
281
282
283
284
|
/**
* 对象转换
*
* @param dto SalaryExtraDTO
* @return SalaryExtraProject
*/
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
285
286
287
288
289
290
291
292
293
294
295
|
private SalaryExtraProject transferBaseExtra(SalaryExtraDTO dto) {
if (Objects.isNull(dto)) {
return null;
}
SalaryExtraProject salaryExtraProject = new SalaryExtraProject();
salaryExtraProject.setUserId(dto.getUserId());
salaryExtraProject.setMoney(dto.getMoney());
salaryExtraProject.setSalaryType(dto.getSalaryType());
salaryExtraProject.setDataId(dto.getDataId());
salaryExtraProject.setDataName(dto.getDataName());
salaryExtraProject.setDataDate(DateUtil.date2LocalDate(dto.getDataDate()));
|
6b9e9e00
姜超
fix(salaryservice...
|
296
|
salaryExtraProject.setTimely(PublicUtil.isEmpty(dto.getTimely()) ? Boolean.FALSE : dto.getTimely());
|
a44a8569
姜超
feature(morax): 薪...
|
297
|
salaryExtraProject.setYn(Boolean.TRUE);
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
298
299
300
|
return salaryExtraProject;
}
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
301
302
303
304
305
306
307
|
/**
* 对象转换
*
* @param req SalaryRewardReq
* @return SalaryExtraDTO
*/
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
308
309
310
311
312
313
|
private SalaryExtraDTO transferExtraProject(SalaryRewardReq req) {
SalaryExtraDTO dto = new SalaryExtraDTO();
dto.setUserId(req.getUserId());
dto.setMoney(req.getAmount());
dto.setSalaryType(ExtraSalaryTypeEnum.AWARD);
if (!Boolean.TRUE.equals(req.getAward())) {
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
314
315
316
317
318
319
320
321
322
323
324
|
dto.setSalaryType(ExtraSalaryTypeEnum.PENALTY);
}
dto.setDataId(req.getDataId());
dto.setDataName(req.getDataName());
dto.setDataDate(req.getDataTime());
dto.setPostId(req.getPostId());
dto.setShopId(req.getShopId());
dto.setTimely(req.getTimely());
return dto;
}
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
325
326
327
|
/**
* 对象转换
*
|
022c7dcd
张志伟
feature(*): 薪资数据上...
|
328
|
* @param req SalaryRewardReq
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
329
330
|
* @return SalaryExtraDTO
*/
|
022c7dcd
张志伟
feature(*): 薪资数据上...
|
331
|
private SalaryExtraDTO transferExtraProject(GeneralSalaryProjectReq req, ExtraSalaryTypeEnum salaryTypeEnum) {
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
332
333
|
SalaryExtraDTO dto = new SalaryExtraDTO();
dto.setUserId(req.getUserId());
|
2f26f193
姜超
feature(*): 个税导入、...
|
334
|
dto.setSalaryType(salaryTypeEnum);
|
022c7dcd
张志伟
feature(*): 薪资数据上...
|
335
|
dto.setMoney(req.getAmount());
|
f9a3dfe2
张志伟
feature(*): 额外薪酬项...
|
336
337
338
339
340
341
342
343
|
dto.setDataId(req.getDataId());
dto.setDataName(req.getDataName());
dto.setDataDate(req.getDataTime());
dto.setPostId(req.getPostId());
dto.setShopId(req.getShopId());
dto.setTimely(Boolean.FALSE);
return dto;
}
|
30e7868b
张志伟
feature(*): 提成薪酬项...
|
344
345
|
/**
|
f044b7a6
姜超
feature(*): 薪酬组人员查询
|
346
347
348
349
350
351
352
353
|
* 查询薪酬组人员
*
* @param salaryGroupUserQuery
* @return
*/
public List<SalaryGroupUserResult> querySalaryGroupUser(SalaryGroupUserQuery salaryGroupUserQuery) {
final String salaryCode = salaryGroupUserQuery.getSalaryCode();
final Long postId = salaryGroupUserQuery.getPostId();
|
a310d67e
姜超
feature(*): 绩效薪酬 ...
|
354
355
|
final Date dataDate = new Date(salaryGroupUserQuery.getDataDate());
log.info("查询薪酬组人员,日期:{}", new SimpleDateFormat("yyyy-MM-dd").format(dataDate));
|
f044b7a6
姜超
feature(*): 薪酬组人员查询
|
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
|
SalaryProject salaryProject = salaryProjectService.queryByCode(salaryCode, Boolean.FALSE);
BV.notNull(salaryProject, () -> "指标码不存在或已失效");
ArrayList<SalaryGroupUserResult> list = new ArrayList<>();
List<Long> salaryGroupIds = salaryGroupService.querySalaryGroupIdsByCode(salaryCode,
postId, salaryGroupUserQuery.getGroupId(), dataDate);
if (CollectionUtils.isEmpty(salaryGroupIds)) {
log.error("没有对应的薪酬组数据【{}】", salaryGroupIds);
return list;
}
List<SalaryGroupUser> groupUsers = salaryGroupUserService.list(Wrappers.<SalaryGroupUser>lambdaQuery()
.in(SalaryGroupUser::getSalaryGroupId, new HashSet<>(salaryGroupIds))
.eq(SalaryGroupUser::getDataDate, DateUtil.date2LocalDate(dataDate))
);
if (CollectionUtils.isEmpty(groupUsers)) {
log.error("没有对应日期的薪酬组人员数据【薪酬组id:{},日期:{}】", JSON.toJSONString(salaryGroupIds), DateUtil.getStringDateShort(dataDate));
return list;
}
Map<Long, List<SalaryGroupUser>> salaryGroupUserMap = groupUsers.stream().collect(Collectors.groupingBy(SalaryGroupUser::getSalaryGroupId));
for (List<SalaryGroupUser> valueArr : salaryGroupUserMap.values()) {
SalaryGroupUserResult result = new SalaryGroupUserResult();
result.setRoleCodeList(salaryProject.getRoleCodes());
result.setUserIdList(transferUser(valueArr));
list.add(result);
}
return list;
}
/**
* 转换器 SalaryGroupUser -> SimpleUserData
*
* @param groupUsers
* @return
*/
private List<SalaryGroupUserResult.SimpleUserData> transferUser(List<SalaryGroupUser> groupUsers) {
List<SalaryGroupUserResult.SimpleUserData> list = new ArrayList<>();
for (SalaryGroupUser salaryGroupUser : groupUsers) {
SalaryGroupUserResult.SimpleUserData simpleUserData = new SalaryGroupUserResult.SimpleUserData();
simpleUserData.setUserId(salaryGroupUser.getUserId());
simpleUserData.setUserName(salaryGroupUser.getUserName());
simpleUserData.setShopId(salaryGroupUser.getShopId());
simpleUserData.setShopName(salaryGroupUser.getShopName());
list.add(simpleUserData);
}
return list;
}
public SalaryGroupUserResult queryGroupSalaryUser(SalaryGroupUserQuery salaryGroupUserQuery) {
final Long groupId = salaryGroupUserQuery.getGroupId();
|
a310d67e
姜超
feature(*): 绩效薪酬 ...
|
413
414
415
|
final Date dataDate = new Date(salaryGroupUserQuery.getDataDate());
log.info("查询薪酬组人员,日期:{}", new SimpleDateFormat("yyyy-MM-dd").format(dataDate));
final YearMonth monthly = YearMonth.from(DateUtil.date2LocalDateTime(dataDate));
|
f044b7a6
姜超
feature(*): 薪酬组人员查询
|
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
|
List<SalaryGroupUserResult.SimpleUserData> userData = new ArrayList<>();
List<SalaryPool> pools = salaryPoolService.list(Wrappers.<SalaryPool>lambdaQuery()
.eq(SalaryPool::getGroupId, groupId)
.eq(SalaryPool::getMonthly, monthly)
.eq(SalaryPool::getYn, Boolean.TRUE)
);
SalaryGroupUserResult result = new SalaryGroupUserResult();
if (PublicUtil.isEmpty(pools)) {
result.setUserIdList(new ArrayList<>());
return result;
}
for (SalaryPool pool : pools) {
SalaryGroupUserResult.SimpleUserData simpleUserData = new SalaryGroupUserResult.SimpleUserData();
simpleUserData.setUserId(pool.getUserId());
simpleUserData.setUserName(pool.getUserName());
simpleUserData.setShopId(pool.getShopId());
simpleUserData.setShopName(pool.getShopName());
userData.add(simpleUserData);
}
result.setUserIdList(userData);
return result;
}
|
168b0458
张志伟
feature(*): 薪酬模块数...
|
439
|
}
|