2d8a2633
张志伟
feature(*): 薪酬池查询...
|
1
2
|
package cn.fw.morax.service.biz.salary;
|
c574c94a
姜超
feature(*): 推送财务的...
|
3
|
import cn.fw.common.data.mybatis.pagination.PageData;
|
2d8a2633
张志伟
feature(*): 薪酬池查询...
|
4
|
import cn.fw.common.page.AppPage;
|
45c0814e
姜超
feature(*): 薪酬查询调整
|
5
|
import cn.fw.common.web.auth.LoginAuthBean;
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
6
|
import cn.fw.morax.common.constant.Constant;
|
59d58c08
姜超
feature(*): excel...
|
7
|
import cn.fw.morax.common.utils.PublicUtil;
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
8
|
import cn.fw.morax.common.utils.StringUtils;
|
6f16e17a
姜超
feature(*): 多线程方式...
|
9
|
import cn.fw.morax.common.utils.ThreadPoolUtil;
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
10
|
import cn.fw.morax.domain.db.kpi.*;
|
da234187
姜超
feature(*): 绩效、薪酬...
|
11
|
import cn.fw.morax.domain.db.salary.*;
|
c574c94a
姜超
feature(*): 推送财务的...
|
12
|
import cn.fw.morax.domain.dto.query.PaySalaryQueryDTO;
|
2d8a2633
张志伟
feature(*): 薪酬池查询...
|
13
|
import cn.fw.morax.domain.dto.query.SalaryPoolQueryDTO;
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
14
|
import cn.fw.morax.domain.enums.*;
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
15
|
import cn.fw.morax.domain.vo.SelectorVO;
|
59d58c08
姜超
feature(*): excel...
|
16
|
import cn.fw.morax.domain.vo.salary.*;
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
17
|
import cn.fw.morax.rpc.erp.ErpRpcService;
|
59d58c08
姜超
feature(*): excel...
|
18
|
import cn.fw.morax.service.biz.CommonService;
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
19
|
import cn.fw.morax.service.data.kpi.IndicatorUserValueService;
|
da234187
姜超
feature(*): 绩效、薪酬...
|
20
|
import cn.fw.morax.service.data.salary.*;
|
459e4fde
姜超
fix(kpipool、salar...
|
21
|
import com.alibaba.fastjson.JSON;
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
22
23
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
59d58c08
姜超
feature(*): excel...
|
24
|
import com.google.common.collect.Lists;
|
c79f2cf7
姜超
feature(*): 薪酬池详情查询
|
25
|
import lombok.Getter;
|
2d8a2633
张志伟
feature(*): 薪酬池查询...
|
26
27
|
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
|
c79f2cf7
姜超
feature(*): 薪酬池详情查询
|
28
|
import org.springframework.beans.factory.annotation.Value;
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
29
|
import org.springframework.cache.annotation.Cacheable;
|
2d8a2633
张志伟
feature(*): 薪酬池查询...
|
30
|
import org.springframework.stereotype.Service;
|
2d8a2633
张志伟
feature(*): 薪酬池查询...
|
31
|
|
ed509f38
姜超
feature(*): 格式化excel
|
32
|
import javax.servlet.http.HttpServletRequest;
|
59d58c08
姜超
feature(*): excel...
|
33
34
|
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
|
da234187
姜超
feature(*): 绩效、薪酬...
|
35
|
import java.time.LocalDate;
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
36
|
import java.time.YearMonth;
|
68457b36
姜超
feature(*): 修改薪酬项详情
|
37
|
import java.time.temporal.TemporalAdjusters;
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
38
|
import java.util.*;
|
6f16e17a
姜超
feature(*): 多线程方式...
|
39
40
|
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
|
37ac70d8
姜超
feature(*): 薪酬详情修改
|
41
|
import java.util.function.Function;
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
42
43
44
45
|
import java.util.stream.Collectors;
import static cn.fw.common.businessvalidator.Validator.BV;
|
2d8a2633
张志伟
feature(*): 薪酬池查询...
|
46
47
48
49
50
51
52
53
54
55
56
|
/**
* @author : kurisu
* @version : 1.0
* @className : SalaryPoolBizService
* @description : 薪酬池业务service
* @date : 2022-05-05 11:10
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class SalaryPoolBizService {
|
da234187
姜超
feature(*): 绩效、薪酬...
|
57
|
private final SalaryGroupProjectSettinService salaryGroupProjectSettinService;
|
68457b36
姜超
feature(*): 修改薪酬项详情
|
58
|
private final SalaryGroupProjectService salaryGroupProjectService;
|
a403bf65
姜超
feature(*): 查询薪酬、...
|
59
|
private final SalaryGeneralSettinService salaryGeneralSettinService;
|
9f674ed5
张志伟
|
60
|
private final SalaryGroupProjectHitLogService salaryGroupProjectHitLogService;
|
a403bf65
姜超
feature(*): 查询薪酬、...
|
61
|
private final SalaryPoolDetailService salaryPoolDetailService;
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
62
63
64
65
|
private final SalaryGroupProjectPreconditionService salaryGroupProjectPreconditionService;
private final SalaryGroupProjectParamService salaryGroupProjectParamService;
private final SalaryGroupProjectTargetHitLogService salaryGroupProjectTargetHitLogService;
private final IndicatorUserValueService indicatorUserValueService;
|
459e4fde
姜超
fix(kpipool、salar...
|
66
|
private final SalaryGroupUserService salaryGroupUserService;
|
a403bf65
姜超
feature(*): 查询薪酬、...
|
67
|
private final SalaryPoolService salaryPoolService;
|
baf571c2
姜超
feature(*): 查询员工星...
|
68
|
private final CommonService commonService;
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
69
|
private final ErpRpcService erpRpcService;
|
2d8a2633
张志伟
feature(*): 薪酬池查询...
|
70
|
|
c79f2cf7
姜超
feature(*): 薪酬池详情查询
|
71
72
73
74
75
76
77
|
@Value("${special-indicator-code.work-age}")
@Getter
private String workAgeCode;
@Value("${special-indicator-code.base-salary}")
@Getter
private String baseSalaryCode;
|
2d8a2633
张志伟
feature(*): 薪酬池查询...
|
78
79
80
|
/**
* 查询薪酬池
*
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
81
82
83
84
|
* @param queryDTO 查询条件
* @return 薪酬池列表
*/
public AppPage<SalaryPoolVO> queryPool(final SalaryPoolQueryDTO queryDTO) {
|
18fac577
张志伟
feature(*): 发放工资 ...
|
85
86
87
88
89
90
91
92
|
SalaryGeneralSettin settin = salaryGeneralSettinService.getOne(Wrappers.<SalaryGeneralSettin>lambdaQuery()
.eq(SalaryGeneralSettin::getGroupId, queryDTO.getGroupId())
.eq(SalaryGeneralSettin::getYn, Boolean.TRUE)
, Boolean.FALSE);
if (Objects.nonNull(settin)) {
Boolean leaderVisibility = settin.getLeaderVisibility();
BV.isTrue(leaderVisibility, () -> "本集团不允许管理层查看员工薪资, 请联系集团管理员开通");
}
|
baf571c2
姜超
feature(*): 查询员工星...
|
93
|
|
71b11fad
姜超
feature(*): 查看管理层薪酬池
|
94
95
96
97
98
|
if (PublicUtil.isNotEmpty(queryDTO.getManagerUserId())) {
queryDTO.setManagerStaffList(commonService.queryManageStaffIds(queryDTO.getManagerUserId(), queryDTO.getMonthly()));
} else {
queryDTO.setManagerStaffList(commonService.queryManageStaffIds(queryDTO.getCurrentUserId(), queryDTO.getMonthly()));
}
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
99
|
prepareParams(queryDTO);
|
161fbd57
姜超
feature(*): 日志打印
|
100
|
log.info("薪酬池查询参数:{}", JSON.toJSONString(queryDTO));
|
40d1d577
姜超
feature(salary): ...
|
101
|
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
AppPage<SalaryPoolVO> page = AppPage.empty(queryDTO);
long total = salaryPoolService.queryPagePoolTotal(queryDTO);
if (total > 0) {
page.setTotal(total);
List<SalaryPoolVO> salaryPoolList = salaryPoolService.queryPagePool(queryDTO);
page.setData(salaryPoolList);
}
return page;
}
/**
* 查询薪酬池详情
*
* @param poolId 薪酬池id
* @return 薪酬池详情
*/
|
cb300833
姜超
feature(*): 查询方法修改
|
118
|
public StaffSalaryVO queryPoolDetail(final Long poolId, final YearMonth yearMonth) {
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
119
120
121
|
SalaryPool pool = salaryPoolService.getById(poolId);
boolean flag = Objects.nonNull(pool) && Boolean.TRUE.equals(pool.getYn());
BV.isTrue(flag, () -> "该人员薪酬数据不存在");
|
9f674ed5
张志伟
|
122
|
if (PublicUtil.isNotEmpty(yearMonth) && (!yearMonth.equals(pool.getMonthly()))) {
|
cb300833
姜超
feature(*): 查询方法修改
|
123
124
125
126
|
List<SalaryPool> list = userSalaryPool(pool.getUserId(), yearMonth);
BV.isNotEmpty(list, () -> "人员薪酬数据不存在");
pool = list.get(0);
}
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
127
128
129
130
131
132
133
134
135
136
|
return getPoolDetail(pool);
}
/**
* 查询薪酬池详情
*
* @param userId 用户id
* @param yearMonth 月度
* @return 薪酬池详情
*/
|
cb300833
姜超
feature(*): 查询方法修改
|
137
|
public StaffSalaryVO queryUserPoolDetail(final Long userId, final YearMonth yearMonth) {
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
138
139
140
141
142
143
144
145
146
147
148
149
|
List<SalaryPool> list = userSalaryPool(userId, yearMonth);
BV.isNotEmpty(list, () -> "人员薪酬数据不存在");
SalaryPool salaryPool = list.get(0);
return getPoolDetail(salaryPool);
}
/**
* 查询薪酬池选项
*
* @param userId 用户id
* @param yearMonth 月度
* @return 薪酬池选项
|
2d8a2633
张志伟
feature(*): 薪酬池查询...
|
150
|
*/
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
151
152
153
154
155
156
|
public Set<SelectorVO> salaryPoolSelector(final Long userId, final YearMonth yearMonth) {
List<SalaryPool> list = userSalaryPool(userId, yearMonth);
if (CollectionUtils.isEmpty(list)) {
return new HashSet<>();
}
return list.stream().map(r -> SelectorVO.whit(r.getId(), r.getShopName(), r.getPostName())).collect(Collectors.toSet());
|
2d8a2633
张志伟
feature(*): 薪酬池查询...
|
157
|
}
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
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
|
/**
* 查询用户月度薪酬池列表
*
* @param userId 用户id
* @param yearMonth 月度
* @return 返回结果
*/
@Cacheable(cacheNames = "salary", key = "':user:pool:'+ #yearMonth.toString() +':'+ #userId", unless = "#result.size() < 1")
public List<SalaryPool> userSalaryPool(final Long userId, final YearMonth yearMonth) {
List<SalaryPool> list = salaryPoolService.list(Wrappers.<SalaryPool>lambdaQuery()
.eq(SalaryPool::getUserId, userId)
.eq(SalaryPool::getMonthly, yearMonth)
.eq(SalaryPool::getYn, Boolean.TRUE)
.orderByDesc(SalaryPool::getId)
);
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
return list;
}
/**
* 查询详情
*
* @param pool 薪酬池
* @return 详情
*/
|
a403bf65
姜超
feature(*): 查询薪酬、...
|
186
|
private StaffSalaryVO getPoolDetail(SalaryPool pool) {
|
46340cc5
姜超
feature(*): 修改收入、...
|
187
|
StaffSalaryVO vo = this.convertToSalaryVO(pool);
|
dc3ff325
姜超
feature(*): 薪酬组开始...
|
188
|
buildPoolData(pool, vo);
|
1d01b24e
姜超
feature(*): 时间处理
|
189
|
LocalDate dataDate = LocalDate.from(vo.getEndTime());
|
dc3ff325
姜超
feature(*): 薪酬组开始...
|
190
191
|
List<SalaryPoolDetailVO> salaryDetailList = salaryPoolDetailService.queryByPoolId(pool.getId(), pool.getSalaryGroupId(), dataDate);
BV.isNotEmpty(salaryDetailList, () -> "该人员薪酬数据不存在");
|
a403bf65
姜超
feature(*): 查询薪酬、...
|
192
193
194
|
Map<SalaryTypeEnum, List<SalaryPoolDetailVO>> salaryTypeMap = salaryDetailList.stream().collect(Collectors.groupingBy(SalaryPoolDetailVO::getType));
for (Map.Entry<SalaryTypeEnum, List<SalaryPoolDetailVO>> salaryDetail : salaryTypeMap.entrySet()) {
detailClassification(vo, salaryDetail.getKey(), salaryDetail.getValue());
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
195
|
}
|
c79f2cf7
姜超
feature(*): 薪酬池详情查询
|
196
197
|
Collections.sort(vo.getIncome());
Collections.sort(vo.getDeduct());
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
198
199
200
|
return vo;
}
|
8ffdc70e
姜超
feature(*): 薪酬、绩效查询
|
201
|
/**
|
dc3ff325
姜超
feature(*): 薪酬组开始...
|
202
203
204
205
206
207
208
209
210
211
|
* 查询薪酬开始日期,结束日期
*
* @param salaryPool
* @return
*/
public void buildPoolData(SalaryPool salaryPool, StaffSalaryVO vo) {
SalaryGroupUser salaryGroupUser = salaryGroupUserService.getMonthLastData(salaryPool.getSgc(),
salaryPool.getUserId(), salaryPool.getMonthly());
if (PublicUtil.isEmpty(salaryGroupUser)) {
log.error("员工薪酬池:{},不存在绩效组人员数据", JSON.toJSONString(salaryPool));
|
1d01b24e
姜超
feature(*): 时间处理
|
212
213
|
vo.setEndTime(PublicUtil.getYesterdayOrEndOfMonthDay(salaryPool.getMonthly()).atTime(23, 59, 59));
vo.setStartTime(salaryPool.getMonthly().atDay(1).atTime(00, 00, 00));
|
dc3ff325
姜超
feature(*): 薪酬组开始...
|
214
215
|
return;
}
|
1d01b24e
姜超
feature(*): 时间处理
|
216
|
vo.setEndTime(salaryGroupUser.getDataDate().atTime(23, 59, 59));
|
dc3ff325
姜超
feature(*): 薪酬组开始...
|
217
218
|
SalaryGroupUser firstSalaryGroupUser = salaryGroupUserService.getMonthFirstData(salaryPool.getSgc(),
salaryPool.getUserId(), salaryPool.getMonthly());
|
1d01b24e
姜超
feature(*): 时间处理
|
219
|
vo.setStartTime(firstSalaryGroupUser.getDataDate().atTime(00, 00, 00));
|
dc3ff325
姜超
feature(*): 薪酬组开始...
|
220
221
222
223
|
}
/**
* 查询薪酬结束日期
|
459e4fde
姜超
fix(kpipool、salar...
|
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
*
* @param salaryPool
* @return
*/
public LocalDate getPoolLastData(SalaryPool salaryPool) {
SalaryGroupUser salaryGroupUser = salaryGroupUserService.getMonthLastData(salaryPool.getSgc(),
salaryPool.getUserId(), salaryPool.getMonthly());
if (PublicUtil.isEmpty(salaryGroupUser)) {
log.error("员工薪酬池:{},不存在绩效组人员数据", JSON.toJSONString(salaryPool));
return PublicUtil.getYesterdayOrEndOfMonthDay(salaryPool.getMonthly());
}
return salaryGroupUser.getDataDate();
}
/**
|
8ffdc70e
姜超
feature(*): 薪酬、绩效查询
|
239
240
241
242
243
244
|
* 详情分类
*
* @param vo
* @param type
* @param list
*/
|
a403bf65
姜超
feature(*): 查询薪酬、...
|
245
|
private void detailClassification(StaffSalaryVO vo, SalaryTypeEnum type, List<SalaryPoolDetailVO> list) {
|
f6f77e0a
张志伟
|
246
|
if (CollectionUtils.isEmpty(list)) {
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
247
248
|
return;
}
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
249
|
summarySalaryRewards(vo, type, list);
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
250
|
BigDecimal income = BigDecimal.ZERO;
|
ea14488d
姜超
feature(*): 薪酬池详情查询
|
251
|
BigDecimal salaryTypeAmount = BigDecimal.ZERO;
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
252
|
if (type.isPlus()) {
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
253
|
List<IncomeProjectVO> incomes = Lists.newArrayList();
|
a403bf65
姜超
feature(*): 查询薪酬、...
|
254
|
for (SalaryPoolDetailVO detail : list) {
|
ea14488d
姜超
feature(*): 薪酬池详情查询
|
255
|
income = income.add(detail.getActualSalaryAmount());
|
0cd1aa5d
姜超
feature(*): 薪酬池详情...
|
256
|
salaryTypeAmount = salaryTypeAmount.add(detail.getSalaryAmount());
|
c79f2cf7
姜超
feature(*): 薪酬池详情查询
|
257
258
259
|
IncomeProjectVO incomeProjectVO = this.convertToIncomeVO(detail);
incomeProjectVO.setBaseWage(this.checkIsBaseWage(detail.getSalaryGroupProjectId()));
incomes.add(incomeProjectVO);
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
260
|
}
|
ea14488d
姜超
feature(*): 薪酬池详情查询
|
261
|
vo.getIncome().add(new IncomeVO(type, salaryTypeAmount, incomes));
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
262
263
264
|
} else {
List<DeductProjectVO> deducts = Lists.newArrayList();
for (SalaryPoolDetailVO detail : list) {
|
0cd1aa5d
姜超
feature(*): 薪酬池详情...
|
265
|
salaryTypeAmount = salaryTypeAmount.add(detail.getSalaryAmount());
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
266
|
deducts.add(this.convertToDeductVO(detail));
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
267
|
}
|
ea14488d
姜超
feature(*): 薪酬池详情查询
|
268
|
vo.getDeduct().add(new DeductVO(type, salaryTypeAmount, deducts));
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
269
|
}
|
ea14488d
姜超
feature(*): 薪酬池详情查询
|
270
|
vo.setTotalWages(vo.getTotalWages().add(income));
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
271
272
273
|
}
|
46340cc5
姜超
feature(*): 修改收入、...
|
274
275
276
277
278
|
/**
* 准备分页参数
*
* @param queryVO
*/
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
private void prepareParams(SalaryPoolQueryDTO queryVO) {
if (Objects.isNull(queryVO.getMonthly())) {
queryVO.setMonthly(YearMonth.now());
}
if (Objects.nonNull(queryVO.getOrder()) && StringUtils.isValid(queryVO.getOrderAtt())) {
StringBuilder sb = new StringBuilder(" order by ");
sb.append(StringUtils.toColumnName(queryVO.getOrderAtt()).toLowerCase());
if (queryVO.getOrder() == 1) {
sb.append(" asc ");
} else {
sb.append(" desc ");
}
queryVO.setOrderString(sb.toString());
}
|
bf843228
姜超
feature(*): 修改参数
|
293
|
if (PublicUtil.isEmpty(queryVO.getQueryStaffs()) && PublicUtil.isNotEmpty(queryVO.getQueryStaffs())) {
|
40d1d577
姜超
feature(salary): ...
|
294
295
296
|
List<Long> queryStaffIds = Arrays.stream(queryVO.getQueryStaffs().split(",")).map(Long::parseLong).collect(Collectors.toList());
queryVO.getManagerStaffList().retainAll(queryStaffIds);
}
|
4ae2c2ba
张志伟
feature(*): 薪酬池查询...
|
297
298
|
}
|
59d58c08
姜超
feature(*): excel...
|
299
300
301
302
303
304
305
306
|
/**
* 获取员工薪酬
*
* @param staffIds
* @param shopIds
* @param yearMonth
* @return
*/
|
83fc9174
姜超
feature(*): 薪酬项查询...
|
307
|
public List<StaffSalaryDetailVO> getStaffsSalary(List<Long> staffIds, List<Long> shopIds, YearMonth yearMonth) {
|
59d58c08
姜超
feature(*): excel...
|
308
|
List<SalaryPool> pools = salaryPoolService.list(Wrappers.<SalaryPool>lambdaQuery()
|
9f674ed5
张志伟
|
309
|
.in(PublicUtil.isNotEmpty(staffIds), SalaryPool::getUserId, staffIds)
|
59d58c08
姜超
feature(*): excel...
|
310
311
312
313
314
315
316
|
.in(PublicUtil.isNotEmpty(shopIds), SalaryPool::getShopId, shopIds)
.eq(SalaryPool::getMonthly, yearMonth)
.eq(SalaryPool::getYn, Boolean.TRUE)
);
if (PublicUtil.isEmpty(pools)) {
return new ArrayList<>();
}
|
83fc9174
姜超
feature(*): 薪酬项查询...
|
317
|
List<StaffSalaryDetailVO> staffSalaryVos = Lists.newArrayListWithCapacity(pools.size());
|
59d58c08
姜超
feature(*): excel...
|
318
319
320
321
322
323
|
List<Long> poolIds = pools.stream().map(SalaryPool::getId).collect(Collectors.toList());
List<SalaryPoolDetail> poolDetails = salaryPoolDetailService.list(Wrappers.<SalaryPoolDetail>lambdaQuery()
.in(SalaryPoolDetail::getSalaryPoolId, poolIds)
.eq(SalaryPoolDetail::getYn, Boolean.TRUE)
);
Map<Long, List<SalaryPoolDetail>> poolDetailMap = poolDetails.stream().collect(Collectors.groupingBy(SalaryPoolDetail::getSalaryPoolId));
|
83fc9174
姜超
feature(*): 薪酬项查询...
|
324
|
StaffSalaryDetailVO staffSalaryVo = null;
|
59d58c08
姜超
feature(*): excel...
|
325
|
for (SalaryPool salaryPool : pools) {
|
a57fcb69
姜超
feature(*): 导出代码修改
|
326
|
staffSalaryVo = this.convertVo(salaryPool, poolDetailMap);
|
59d58c08
姜超
feature(*): excel...
|
327
328
329
330
331
332
|
staffSalaryVos.add(staffSalaryVo);
}
return staffSalaryVos;
}
/**
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
333
334
335
336
337
338
339
340
341
|
* 汇总数据
*
* @param vo
* @param type
* @param list
*/
private void summarySalaryRewards(StaffSalaryVO vo, SalaryTypeEnum type, List<SalaryPoolDetailVO> list) {
switch (type) {
|
9f674ed5
张志伟
|
342
|
case NECESSARY: {
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
343
344
345
346
347
348
|
BigDecimal socialSecurity = list.stream()
.map(SalaryPoolDetailVO::getActualSalaryAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setSocialSecurity(socialSecurity);
break;
}
|
9f674ed5
张志伟
|
349
|
case AWARD: {
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
350
351
352
353
354
355
|
BigDecimal paidRewards = list.stream()
.map(SalaryPoolDetailVO::getProcessedAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setPaidRewards(paidRewards);
break;
}
|
9f674ed5
张志伟
|
356
|
case PENALTY: {
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
357
|
BigDecimal paidRewards = list.stream()
|
9f674ed5
张志伟
|
358
359
360
|
.map(detail -> {
return detail.getActualSalaryAmount().subtract(detail.getProcessedAmount());
})
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
361
362
363
364
365
366
367
368
369
370
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setNoPaidPunishRewards(paidRewards);
break;
}
}
}
/**
|
46340cc5
姜超
feature(*): 修改收入、...
|
371
372
373
374
375
376
377
|
* 转换为收入对象
*
* @param detail
* @return
*/
private IncomeProjectVO convertToIncomeVO(SalaryPoolDetailVO detail) {
IncomeProjectVO incomeProjectVO = new IncomeProjectVO();
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
378
379
380
|
if (PublicUtil.isNotEmpty(detail.getSalaryGroupProjectId())) {
incomeProjectVO.setSalaryGroupProjectId(detail.getSalaryGroupProjectId());
incomeProjectVO.setSalaryGroupProjectName(detail.getSalaryGroupProjectName());
|
c7a2ecdf
姜超
feature(*): 查询薪酬池...
|
381
|
}
|
46340cc5
姜超
feature(*): 修改收入、...
|
382
|
incomeProjectVO.setSalaryType(detail.getType());
|
45c0814e
姜超
feature(*): 薪酬查询调整
|
383
|
incomeProjectVO.setCalMethod(detail.getCalMethod());
|
46340cc5
姜超
feature(*): 修改收入、...
|
384
|
incomeProjectVO.setTotalAmount(detail.getSalaryAmount());
|
3ecdbd72
姜超
feature(*): 展示工资明...
|
385
386
|
incomeProjectVO.setSendAmount(detail.getProcessedAmount());
incomeProjectVO.setNoSendAmount(detail.getActualSalaryAmount());
|
46340cc5
姜超
feature(*): 修改收入、...
|
387
388
389
390
391
392
393
394
395
396
397
|
return incomeProjectVO;
}
/**
* 转换为支出对象
*
* @param detail
* @return
*/
private DeductProjectVO convertToDeductVO(SalaryPoolDetailVO detail) {
DeductProjectVO deductProjectVO = new DeductProjectVO();
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
398
399
400
|
if (PublicUtil.isNotEmpty(detail.getSalaryGroupProjectId())) {
deductProjectVO.setSalaryGroupProjectId(detail.getSalaryGroupProjectId());
deductProjectVO.setSalaryGroupProjectName(detail.getSalaryGroupProjectName());
|
46340cc5
姜超
feature(*): 修改收入、...
|
401
|
}
|
46340cc5
姜超
feature(*): 修改收入、...
|
402
|
deductProjectVO.setSalaryType(detail.getType());
|
45c0814e
姜超
feature(*): 薪酬查询调整
|
403
|
deductProjectVO.setCalMethod(detail.getCalMethod());
|
46340cc5
姜超
feature(*): 修改收入、...
|
404
405
|
deductProjectVO.setTotalAmount(detail.getSalaryAmount());
deductProjectVO.setPaidAmount(detail.getProcessedAmount());
|
3ecdbd72
姜超
feature(*): 展示工资明...
|
406
|
deductProjectVO.setNoPaidAmount(detail.getActualSalaryAmount());
|
46340cc5
姜超
feature(*): 修改收入、...
|
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
|
return deductProjectVO;
}
/**
* 转换为员工薪酬vo
*
* @param pool
* @return
*/
private StaffSalaryVO convertToSalaryVO(SalaryPool pool) {
StaffSalaryVO vo = new StaffSalaryVO();
vo.setSalaryPoolId(pool.getId());
vo.setUserId(pool.getUserId());
vo.setUserName(pool.getUserName());
vo.setMonthly(pool.getMonthly());
vo.setPostId(pool.getPostId());
vo.setPostName(pool.getPostName());
vo.setShopId(pool.getShopId());
vo.setShopName(pool.getShopName());
vo.setWages(pool.getReward());
vo.setStarLevel(pool.getStarLevel());
|
ea14488d
姜超
feature(*): 薪酬池详情查询
|
428
429
430
431
|
vo.setTotalWages(BigDecimal.ZERO);
vo.setIncome(new LinkedList<>());
vo.setDeduct(new LinkedList<>());
|
46340cc5
姜超
feature(*): 修改收入、...
|
432
433
434
435
|
return vo;
}
/**
|
a57fcb69
姜超
feature(*): 导出代码修改
|
436
437
438
439
440
441
|
* 转换为vo
*
* @param salaryPool
* @param poolDetailMap
* @return
*/
|
83fc9174
姜超
feature(*): 薪酬项查询...
|
442
|
private StaffSalaryDetailVO convertVo(SalaryPool salaryPool, Map<Long, List<SalaryPoolDetail>> poolDetailMap) {
|
a57fcb69
姜超
feature(*): 导出代码修改
|
443
|
Long userId = salaryPool.getUserId();
|
3ecdbd72
姜超
feature(*): 展示工资明...
|
444
|
Long poolId = salaryPool.getId();
|
83fc9174
姜超
feature(*): 薪酬项查询...
|
445
|
StaffSalaryDetailVO staffSalaryVo = new StaffSalaryDetailVO();
|
a57fcb69
姜超
feature(*): 导出代码修改
|
446
447
448
449
450
451
452
453
454
455
456
|
staffSalaryVo.setId(salaryPool.getId());
staffSalaryVo.setSalaryGroupId(salaryPool.getSalaryGroupId());
staffSalaryVo.setUserId(userId);
staffSalaryVo.setUserName(salaryPool.getUserName());
staffSalaryVo.setPostId(salaryPool.getPostId());
staffSalaryVo.setPostName(salaryPool.getPostName());
staffSalaryVo.setShopId(salaryPool.getShopId());
staffSalaryVo.setShopName(salaryPool.getShopName());
staffSalaryVo.setStarLevel(salaryPool.getStarLevel());
staffSalaryVo.setWages(salaryPool.getReward());
staffSalaryVo.setMonthly(salaryPool.getMonthly());
|
3ecdbd72
姜超
feature(*): 展示工资明...
|
457
458
459
460
461
462
463
|
staffSalaryVo.setMonthlyStr(salaryPool.getMonthly().toString());
staffSalaryVo.setAward(BigDecimal.ZERO);
staffSalaryVo.setRoyalties(BigDecimal.ZERO);
staffSalaryVo.setSubsidy(BigDecimal.ZERO);
staffSalaryVo.setNecessary(BigDecimal.ZERO);
staffSalaryVo.setPenalty(BigDecimal.ZERO);
|
9f674ed5
张志伟
|
464
|
if (!poolDetailMap.containsKey(poolId)) {
|
a57fcb69
姜超
feature(*): 导出代码修改
|
465
466
|
return staffSalaryVo;
}
|
3ecdbd72
姜超
feature(*): 展示工资明...
|
467
|
List<SalaryPoolDetail> staffSalaryDetails = poolDetailMap.get(poolId);
|
a57fcb69
姜超
feature(*): 导出代码修改
|
468
469
470
471
|
for (SalaryPoolDetail salaryDetail : staffSalaryDetails) {
BigDecimal amount = salaryDetail.getSalaryAmount();
switch (salaryDetail.getType()) {
case AWARD: {
|
3ecdbd72
姜超
feature(*): 展示工资明...
|
472
|
staffSalaryVo.setAward(staffSalaryVo.getAward().add(amount));
|
a57fcb69
姜超
feature(*): 导出代码修改
|
473
474
475
|
break;
}
case ROYALTIES: {
|
3ecdbd72
姜超
feature(*): 展示工资明...
|
476
|
staffSalaryVo.setRoyalties(staffSalaryVo.getRoyalties().add(amount));
|
a57fcb69
姜超
feature(*): 导出代码修改
|
477
478
479
|
break;
}
case SUBSIDY: {
|
3ecdbd72
姜超
feature(*): 展示工资明...
|
480
|
staffSalaryVo.setSubsidy(staffSalaryVo.getSubsidy().add(amount));
|
a57fcb69
姜超
feature(*): 导出代码修改
|
481
482
483
|
break;
}
case NECESSARY: {
|
3ecdbd72
姜超
feature(*): 展示工资明...
|
484
|
staffSalaryVo.setNecessary(staffSalaryVo.getNecessary().add(amount));
|
a57fcb69
姜超
feature(*): 导出代码修改
|
485
486
487
|
break;
}
case PENALTY: {
|
3ecdbd72
姜超
feature(*): 展示工资明...
|
488
|
staffSalaryVo.setPenalty(staffSalaryVo.getPenalty().add(amount));
|
a57fcb69
姜超
feature(*): 导出代码修改
|
489
490
491
492
493
494
495
496
|
break;
}
}
}
return staffSalaryVo;
}
/**
|
59d58c08
姜超
feature(*): excel...
|
497
498
|
* 下载员工excel文件
*
|
3ecdbd72
姜超
feature(*): 展示工资明...
|
499
500
501
|
* @param currentUser
* @param yearMonth
* @param request
|
59d58c08
姜超
feature(*): excel...
|
502
503
|
* @param response
*/
|
3ecdbd72
姜超
feature(*): 展示工资明...
|
504
505
506
507
|
public void downloadStaffsSalary(LoginAuthBean currentUser, YearMonth yearMonth, HttpServletRequest request, HttpServletResponse response) {
BV.isTrue(erpRpcService.hasRole(currentUser.getUserId(), Constant.ROLE_CODE_WAGE_PAYMENT), "员工没有工资发放角色");
List<Long> shopIds = erpRpcService.queryUserRoleShopIds(currentUser.getUserId(), Constant.ROLE_CODE_WAGE_PAYMENT);
List<StaffSalaryDetailVO> staffSalaryDetailVOS = this.getStaffsSalary(null, shopIds, yearMonth);
|
2f26f193
姜超
feature(*): 个税导入、...
|
508
|
String fileName = "工资清单.xlsx";
|
ce966b05
姜超
feature(*): 导出文件编码修改
|
509
|
String encodeFileName = CommonService.getEncodeName(request, fileName);
|
83fc9174
姜超
feature(*): 薪酬项查询...
|
510
|
CommonService.downloadExcel(response, staffSalaryDetailVOS, encodeFileName, StaffSalaryDetailVO.class);
|
59d58c08
姜超
feature(*): excel...
|
511
512
|
}
|
da234187
姜超
feature(*): 绩效、薪酬...
|
513
|
/**
|
45c0814e
姜超
feature(*): 薪酬查询调整
|
514
515
|
* 查询员工工资
*
|
c574c94a
姜超
feature(*): 推送财务的...
|
516
|
* @param dto
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
517
518
|
* @return
*/
|
c574c94a
姜超
feature(*): 推送财务的...
|
519
|
public AppPage<StaffSalaryInfoVO> getStaffsWages(PaySalaryQueryDTO dto) {
|
9f674ed5
张志伟
|
520
|
if (!erpRpcService.hasRole(dto.getUserId(), Constant.ROLE_CODE_WAGE_PAYMENT)) {
|
e72e98bb
姜超
fix(*): 工资查看修改
|
521
522
523
|
return new AppPage<>();
}
// BV.isTrue(erpRpcService.hasRole(dto.getUserId(), Constant.ROLE_CODE_WAGE_PAYMENT), "员工没有工资发放角色");
|
c574c94a
姜超
feature(*): 推送财务的...
|
524
|
List<Long> shopIds = erpRpcService.queryUserRoleShopIds(dto.getUserId(), Constant.ROLE_CODE_WAGE_PAYMENT);
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
525
|
if (PublicUtil.isEmpty(shopIds)) {
|
c574c94a
姜超
feature(*): 推送财务的...
|
526
|
return new AppPage<>();
|
a7a26e53
姜超
feature(*): 支付薪酬查看
|
527
|
}
|
45c0814e
姜超
feature(*): 薪酬查询调整
|
528
|
|
c574c94a
姜超
feature(*): 推送财务的...
|
529
530
531
532
533
534
535
536
537
538
|
PageData<SalaryPool> pageData = salaryPoolService.page(new PageData<>(dto.getCurrent(), dto.getPageSize()),
Wrappers.<SalaryPool>lambdaQuery()
.in(PublicUtil.isNotEmpty(shopIds), SalaryPool::getShopId, shopIds)
.eq(SalaryPool::getMonthly, dto.getYearMonth())
.eq(SalaryPool::getYn, Boolean.TRUE)
);
return PublicUtil.toPage(pageData, salaryPool -> {
StaffSalaryInfoVO salaryInfoVO = PublicUtil.copy(salaryPool, StaffSalaryInfoVO.class);
return salaryInfoVO;
});
|
45c0814e
姜超
feature(*): 薪酬查询调整
|
539
540
541
|
}
/**
|
8ffdc70e
姜超
feature(*): 薪酬、绩效查询
|
542
543
544
|
* 绩效项目阶梯详情
*
* @param salaryPoolId
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
545
|
* @param salaryGroupProjectId
|
8ffdc70e
姜超
feature(*): 薪酬、绩效查询
|
546
547
548
|
* @param yearMonth
* @return
*/
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
549
|
public SalaryGroupIndicatorDetailVO getHitProjectSetting(Long salaryPoolId, Long salaryGroupProjectId, YearMonth yearMonth) {
|
0de15bdd
姜超
fix(*): 修改绩效查询bug
|
550
551
|
SalaryPool pool = salaryPoolService.getById(salaryPoolId);
BV.notNull(pool, "薪酬池不存在");
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
552
553
|
Long userId = pool.getUserId();
LocalDate localDate = getPoolLastData(pool);
|
0de15bdd
姜超
fix(*): 修改绩效查询bug
|
554
|
|
8b1d12ae
jiangchao
fix(*): 查询薪酬固定提成
|
555
|
SalaryGroupIndicatorDetailVO detailVO = new SalaryGroupIndicatorDetailVO();
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
556
|
SalaryGroupProject salaryGroupProject = salaryGroupProjectService.getById(salaryGroupProjectId);
|
8b1d12ae
jiangchao
fix(*): 查询薪酬固定提成
|
557
|
BV.notNull(salaryGroupProject, "薪酬项目不存在");
|
a45344cf
姜超
feature(bug): 修改目...
|
558
559
560
|
if (PublicUtil.isNotEmpty(salaryGroupProject.getLaddersType())) {
detailVO.setLaddersType(salaryGroupProject.getLaddersType());
}
|
6f16e17a
姜超
feature(*): 多线程方式...
|
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
|
CountDownLatch countDownLatch = new CountDownLatch(3);
ThreadPoolExecutor threadPool = ThreadPoolUtil.getInstance().getThreadPool();
threadPool.execute(() -> this.setSalaryGroupProjectParam(salaryGroupProjectId, userId, localDate, detailVO, countDownLatch));
threadPool.execute(() -> this.setSalaryGroupProjectPreconditionHitVos(salaryGroupProjectId, userId, localDate, detailVO, countDownLatch));
threadPool.execute(() -> this.setSalaryGroupProjectSetting(salaryGroupProject, userId, localDate, detailVO, countDownLatch));
detailVO.setName(salaryGroupProject.getName());
detailVO.setLadderParamAlias(salaryGroupProject.getLadderParamAlias());
detailVO.setCommissionParamAlias(salaryGroupProject.getCommissionParamAlias());
detailVO.setPreconditionAlias(salaryGroupProject.getPreconditionAlias());
detailVO.setCalMethod(salaryGroupProject.getCalMethod());
detailVO.setBeginDate(localDate.with(TemporalAdjusters.firstDayOfMonth()).atStartOfDay());
detailVO.setEndDate(localDate.atTime(23, 59, 59));
try {
countDownLatch.await();
} catch (InterruptedException e) {
log.error("绩效项目阶梯详情查询失败 -> salaryPoolId: [{}], salaryGroupProjectId: [{}], msg: [{}]",
salaryPoolId, salaryGroupProjectId, e);
}
return detailVO;
}
/**
* 设置阶梯
*
* @param salaryGroupProject
* @param userId
* @param localDate
* @param detailVO
* @param countDownLatch
*/
public void setSalaryGroupProjectSetting(SalaryGroupProject salaryGroupProject, Long userId, LocalDate localDate,
SalaryGroupIndicatorDetailVO detailVO,
CountDownLatch countDownLatch) {
Long salaryGroupProjectId = salaryGroupProject.getId();
|
596c448c
姜超
fix(*): 薪酬指标详情查询
|
600
601
602
603
604
|
List<SalaryGroupProjectSettin> settings = salaryGroupProjectSettinService.list(Wrappers.<SalaryGroupProjectSettin>lambdaQuery()
.eq(SalaryGroupProjectSettin::getSalaryGroupProjectId, salaryGroupProjectId)
.eq(SalaryGroupProjectSettin::getYn, Boolean.TRUE)
.orderByAsc(SalaryGroupProjectSettin::getId)
);
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
605
606
607
608
609
610
|
List<SalaryGroupProjectHitLog> salaryProjectHitLogs = salaryGroupProjectHitLogService.list(Wrappers.<SalaryGroupProjectHitLog>lambdaQuery()
.eq(SalaryGroupProjectHitLog::getUserId, userId)
.eq(SalaryGroupProjectHitLog::getSalaryGroupProjectId, salaryGroupProjectId)
.eq(SalaryGroupProjectHitLog::getDataDate, localDate)
.eq(SalaryGroupProjectHitLog::getYn, Boolean.TRUE)
);
|
596c448c
姜超
fix(*): 薪酬指标详情查询
|
611
|
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
612
|
//固定提成 车系
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
613
614
615
616
|
switch (salaryGroupProject.getCalMethod()) {
case CAR_SERIES: {
this.setCarSeriesProjectDetail(salaryProjectHitLogs, settings, detailVO);
break;
|
8b1d12ae
jiangchao
fix(*): 查询薪酬固定提成
|
617
|
}
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
618
619
620
621
622
|
case LADDER:
case FIXATION:
case STAR: {
this.setProjectDetail(salaryProjectHitLogs, settings, detailVO);
break;
|
03194976
姜超
feature(*): 绩效详情查询
|
623
|
}
|
596c448c
姜超
fix(*): 薪酬指标详情查询
|
624
|
}
|
6f16e17a
姜超
feature(*): 多线程方式...
|
625
|
countDownLatch.countDown();
|
8ffdc70e
姜超
feature(*): 薪酬、绩效查询
|
626
627
|
}
|
6f16e17a
姜超
feature(*): 多线程方式...
|
628
|
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
629
|
/**
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
|
* 设置车系详情
*
* @param salaryProjectHitLogs
* @param settings
* @param detailVO
*/
private void setProjectDetail(List<SalaryGroupProjectHitLog> salaryProjectHitLogs, List<SalaryGroupProjectSettin> settings, SalaryGroupIndicatorDetailVO detailVO) {
if (PublicUtil.isEmpty(salaryProjectHitLogs)) {
detailVO.setSettings(settings.stream().map(setting -> {
return PublicUtil.copy(setting, SalaryGroupProjectSettinVO.class);
}).collect(Collectors.toList()));
detailVO.setSalaryValue(new BigDecimal("0"));
return;
}
SalaryGroupProjectHitLog salaryProjectHitLog = salaryProjectHitLogs.stream().findFirst().get();
Long hitSettingId = salaryProjectHitLog.getSalaryGroupProjectSettinId();
|
dad803db
姜超
feature(*): 修改展示查询
|
649
|
Boolean ratio = PublicUtil.isNotEmpty(detailVO.getLaddersType()) && DataTypeEnum.RATIO.equals(detailVO.getLaddersType());
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
650
651
652
|
detailVO.setSettings(settings.stream().map(setting -> {
SalaryGroupProjectSettinVO settingVO = PublicUtil.copy(setting, SalaryGroupProjectSettinVO.class);
settingVO.setHit((hitSettingId.equals(settingVO.getId()) ? Boolean.TRUE : Boolean.FALSE));
|
43fb9eed
姜超
feature(*): 薪酬详情查询修改
|
653
654
|
if (hitSettingId.equals(settingVO.getId())) {
settingVO.setHitCommissionValue(salaryProjectHitLog.getHitCommissionValue());
|
bd1186a6
姜超
feature(bug): 修改目...
|
655
|
settingVO.setHitLadderValue(salaryProjectHitLog.getHitLadderValue());
|
43fb9eed
姜超
feature(*): 薪酬详情查询修改
|
656
|
}
|
dad803db
姜超
feature(*): 修改展示查询
|
657
658
659
|
if (ratio) {
settingVO.processPercent();
}
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
660
661
662
|
return settingVO;
}).collect(Collectors.toList()));
detailVO.setSalaryValue(salaryProjectHitLog.getSalaryValue());
|
4dec65f8
姜超
feature(*): 薪酬星级计...
|
663
664
665
|
if (PublicUtil.isEmpty(detailVO.getStarLevel())) {
detailVO.setStarLevel(detailVO.getStarLevel());
}
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
|
}
/**
* 设置车系详情
*
* @param salaryProjectHitLogs
* @param settings
* @param detailVO
*/
private void setCarSeriesProjectDetail(List<SalaryGroupProjectHitLog> salaryProjectHitLogs, List<SalaryGroupProjectSettin> settings, SalaryGroupIndicatorDetailVO detailVO) {
Map<Long, SalaryGroupProjectHitLog> hitMap = new HashMap<>();
if (PublicUtil.isNotEmpty(salaryProjectHitLogs)) {
hitMap = salaryProjectHitLogs.stream().collect(
Collectors.toMap(SalaryGroupProjectHitLog::getSalaryGroupProjectSettinId, Function.identity(), (v1, v2) -> v1));
}
BigDecimal totalSalaryValue = new BigDecimal("0");
List<SalaryGroupProjectSettinVO> settingVos = new ArrayList<>();
for (SalaryGroupProjectSettin setting : settings) {
SalaryGroupProjectSettinVO settingVO = PublicUtil.copy(setting, SalaryGroupProjectSettinVO.class);
if (hitMap.containsKey(setting.getId())) {
SalaryGroupProjectHitLog hitLog = hitMap.get(setting.getId());
|
a33e5d85
姜超
feature(*): 完善注释
|
689
|
if (PublicUtil.isNotEmpty(hitLog)) {
|
ec13659f
姜超
feature(*): 修改薪酬池查询
|
690
|
totalSalaryValue = totalSalaryValue.add(hitLog.getSalaryValue());
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
691
|
settingVO.setHit(Boolean.TRUE);
|
a33e5d85
姜超
feature(*): 完善注释
|
692
693
|
settingVO.setSalaryValue(hitLog.getSalaryValue());
settingVO.setHitCommissionValue(hitLog.getHitCommissionValue());
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
694
695
696
697
698
699
700
701
702
|
}
}
settingVos.add(settingVO);
}
detailVO.setSettings(settingVos);
detailVO.setSalaryValue(totalSalaryValue);
}
/**
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
703
704
705
706
707
708
709
|
* 获取绩效参数
*
* @param salaryGroupProjectId
* @param userId
* @param localDate
* @return
*/
|
6f16e17a
姜超
feature(*): 多线程方式...
|
710
711
712
|
public void setSalaryGroupProjectParam(Long salaryGroupProjectId, Long userId, LocalDate localDate,
SalaryGroupIndicatorDetailVO detailVO,
CountDownLatch countDownLatch) {
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
713
|
|
3d4edc47
姜超
feature(*): 薪酬项目下钻
|
714
|
List<SalaryGroupProjectParamVO> params = salaryGroupProjectParamService.getSalaryGroupProjectParamVO(salaryGroupProjectId);
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
715
|
if (PublicUtil.isEmpty(params)) {
|
6f16e17a
姜超
feature(*): 多线程方式...
|
716
717
|
countDownLatch.countDown();
return ;
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
718
|
}
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
719
720
721
|
List<Long> targetParamIds = params.stream()
.filter(param -> ! TargetTypeEnum.NO.equals(param.getTargetType()))
|
3d4edc47
姜超
feature(*): 薪酬项目下钻
|
722
723
724
725
726
|
.map(SalaryGroupProjectParamVO::getId).collect(Collectors.toList());
Map<Long, SalaryGroupProjectTargetHitLog> paramTargetHitLogMap = new HashMap<>();
if (PublicUtil.isNotEmpty(targetParamIds)) {
List<SalaryGroupProjectTargetHitLog> targetHitLogs = salaryGroupProjectTargetHitLogService.list(Wrappers.<SalaryGroupProjectTargetHitLog>lambdaQuery()
.in(SalaryGroupProjectTargetHitLog::getReferId, targetParamIds)
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
727
|
.in(SalaryGroupProjectTargetHitLog::getTargetType, IndicatorTypeEnum.EXAMINE)
|
3d4edc47
姜超
feature(*): 薪酬项目下钻
|
728
729
730
731
732
733
734
|
.eq(SalaryGroupProjectTargetHitLog::getDataDate, localDate)
.eq(SalaryGroupProjectTargetHitLog::getUserId, userId)
.eq(SalaryGroupProjectTargetHitLog::getYn, Boolean.TRUE)
);
paramTargetHitLogMap = targetHitLogs.stream()
.collect(Collectors.toMap(SalaryGroupProjectTargetHitLog::getReferId, Function.identity(), (v1, v2) -> v1));
}
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
735
736
|
List<String> indicatorCodes = params.stream()
|
3d4edc47
姜超
feature(*): 薪酬项目下钻
|
737
738
|
.filter(param -> TargetTypeEnum.NO.equals(param.getTargetType()))
.map(SalaryGroupProjectParamVO::getIndicatorCode).collect(Collectors.toList());
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
739
740
741
742
743
744
745
746
747
748
749
750
|
Map<String, IndicatorUserValue> indicatorCodeValueMap = new HashMap<>();
if (PublicUtil.isNotEmpty(indicatorCodes)) {
List<IndicatorUserValue> indicatorUserValues = indicatorUserValueService.list(Wrappers.<IndicatorUserValue>lambdaQuery()
.in(IndicatorUserValue::getIndicatorCode, indicatorCodes)
.eq(IndicatorUserValue::getDataDate, localDate)
.eq(IndicatorUserValue::getUserId, userId)
.eq(IndicatorUserValue::getYn, Boolean.TRUE)
);
indicatorCodeValueMap = indicatorUserValues.stream()
.collect(Collectors.toMap(IndicatorUserValue::getIndicatorCode, Function.identity(), (v1, v2) -> v1));
}
|
8f08359b
姜超
feature(*): 薪酬项新增字段
|
751
|
List<String> baseWageIndicatorCodes = new ArrayList<String>(){{add(getWorkAgeCode());add(getBaseSalaryCode());}};
|
3d4edc47
姜超
feature(*): 薪酬项目下钻
|
752
|
for (SalaryGroupProjectParamVO paramVO : params) {
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
753
|
//有目标
|
3d4edc47
姜超
feature(*): 薪酬项目下钻
|
754
755
|
if (paramTargetHitLogMap.containsKey(paramVO.getId())) {
SalaryGroupProjectTargetHitLog targetHitLog = paramTargetHitLogMap.get(paramVO.getId());
|
e79ac89b
姜超
feature(bug): 修改目...
|
756
757
|
paramVO.setReachValue(targetHitLog.getReachValue());
paramVO.setIndicatorValue(targetHitLog.getValue());
|
3d4edc47
姜超
feature(*): 薪酬项目下钻
|
758
|
|
e79ac89b
姜超
feature(bug): 修改目...
|
759
760
761
|
if (! TargetTypeEnum.NO.equals(paramVO.getTargetType())) {
paramVO.setReachValue(targetHitLog.getReachValue().multiply(Constant.ONE_HUNDRED));
}
|
3d4edc47
姜超
feature(*): 薪酬项目下钻
|
762
|
if (DataTypeEnum.RATIO.equals(paramVO.getDataType())) {
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
763
|
paramVO.setIndicatorValue(targetHitLog.getValue().multiply(Constant.ONE_HUNDRED));
|
3d4edc47
姜超
feature(*): 薪酬项目下钻
|
764
|
}
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
765
|
continue;
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
766
767
768
|
}
//无目标
if(indicatorCodeValueMap.containsKey(paramVO.getIndicatorCode())) {
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
769
|
IndicatorUserValue indicatorUserValue = indicatorCodeValueMap.get(paramVO.getIndicatorCode());
|
3d4edc47
姜超
feature(*): 薪酬项目下钻
|
770
|
BigDecimal indicatorOriginValue = commonService.queryIndicatorValue(paramVO.getIndicatorCode(), indicatorUserValue);
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
771
772
773
|
switch (indicatorUserValue.getValueType()) {
case WORK_AGE:
case QUANTITY: {
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
774
|
paramVO.setIndicatorValue(indicatorOriginValue);
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
775
776
777
|
break;
}
case RATIO: {
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
778
|
paramVO.setIndicatorValue(indicatorOriginValue.multiply(Constant.ONE_HUNDRED));
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
779
780
781
782
|
break;
}
}
}
|
8f08359b
姜超
feature(*): 薪酬项新增字段
|
783
|
paramVO.setBaseWage(baseWageIndicatorCodes.contains(paramVO.getIndicatorCode()));
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
784
785
|
}
|
3d4edc47
姜超
feature(*): 薪酬项目下钻
|
786
|
Map<ParamTypeEnum, List<SalaryGroupProjectParamVO>> indicatorParamMap = params.stream()
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
787
788
|
.collect(Collectors.groupingBy(SalaryGroupProjectParamVO::getParamType));
|
6f16e17a
姜超
feature(*): 多线程方式...
|
789
790
791
|
detailVO.setLadderParams(indicatorParamMap.getOrDefault(ParamTypeEnum.LADDER, new ArrayList<>()));
detailVO.setCommissionParams(indicatorParamMap.getOrDefault(ParamTypeEnum.COMMISSION, new ArrayList<>()));
countDownLatch.countDown();
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
792
|
}
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
793
794
795
796
797
798
799
800
801
|
/**
* 获取前置条件命中记录
*
* @param salaryGroupProjectId
* @param userId
* @param localDate
* @return
*/
|
6f16e17a
姜超
feature(*): 多线程方式...
|
802
803
|
public void setSalaryGroupProjectPreconditionHitVos(Long salaryGroupProjectId, Long userId, LocalDate localDate,
SalaryGroupIndicatorDetailVO detailVO, CountDownLatch countDownLatch) {
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
804
805
|
List<SalaryGroupProjectPreconditionVO> preconditionVos = salaryGroupProjectPreconditionService.getHitVos(salaryGroupProjectId, userId, localDate);
if (PublicUtil.isEmpty(preconditionVos)) {
|
6f16e17a
姜超
feature(*): 多线程方式...
|
806
807
|
countDownLatch.countDown();
return;
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
|
}
List<Long> targetPreconditionIds = preconditionVos.stream()
.filter(param -> ! TargetTypeEnum.NO.equals(param.getTargetType()))
.map(SalaryGroupProjectPreconditionVO::getId).collect(Collectors.toList());
Map<Long, SalaryGroupProjectTargetHitLog> condTargetHitLogMap = new HashMap<>();
if (PublicUtil.isNotEmpty(targetPreconditionIds)) {
List<SalaryGroupProjectTargetHitLog> targetHitLogs = salaryGroupProjectTargetHitLogService.list(Wrappers.<SalaryGroupProjectTargetHitLog>lambdaQuery()
.in(SalaryGroupProjectTargetHitLog::getReferId, targetPreconditionIds)
.in(SalaryGroupProjectTargetHitLog::getTargetType, IndicatorTypeEnum.PRE)
.eq(SalaryGroupProjectTargetHitLog::getDataDate, localDate)
.eq(SalaryGroupProjectTargetHitLog::getUserId, userId)
.eq(SalaryGroupProjectTargetHitLog::getYn, Boolean.TRUE)
);
condTargetHitLogMap = targetHitLogs.stream()
.collect(Collectors.toMap(SalaryGroupProjectTargetHitLog::getReferId, Function.identity(), (v1, v2) -> v1));
}
List<String> indicatorCodes = preconditionVos.stream()
.filter(param -> TargetTypeEnum.NO.equals(param.getTargetType()))
.map(SalaryGroupProjectPreconditionVO::getIndicatorCode).collect(Collectors.toList());
Map<String, IndicatorUserValue> indicatorCodeValueMap = new HashMap<>();
if (PublicUtil.isNotEmpty(indicatorCodes)) {
List<IndicatorUserValue> indicatorUserValues = indicatorUserValueService.list(Wrappers.<IndicatorUserValue>lambdaQuery()
.in(IndicatorUserValue::getIndicatorCode, indicatorCodes)
.eq(IndicatorUserValue::getDataDate, localDate)
.eq(IndicatorUserValue::getUserId, userId)
.eq(IndicatorUserValue::getYn, Boolean.TRUE)
);
indicatorCodeValueMap = indicatorUserValues.stream()
.collect(Collectors.toMap(IndicatorUserValue::getIndicatorCode, Function.identity(), (v1, v2) -> v1));
}
for (SalaryGroupProjectPreconditionVO preconditionVO : preconditionVos) {
|
2ce2dc6e
姜超
feature(*): 薪酬条件返...
|
842
|
preconditionVO.setHit(Boolean.FALSE);
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
843
844
845
|
//有目标
if (condTargetHitLogMap.containsKey(preconditionVO.getId())) {
SalaryGroupProjectTargetHitLog targetHitLog = condTargetHitLogMap.get(preconditionVO.getId());
|
1be8d902
姜超
feature(bug): 修改目...
|
846
847
|
preconditionVO.setReachValue(targetHitLog.getReachValue());
preconditionVO.setIndicatorValue(targetHitLog.getValue());
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
848
|
|
1be8d902
姜超
feature(bug): 修改目...
|
849
850
851
|
if (! TargetTypeEnum.NO.equals(preconditionVO.getTargetType())) {
preconditionVO.setReachValue(targetHitLog.getReachValue().multiply(Constant.ONE_HUNDRED));
}
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
852
853
|
if (DataTypeEnum.RATIO.equals(preconditionVO.getDataType())) {
preconditionVO.setIndicatorValue(targetHitLog.getValue().multiply(Constant.ONE_HUNDRED));
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
854
|
}
|
2ce2dc6e
姜超
feature(*): 薪酬条件返...
|
855
|
preconditionVO.checkHit();
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
|
continue;
}
//无目标
if(indicatorCodeValueMap.containsKey(preconditionVO.getIndicatorCode())) {
IndicatorUserValue indicatorUserValue = indicatorCodeValueMap.get(preconditionVO.getIndicatorCode());
BigDecimal indicatorOriginValue = commonService.queryIndicatorValue(preconditionVO.getIndicatorCode(), indicatorUserValue);
switch (indicatorUserValue.getValueType()) {
case WORK_AGE:
case QUANTITY: {
preconditionVO.setIndicatorValue(indicatorOriginValue);
break;
}
case RATIO: {
preconditionVO.setIndicatorValue(indicatorOriginValue.multiply(Constant.ONE_HUNDRED));
break;
}
}
|
2ce2dc6e
姜超
feature(*): 薪酬条件返...
|
873
|
preconditionVO.checkHit();
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
874
875
|
}
}
|
6f16e17a
姜超
feature(*): 多线程方式...
|
876
877
|
detailVO.setConds(preconditionVos);
countDownLatch.countDown();
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
878
|
}
|
c79f2cf7
姜超
feature(*): 薪酬池详情查询
|
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
|
/**
* 检查薪酬项是否是工龄工资、基本工资
*
* @param salaryGroupProjectId
* @return
*/
public Boolean checkIsBaseWage(Long salaryGroupProjectId) {
List<String> baseWageIndicatorCodes = new ArrayList<String>(){{add(getWorkAgeCode());add(getBaseSalaryCode());}};
List<SalaryGroupProjectParam> salaryGroupProjectParams = salaryGroupProjectParamService.list(Wrappers.<SalaryGroupProjectParam>lambdaQuery()
.eq(SalaryGroupProjectParam::getSalaryGroupProjectId, salaryGroupProjectId)
.in(SalaryGroupProjectParam::getIndicatorCode, baseWageIndicatorCodes)
.eq(SalaryGroupProjectParam::getYn, Boolean.TRUE)
);
return PublicUtil.isNotEmpty(salaryGroupProjectParams);
}
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
896
|
}
|