57fffce6
姜超
[jiangchao] 绩效组查询接口
|
1
|
package cn.fw.morax.service.biz.kpi;
|
9e73b4bb
姜超
[jiangchao] 绩效指标相关接口
|
2
|
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
3
|
import cn.fw.morax.common.constant.Constant;
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
4
|
import cn.fw.morax.common.utils.DateUtil;
|
9e73b4bb
姜超
[jiangchao] 绩效指标相关接口
|
5
|
import cn.fw.morax.common.utils.PublicUtil;
|
982d9d1b
姜超
feature(*): 修改薪酬计...
|
6
|
import cn.fw.morax.domain.db.kpi.*;
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
7
8
|
import cn.fw.morax.domain.dto.kpi.KpiGroupIndicatorRankDTO;
import cn.fw.morax.domain.enums.*;
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
9
|
import cn.fw.morax.domain.vo.kpi.*;
|
3d4edc47
姜超
feature(*): 薪酬项目下钻
|
10
|
import cn.fw.morax.service.biz.CommonService;
|
982d9d1b
姜超
feature(*): 修改薪酬计...
|
11
|
import cn.fw.morax.service.data.kpi.*;
|
967ed70a
姜超
feature(*): 绩效详情接口
|
12
|
import com.alibaba.fastjson.JSON;
|
9e73b4bb
姜超
[jiangchao] 绩效指标相关接口
|
13
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
bbb00e01
姜超
feature(*): 启用禁用指标
|
14
|
import com.google.common.collect.Lists;
|
9e73b4bb
姜超
[jiangchao] 绩效指标相关接口
|
15
16
|
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
|
9e73b4bb
姜超
[jiangchao] 绩效指标相关接口
|
17
|
import org.springframework.stereotype.Service;
|
9e73b4bb
姜超
[jiangchao] 绩效指标相关接口
|
18
|
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
19
|
import java.math.BigDecimal;
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
20
|
import java.time.LocalDate;
|
967ed70a
姜超
feature(*): 绩效详情接口
|
21
|
import java.time.YearMonth;
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
22
23
|
import java.util.*;
import java.util.function.Function;
|
bbb00e01
姜超
feature(*): 启用禁用指标
|
24
|
import java.util.stream.Collectors;
|
9e73b4bb
姜超
[jiangchao] 绩效指标相关接口
|
25
26
27
28
29
30
31
32
33
34
|
import static cn.fw.common.businessvalidator.Validator.BV;
@RequiredArgsConstructor
@Service
@Slf4j
public class KpiGroupIndicatorBizService {
private final KpiGroupIndicatorLaddersService kpiGroupIndicatorLaddersService;
private final KpiGroupIndicatorService kpiGroupIndicatorService;
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
35
|
private final KpiGroupIndicatorHitLogService kpiGroupIndicatorHitLogService;
|
982d9d1b
姜超
feature(*): 修改薪酬计...
|
36
37
|
private final KpiGroupIndicatorParamService kpiGroupIndicatorParamService;
private final KpiGroupIndicatorPreconditionService kpiGroupIndicatorPreconditionService;
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
38
39
|
private final KpiGroupIndicatorTargetHitLogService kpiGroupIndicatorTargetHitLogService;
private final KpiGroupIndicatorPreconditionLaddersService kpiGroupIndicatorPreconditionLaddersService;
|
99471c63
姜超
feature(*): 指标排名
|
40
|
private final KpiPoolIndicatorValueService kpiPoolIndicatorValueService;
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
41
|
private final IndicatorUserValueService indicatorUserValueService;
|
99471c63
姜超
feature(*): 指标排名
|
42
43
|
private final KpiGroupUserService kpiGroupUserService;
private final IndicatorsService indicatorsService;
|
bbb00e01
姜超
feature(*): 启用禁用指标
|
44
|
private final KpiGroupService kpiGroupService;
|
3d4edc47
姜超
feature(*): 薪酬项目下钻
|
45
|
private final CommonService commonService;
|
967ed70a
姜超
feature(*): 绩效详情接口
|
46
|
private final KpiPoolService kpiPoolService;
|
9e73b4bb
姜超
[jiangchao] 绩效指标相关接口
|
47
48
49
|
/**
* 绩效组指标详情
|
b8b6eb02
姜超
feature(*): 接口注释修改
|
50
|
*
|
9e73b4bb
姜超
[jiangchao] 绩效指标相关接口
|
51
52
53
|
* @param kpiIndicatorId
* @return
*/
|
83fc9174
姜超
feature(*): 薪酬项查询...
|
54
|
public KpiGroupIndicatorVO kpiGroupIndicatorDetail(Long kpiIndicatorId) {
|
9e73b4bb
姜超
[jiangchao] 绩效指标相关接口
|
55
|
KpiGroupIndicator kpiGroupIndicator = kpiGroupIndicatorService.getById(kpiIndicatorId);
|
1a516cf8
姜超
feature(*): 指标详情接口
|
56
|
BV.isNull(kpiGroupIndicator, "绩效指标配置不存在,请重试");
|
83fc9174
姜超
feature(*): 薪酬项查询...
|
57
|
KpiGroupIndicatorVO kpiGroupIndicatorVo = PublicUtil.copy(kpiGroupIndicator, KpiGroupIndicatorVO.class);
|
9e73b4bb
姜超
[jiangchao] 绩效指标相关接口
|
58
59
60
|
List<KpiGroupIndicatorLadders> kpiGroupIndicatorLadders = kpiGroupIndicatorLaddersService.list(Wrappers.<KpiGroupIndicatorLadders>lambdaQuery()
.eq(KpiGroupIndicatorLadders::getKpiGroupIndicatorId, kpiIndicatorId)
|
98f0b2aa
姜超
feature(*): 添加yn判断
|
61
|
.eq(KpiGroupIndicatorLadders::getYn, Boolean.TRUE)
|
9e73b4bb
姜超
[jiangchao] 绩效指标相关接口
|
62
63
|
);
if (PublicUtil.isNotEmpty(kpiGroupIndicatorLadders)) {
|
83fc9174
姜超
feature(*): 薪酬项查询...
|
64
|
List<KpiGroupIndicatorLaddersVO> indicatorLaddersVos = PublicUtil.copyList(kpiGroupIndicatorLadders, KpiGroupIndicatorLaddersVO.class);
|
59d58c08
姜超
feature(*): excel...
|
65
|
kpiGroupIndicatorVo.setIndicatorLadders(indicatorLaddersVos);
|
9e73b4bb
姜超
[jiangchao] 绩效指标相关接口
|
66
67
68
|
}
return kpiGroupIndicatorVo;
}
|
bbb00e01
姜超
feature(*): 启用禁用指标
|
69
70
71
|
/**
* 获取正在使用指标的绩效组
|
b8b6eb02
姜超
feature(*): 接口注释修改
|
72
|
*
|
9dd1f916
姜超
feature(*): 指标启用禁用
|
73
|
* @param indicatorCode
|
bbb00e01
姜超
feature(*): 启用禁用指标
|
74
75
|
* @return
*/
|
9dd1f916
姜超
feature(*): 指标启用禁用
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
public List<KpiGroup> getKpiGroupByIndicatorCode(String indicatorCode) {
List<KpiGroupIndicatorParam> kpiGroupIndicatorParams = kpiGroupIndicatorParamService.list(Wrappers.<KpiGroupIndicatorParam>lambdaQuery()
.eq(KpiGroupIndicatorParam::getIndicatorCode, indicatorCode)
.eq(KpiGroupIndicatorParam::getYn, Boolean.TRUE)
);
List<KpiGroupIndicatorPrecondition> preconditions = kpiGroupIndicatorPreconditionService.list(Wrappers.<KpiGroupIndicatorPrecondition>lambdaQuery()
.eq(KpiGroupIndicatorPrecondition::getIndicatorCode, indicatorCode)
.eq(KpiGroupIndicatorPrecondition::getYn, Boolean.TRUE)
);
Set<Long> kpiGroupIds = new HashSet<>();
if (PublicUtil.isNotEmpty(kpiGroupIndicatorParams)) {
kpiGroupIds.addAll(kpiGroupIndicatorParams.stream().map(KpiGroupIndicatorParam::getKpiGroupId).collect(Collectors.toSet()));
}
if (PublicUtil.isNotEmpty(preconditions)) {
kpiGroupIds.addAll(preconditions.stream().map(KpiGroupIndicatorPrecondition::getKpiGroupId).collect(Collectors.toSet()));
}
if (PublicUtil.isEmpty(kpiGroupIds)) {
return new ArrayList<>();
}
|
99471c63
姜超
feature(*): 指标排名
|
96
|
List<SettingStatusEnum> status = new ArrayList<SettingStatusEnum>() {{
|
982d9d1b
姜超
feature(*): 修改薪酬计...
|
97
98
|
add(SettingStatusEnum.APPROVING);
add(SettingStatusEnum.BE_EFFECTIVE);
|
bbb00e01
姜超
feature(*): 启用禁用指标
|
99
100
|
add(SettingStatusEnum.EFFECTIVE);
}};
|
982d9d1b
姜超
feature(*): 修改薪酬计...
|
101
|
List<KpiGroup> kpiGroups = kpiGroupService.list(Wrappers.<KpiGroup>lambdaQuery()
|
9dd1f916
姜超
feature(*): 指标启用禁用
|
102
|
.in(KpiGroup::getId, kpiGroupIds)
|
982d9d1b
姜超
feature(*): 修改薪酬计...
|
103
104
105
|
.in(KpiGroup::getStatus, status)
.eq(KpiGroup::getYn, Boolean.TRUE)
);
|
9dd1f916
姜超
feature(*): 指标启用禁用
|
106
|
return kpiGroups;
|
bbb00e01
姜超
feature(*): 启用禁用指标
|
107
108
|
}
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
109
|
/**
|
967ed70a
姜超
feature(*): 绩效详情接口
|
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
* 绩效项目阶梯详情
*
* @param kpiPoolId
* @param kpiGroupIndicatorId
* @param yearMonth
* @return
*/
public KpiGroupIndicatorDetailVO getHitIndicatorLadder(Long kpiPoolId, Long kpiGroupIndicatorId, YearMonth yearMonth) {
KpiPool kpiPool = kpiPoolService.getById(kpiPoolId);
BV.notNull(kpiPool, "绩效池不存在");
LocalDate localDate = this.getPoolLastData(kpiPool);
Long userId = kpiPool.getUserId();
KpiGroupIndicator kpiGroupIndicator = kpiGroupIndicatorService.getById(kpiGroupIndicatorId);
BV.notNull(kpiGroupIndicator, "指标不存在");
KpiGroup kpiGroup = kpiGroupService.getAllDataById(kpiGroupIndicator.getKpiGroupId());
BV.notNull(kpiGroup, "绩效组不存在");
KpiGroupIndicatorDetailVO detailVO = new KpiGroupIndicatorDetailVO();
|
967ed70a
姜超
feature(*): 绩效详情接口
|
130
|
this.setIndicatorsVo(kpiGroupIndicatorId, userId, localDate, detailVO);
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
131
|
detailVO.setKpiGroupId(kpiGroup.getId());
|
967ed70a
姜超
feature(*): 绩效详情接口
|
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
detailVO.setKpiTime(localDate.atTime(23, 59, 59));
detailVO.setPostId(kpiGroup.getPostId());
detailVO.setPostName(kpiGroup.getPostName());
detailVO.setKpiGroupShopIds(kpiGroup.getShopIds());
detailVO.setKpiGroupShopNames(kpiGroup.getShopNames());
return detailVO;
}
/**
* 获取绩效池详情最近日期
*
* @param kpiPool
* @return
*/
public LocalDate getPoolLastData(KpiPool kpiPool) {
KpiGroupUser kpiGroupUser = kpiGroupUserService.getMonthLastData(kpiPool.getKgc(), kpiPool.getUserId(), kpiPool.getMonthly());
if (PublicUtil.isEmpty(kpiGroupUser)) {
log.error("员工绩效池:{},不存在绩效组人员", JSON.toJSONString(kpiPool));
return PublicUtil.getYesterdayOrEndOfMonthDay(kpiPool.getMonthly());
}
return kpiGroupUser.getDataDate();
}
/**
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
157
158
159
160
|
* 设置指标
*
* @param
*/
|
967ed70a
姜超
feature(*): 绩效详情接口
|
161
|
public void setIndicatorsVo(Long kpiGroupIndicatorId, Long userId, LocalDate localDate, KpiGroupIndicatorDetailVO detailVO) {
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
162
163
|
KpiGroupIndicator kpiGroupIndicator = kpiGroupIndicatorService.getById(kpiGroupIndicatorId);
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
164
|
BV.notNull(kpiGroupIndicator, "绩效组指标不存在");
|
96ab8564
姜超
feature(*): 薪酬组绩效...
|
165
166
167
|
detailVO.setScoreWay(kpiGroupIndicator.getScoreWay());
detailVO.setBaseScore(kpiGroupIndicator.getBaseScore());
detailVO.setParamAlias(kpiGroupIndicator.getParamAlias());
|
a45344cf
姜超
feature(bug): 修改目...
|
168
169
170
|
if (PublicUtil.isNotEmpty(kpiGroupIndicator.getLaddersType())) {
detailVO.setLaddersType(kpiGroupIndicator.getLaddersType());
}
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
171
|
|
0ac3000c
姜超
feature(*): 绩效详情查看
|
172
|
//命中记录
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
173
174
175
176
177
178
|
KpiGroupIndicatorHitLog kpiGroupIndicatorHitLog = kpiGroupIndicatorHitLogService.getOne(Wrappers.<KpiGroupIndicatorHitLog>lambdaQuery()
.eq(KpiGroupIndicatorHitLog::getKpiGroupIndicatorId, kpiGroupIndicatorId)
.eq(KpiGroupIndicatorHitLog::getDataDate, localDate)
.eq(KpiGroupIndicatorHitLog::getUserId, userId)
.eq(KpiGroupIndicatorHitLog::getYn, Boolean.TRUE)
);
|
96ab8564
姜超
feature(*): 薪酬组绩效...
|
179
180
181
|
if (ScoreWayEnum.LADDER.equals(kpiGroupIndicator.getScoreWay())) {
Long hitKpiIndicatorLaddersId = kpiGroupIndicatorHitLog.getKpiGroupIndicatorLaddersId();
|
278ef9ef
姜超
feature(bug): 修改目...
|
182
183
|
List<KpiGroupIndicatorLaddersVO> ladderVos = kpiGroupIndicatorLaddersService.getVos(kpiGroupIndicatorId, kpiGroupIndicator.getLaddersType());
for (KpiGroupIndicatorLaddersVO laddersVO : ladderVos) {
|
96ab8564
姜超
feature(*): 薪酬组绩效...
|
184
|
if (PublicUtil.isNotEmpty(hitKpiIndicatorLaddersId)) {
|
278ef9ef
姜超
feature(bug): 修改目...
|
185
|
laddersVO.setHit((hitKpiIndicatorLaddersId.equals(laddersVO.getId()) ? Boolean.TRUE : Boolean.FALSE));
|
96ab8564
姜超
feature(*): 薪酬组绩效...
|
186
|
}
|
278ef9ef
姜超
feature(bug): 修改目...
|
187
188
|
}
detailVO.setLadders(ladderVos);
|
96ab8564
姜超
feature(*): 薪酬组绩效...
|
189
190
|
}
|
278ef9ef
姜超
feature(bug): 修改目...
|
191
|
if (PublicUtil.isNotEmpty(kpiGroupIndicatorHitLog) && DataTypeEnum.RATIO.equals(kpiGroupIndicator.getLaddersType())) {
|
96ab8564
姜超
feature(*): 薪酬组绩效...
|
192
193
|
detailVO.setParamsValue(kpiGroupIndicatorHitLog.getKpiValue().multiply(Constant.ONE_HUNDRED));
}
|
0ac3000c
姜超
feature(*): 绩效详情查看
|
194
|
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
195
196
|
//参数
Map<ParamTypeEnum, List<KpiGroupIndicatorParamVO>> paramMap = this.getKpiGroupIndicatorParamMap(kpiGroupIndicatorId, userId, localDate);
|
967ed70a
姜超
feature(*): 绩效详情接口
|
197
198
|
detailVO.setLadderParams(paramMap.getOrDefault(ParamTypeEnum.LADDER, new ArrayList<>()));
detailVO.setCommissionParams(paramMap.getOrDefault(ParamTypeEnum.COMMISSION, new ArrayList<>()));
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
199
200
201
|
//条件
List<KpiGroupIndicatorPreconditionVO> preconditionVOS = kpiGroupIndicatorPreconditionService.getHitVos(kpiGroupIndicatorId, userId, localDate);
|
967ed70a
姜超
feature(*): 绩效详情接口
|
202
|
detailVO.setConds(preconditionVOS);
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
203
204
|
for (KpiGroupIndicatorPreconditionVO preconditionVO : preconditionVOS) {
//条件目标记录
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
205
|
if (! TargetTypeEnum.NO.equals(preconditionVO.getTargetType())) {
|
99471c63
姜超
feature(*): 指标排名
|
206
|
KpiGroupIndicatorTargetHitLog kpiGroupIndicatorTargetHitLog = kpiGroupIndicatorTargetHitLogService.getOne(Wrappers.<KpiGroupIndicatorTargetHitLog>lambdaQuery()
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
207
|
.eq(KpiGroupIndicatorTargetHitLog::getReferId, preconditionVO.getId())
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
208
|
.eq(KpiGroupIndicatorTargetHitLog::getTargetType, IndicatorTypeEnum.PRE)
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
209
210
211
212
|
.eq(KpiGroupIndicatorTargetHitLog::getDataDate, localDate)
.eq(KpiGroupIndicatorTargetHitLog::getUserId, userId)
.eq(KpiGroupIndicatorTargetHitLog::getYn, Boolean.TRUE)
);
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
213
214
215
216
|
preconditionVO.processTargetPercent(kpiGroupIndicatorTargetHitLog);
} else {
//无条件目标记录
preconditionVO.processNoTargetPercent();
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
217
218
219
|
}
//条件阶梯
|
278ef9ef
姜超
feature(bug): 修改目...
|
220
221
|
List<KpiGroupIndicatorPreconditionLaddersVO> preconditionLaddersVOS = kpiGroupIndicatorPreconditionLaddersService.getVOS(
preconditionVO.getId(), preconditionVO.getTargetType(), preconditionVO.getDataType());
|
3d4edc47
姜超
feature(*): 薪酬项目下钻
|
222
223
224
|
for (KpiGroupIndicatorPreconditionLaddersVO preconditionLaddersVO : preconditionLaddersVOS) {
if (PublicUtil.isNotEmpty(preconditionVO.getHitLaddersId()) && preconditionLaddersVO.getId().equals(preconditionVO.getHitLaddersId())) {
preconditionLaddersVO.setHit(Boolean.TRUE);
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
225
|
}
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
226
227
228
229
|
}
preconditionVO.setCondLadders(preconditionLaddersVOS);
}
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
230
231
|
}
|
278ef9ef
姜超
feature(bug): 修改目...
|
232
233
234
|
|
0ac3000c
姜超
feature(*): 绩效详情查看
|
235
236
237
238
239
240
241
242
|
/**
* 获取绩效参数
*
* @param kpiGroupIndicatorId
* @param userId
* @param localDate
* @return
*/
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
243
244
|
public Map<ParamTypeEnum, List<KpiGroupIndicatorParamVO>> getKpiGroupIndicatorParamMap(Long kpiGroupIndicatorId, Long userId, LocalDate localDate) {
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
245
|
List<KpiGroupIndicatorParamVO> paramVos = kpiGroupIndicatorParamService.getKpiGroupIndicatorParamVos(kpiGroupIndicatorId);
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
246
|
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
247
|
List<String> indicatorCodes = paramVos.stream()
|
3d4edc47
姜超
feature(*): 薪酬项目下钻
|
248
|
.filter(param -> TargetTypeEnum.NO.equals(param.getTargetType()))
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
249
|
.map(KpiGroupIndicatorParamVO::getIndicatorCode).collect(Collectors.toList());
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
250
|
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
251
252
253
254
255
256
257
258
259
260
261
|
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));
}
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
262
|
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
263
|
List<Long> paramIds = paramVos.stream()
|
99471c63
姜超
feature(*): 指标排名
|
264
|
.filter(param -> !TargetTypeEnum.NO.equals(param.getTargetType()))
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
265
|
.map(KpiGroupIndicatorParamVO::getId).collect(Collectors.toList());
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
266
|
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
267
268
|
Map<Long, KpiGroupIndicatorTargetHitLog> paramTargetHitLogMap = new HashMap<>();
if (PublicUtil.isNotEmpty(paramIds)) {
|
99471c63
姜超
feature(*): 指标排名
|
269
|
List<KpiGroupIndicatorTargetHitLog> targetHitLogs = kpiGroupIndicatorTargetHitLogService.list(Wrappers.<KpiGroupIndicatorTargetHitLog>lambdaQuery()
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
270
271
272
273
274
|
.in(KpiGroupIndicatorTargetHitLog::getReferId, paramIds)
.eq(KpiGroupIndicatorTargetHitLog::getDataDate, localDate)
.eq(KpiGroupIndicatorTargetHitLog::getUserId, userId)
.eq(KpiGroupIndicatorTargetHitLog::getYn, Boolean.TRUE)
);
|
99471c63
姜超
feature(*): 指标排名
|
275
|
paramTargetHitLogMap = targetHitLogs.stream()
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
276
277
|
.collect(Collectors.toMap(KpiGroupIndicatorTargetHitLog::getReferId, Function.identity(), (v1, v2) -> v1));
}
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
278
|
for (KpiGroupIndicatorParamVO paramVO : paramVos) {
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
279
|
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
280
|
//有目标
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
281
282
|
if (paramTargetHitLogMap.containsKey(paramVO.getId())) {
KpiGroupIndicatorTargetHitLog targetHitLog = paramTargetHitLogMap.get(paramVO.getId());
|
5d90b0dc
姜超
feature(*): 绩效数据展示修改
|
283
284
|
if (DataTypeEnum.RATIO.equals(paramVO.getDataType())) {
paramVO.setIndicatorValue(targetHitLog.getValue().multiply(Constant.ONE_HUNDRED));
|
150794c9
姜超
feature(*): 展示修改
|
285
286
|
} else {
paramVO.setIndicatorValue(targetHitLog.getValue());
|
5d90b0dc
姜超
feature(*): 绩效数据展示修改
|
287
|
}
|
0ac3000c
姜超
feature(*): 绩效详情查看
|
288
|
paramVO.setReachValue(targetHitLog.getReachValue().multiply(Constant.ONE_HUNDRED));
|
f4b9a6ec
姜超
feature(*): 修改绩效组保存
|
289
290
291
292
293
|
continue;
}
//无目标
if (indicatorCodeValueMap.containsKey(paramVO.getIndicatorCode())) {
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
294
|
IndicatorUserValue indicatorUserValue = indicatorCodeValueMap.get(paramVO.getIndicatorCode());
|
3d4edc47
姜超
feature(*): 薪酬项目下钻
|
295
|
BigDecimal indicatorOriginValue = commonService.queryIndicatorValue(paramVO.getIndicatorCode(), indicatorUserValue);
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
296
297
298
|
switch (indicatorUserValue.getValueType()) {
case WORK_AGE:
case QUANTITY: {
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
299
|
paramVO.setIndicatorValue(indicatorOriginValue);
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
300
301
302
|
break;
}
case RATIO: {
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
303
|
paramVO.setIndicatorValue(indicatorOriginValue.multiply(Constant.ONE_HUNDRED));
|
f77829b1
姜超
feature(*): 绩效薪酬详情
|
304
305
306
|
break;
}
}
|
0ac3000c
姜超
feature(*): 绩效详情查看
|
307
|
}
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
308
309
|
}
|
58aa0677
姜超
feature(*): 绩效得分详情修改
|
310
|
Map<ParamTypeEnum, List<KpiGroupIndicatorParamVO>> indicatorParamMap = paramVos.stream()
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
311
312
313
314
|
.collect(Collectors.groupingBy(KpiGroupIndicatorParamVO::getParamType));
return indicatorParamMap;
}
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
315
|
|
99471c63
姜超
feature(*): 指标排名
|
316
317
318
319
320
321
|
/**
* 查询指标排名
*
* @param dto
* @return
*/
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
322
323
|
public KpiIndicatorRankVO queryKpiIndicatorRank(KpiGroupIndicatorRankDTO dto) {
|
99471c63
姜超
feature(*): 指标排名
|
324
325
326
327
|
LocalDate localDate = PublicUtil.getYesterdayOrEndOfMonthDay(dto.getMonthly());
List<KpiPool> pools = kpiPoolService.list(Wrappers.<KpiPool>lambdaQuery()
.eq(KpiPool::getKpiGroupId, dto.getKpiGroupId())
.eq(KpiPool::getMonthly, YearMonth.from(localDate))
|
16ee250d
姜超
feature(*): 排名修改
|
328
|
// .eq(KpiPool::getInclusion, Boolean.TRUE)
|
99471c63
姜超
feature(*): 指标排名
|
329
330
|
.eq(KpiPool::getYn, Boolean.TRUE)
);
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
331
|
|
99471c63
姜超
feature(*): 指标排名
|
332
|
Long referId = null;
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
333
334
335
336
|
BigDecimal targetValue = null;
String indicatorCode = null;
TargetTypeEnum targetType = null;
TargetCalcTypeEnum targetCalcType = null;
|
99471c63
姜超
feature(*): 指标排名
|
337
|
IndicatorTypeEnum indicatorTypeEnum = null;
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
338
|
if (PublicUtil.isNotEmpty(dto.getKpiGroupIndicatorParamId())) {
|
99471c63
姜超
feature(*): 指标排名
|
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
|
referId = dto.getKpiGroupIndicatorParamId();
indicatorTypeEnum = IndicatorTypeEnum.EXAMINE;
KpiGroupIndicatorParam param = kpiGroupIndicatorParamService.getById(dto.getKpiGroupIndicatorParamId());
BV.isTrue(PublicUtil.isNotEmpty(param), "绩效组指标参数不存在");
indicatorCode = param.getIndicatorCode();
targetType = param.getTargetType();
targetValue = param.getTargetValue();
targetCalcType = param.getTargetCalcType();
} else {
referId = dto.getKpiGroupIndicatorPreconditionId();
indicatorTypeEnum = IndicatorTypeEnum.PRE;
KpiGroupIndicatorPrecondition precondition = kpiGroupIndicatorPreconditionService.getById(dto.getKpiGroupIndicatorPreconditionId());
BV.isTrue(PublicUtil.isNotEmpty(precondition), "绩效组指标条件不存在");
indicatorCode = precondition.getIndicatorCode();
targetType = precondition.getTargetType();
targetValue = precondition.getTargetValue();
targetCalcType = precondition.getTargetCalcType();
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
357
358
|
}
|
96ab8564
姜超
feature(*): 薪酬组绩效...
|
359
|
|
99471c63
姜超
feature(*): 指标排名
|
360
361
362
363
|
Indicators indicators = indicatorsService.queryByCode(indicatorCode, Boolean.FALSE);
BV.isTrue(PublicUtil.isNotEmpty(indicators), "指标不存在");
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
364
|
KpiIndicatorRankVO kpiIndicatorRankVO = KpiIndicatorRankVO.builder()
|
99471c63
姜超
feature(*): 指标排名
|
365
366
367
|
.indicatorName(indicators.getIndicatorName())
.indicatorCode(indicators.getIndicatorCode())
.dataType(indicators.getDataType())
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
368
|
.targetType(targetType)
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
369
370
|
.deadlineDate(DateUtil.localDate2Date(localDate))
.build();
|
99471c63
姜超
feature(*): 指标排名
|
371
|
if (PublicUtil.isEmpty(pools)) {
|
96ab8564
姜超
feature(*): 薪酬组绩效...
|
372
|
log.error("绩效指标查无数据,指标:[{}] [{}] [{}]", indicatorCode, dto.getKpiGroupId(), localDate);
|
99471c63
姜超
feature(*): 指标排名
|
373
374
|
return kpiIndicatorRankVO;
}
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
375
|
|
99471c63
姜超
feature(*): 指标排名
|
376
|
//无目标指标排名
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
377
|
if (TargetTypeEnum.NO.equals(targetType)) {
|
99471c63
姜超
feature(*): 指标排名
|
378
|
kpiIndicatorRankVO.setStaffs(getNoTargetIndicatorRanks(indicatorCode, localDate, pools));
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
379
380
381
|
return kpiIndicatorRankVO;
}
|
99471c63
姜超
feature(*): 指标排名
|
382
|
//有目标指标排名
|
278ef9ef
姜超
feature(bug): 修改目...
|
383
|
kpiIndicatorRankVO.setStaffs(getTargetIndicatorRanks(referId, localDate, pools, indicatorTypeEnum, indicators));
|
96ab8564
姜超
feature(*): 薪酬组绩效...
|
384
|
kpiIndicatorRankVO.setTargetValue((TargetTypeEnum.RATIO.equals(targetType) ? targetValue.multiply(Constant.ONE_HUNDRED) : targetValue));
|
99471c63
姜超
feature(*): 指标排名
|
385
386
387
|
kpiIndicatorRankVO.setTargetCalcType(targetCalcType);
return kpiIndicatorRankVO;
}
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
388
|
|
99471c63
姜超
feature(*): 指标排名
|
389
390
391
392
393
394
395
396
397
398
|
/**
* 无目标指标排名
*
* @param indicatorCode
* @param localDate
* @param pools
* @return
*/
public List<KpiIndicatorRankStaffVO> getNoTargetIndicatorRanks(String indicatorCode, LocalDate localDate, List<KpiPool> pools) {
Set<Long> userIds = pools.stream().map(KpiPool::getUserId).collect(Collectors.toSet());
|
e1778851
姜超
feature(*): 计算考评调整
|
399
|
List<IndicatorUserValueVO> indicatorUserValues = indicatorUserValueService.getStaffReportData(indicatorCode, YearMonth.from(localDate), userIds);
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
400
|
|
99471c63
姜超
feature(*): 指标排名
|
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
|
Map<Long, IndicatorUserValueVO> indicatorUserValueMap = indicatorUserValues.stream()
.collect(Collectors.toMap(IndicatorUserValueVO::getUserId, Function.identity(), (v1, v2) -> v1));
List<KpiIndicatorRankStaffVO> staffRanks = Lists.newArrayListWithCapacity(indicatorUserValues.size());
for (KpiPool kpiPool : pools) {
KpiIndicatorRankStaffVO rankStaffVO = new KpiIndicatorRankStaffVO();
rankStaffVO.setUserId(kpiPool.getUserId());
rankStaffVO.setUserName(kpiPool.getUserName());
rankStaffVO.setPostId(kpiPool.getPostId());
rankStaffVO.setPostName(kpiPool.getPostName());
rankStaffVO.setShopId(kpiPool.getShopId());
rankStaffVO.setShopName(kpiPool.getShopName());
rankStaffVO.setInclusion(kpiPool.getInclusion());
if (indicatorUserValueMap.containsKey(kpiPool.getUserId())) {
IndicatorUserValueVO indicatorUserValueVO = indicatorUserValueMap.get(kpiPool.getUserId());
rankStaffVO.setOriginValue(commonService.queryIndicatorValueVO(indicatorCode, indicatorUserValueVO));
}
staffRanks.add(rankStaffVO);
}
Collections.sort(staffRanks);
|
96ab8564
姜超
feature(*): 薪酬组绩效...
|
424
|
calcRank(staffRanks);
|
99471c63
姜超
feature(*): 指标排名
|
425
|
return staffRanks;
|
7de20f3f
姜超
feature(*): 绩效薪酬查看
|
426
|
}
|
99471c63
姜超
feature(*): 指标排名
|
427
428
429
430
431
432
433
434
435
436
437
438
439
440
|
/**
* 有目标指标排名
*
* @param referId
* @param localDate
* @param pools
* @param indicatorTypeEnum
* @return
*/
public List<KpiIndicatorRankStaffVO> getTargetIndicatorRanks(Long referId,
LocalDate localDate,
List<KpiPool> pools,
IndicatorTypeEnum indicatorTypeEnum,
|
278ef9ef
姜超
feature(bug): 修改目...
|
441
|
Indicators indicators) {
|
99471c63
姜超
feature(*): 指标排名
|
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
|
Set<Long> userIds = pools.stream().map(KpiPool::getUserId).collect(Collectors.toSet());
List<KpiGroupIndicatorTargetHitLogVO> indicatorTargetHitLogs = kpiGroupIndicatorTargetHitLogService.getIndicatorData(referId,
YearMonth.from(localDate), indicatorTypeEnum, userIds);
Map<Long, KpiGroupIndicatorTargetHitLogVO> indicatorTargetMap = indicatorTargetHitLogs.stream()
.collect(Collectors.toMap(KpiGroupIndicatorTargetHitLogVO::getUserId, Function.identity(), (v1, v2) -> v1));
List<KpiIndicatorRankStaffVO> staffRanks = Lists.newArrayListWithCapacity(indicatorTargetMap.size());
for (KpiPool kpiPool : pools) {
KpiIndicatorRankStaffVO rankStaffVO = new KpiIndicatorRankStaffVO();
rankStaffVO.setUserId(kpiPool.getUserId());
rankStaffVO.setUserName(kpiPool.getUserName());
rankStaffVO.setPostId(kpiPool.getPostId());
rankStaffVO.setPostName(kpiPool.getPostName());
rankStaffVO.setShopId(kpiPool.getShopId());
rankStaffVO.setShopName(kpiPool.getShopName());
rankStaffVO.setInclusion(kpiPool.getInclusion());
if (indicatorTargetMap.containsKey(kpiPool.getUserId())) {
KpiGroupIndicatorTargetHitLogVO targetHitLogVO = indicatorTargetMap.get(kpiPool.getUserId());
|
278ef9ef
姜超
feature(bug): 修改目...
|
463
464
|
rankStaffVO.setOriginValue(targetHitLogVO.getValue());
rankStaffVO.setReachValue(targetHitLogVO.getReachValue());
|
69f59d7a
姜超
feature(bug): 修改目...
|
465
|
rankStaffVO.convertReportValueToPercent(indicators.getDataType());
|
99471c63
姜超
feature(*): 指标排名
|
466
467
468
469
470
|
}
staffRanks.add(rankStaffVO);
}
Collections.sort(staffRanks);
|
96ab8564
姜超
feature(*): 薪酬组绩效...
|
471
|
calcRank(staffRanks);
|
99471c63
姜超
feature(*): 指标排名
|
472
473
474
|
return staffRanks;
}
|
96ab8564
姜超
feature(*): 薪酬组绩效...
|
475
476
477
478
479
480
|
/**
* 设置排名序号
*
* @return
*/
public void calcRank(List<KpiIndicatorRankStaffVO> staffs) {
|
96ab8564
姜超
feature(*): 薪酬组绩效...
|
481
|
int rank = 1;
|
3a3defbe
姜超
feature(bug): 排名名次修改
|
482
483
484
485
486
487
488
|
Optional<BigDecimal> lastIndicatorValueOp = staffs.stream()
.filter(staff -> Boolean.TRUE.equals(staff.getInclusion()))
.findFirst().map(KpiIndicatorRankStaffVO::getOriginValue);
if (Boolean.FALSE.equals(lastIndicatorValueOp.isPresent())) {
return;
}
BigDecimal lastIndicatorValue = lastIndicatorValueOp.get();
|
96ab8564
姜超
feature(*): 薪酬组绩效...
|
489
|
for (KpiIndicatorRankStaffVO staff : staffs) {
|
16ee250d
姜超
feature(*): 排名修改
|
490
491
492
|
if (! staff.getInclusion()) {
continue;
}
|
3a3defbe
姜超
feature(bug): 排名名次修改
|
493
494
|
//原始值为空,无排名
if (PublicUtil.isEmpty(staff.getOriginValue())) {
|
dad803db
姜超
feature(*): 修改展示查询
|
495
496
497
|
continue;
}
if (lastIndicatorValue.compareTo(staff.getOriginValue()) != 0) {
|
96ab8564
姜超
feature(*): 薪酬组绩效...
|
498
499
500
501
502
503
504
505
|
rank++;
}
staff.setIndicatorRank(rank);
lastIndicatorValue = staff.getOriginValue();
}
}
|
9e73b4bb
姜超
[jiangchao] 绩效指标相关接口
|
506
|
}
|
9fe049d0
姜超
feature(*): 修改薪酬计...
|
|
|