Blame view

fw-morax-service/src/main/java/cn/fw/morax/service/biz/kpi/KpiGroupDataService.java 15.5 KB
f4f1f40b   姜超   feature(*): 月定时器
1
2
  package cn.fw.morax.service.biz.kpi;
  
e5b3d2c9   姜超   feature(*): 绩效组参数校验
3
  import cn.fw.common.exception.BusinessException;
a4b02509   姜超   feature(*): 绩效组阶梯...
4
  import cn.fw.morax.common.constant.Constant;
f4f1f40b   姜超   feature(*): 月定时器
5
  import cn.fw.morax.common.utils.PublicUtil;
eb829e71   姜超   feature(*): 绩效组重复...
6
  import cn.fw.morax.domain.db.SettingDraft;
4ca0aa3a   姜超   fix(*): 绩效组、薪酬组添加...
7
  import cn.fw.morax.domain.db.kpi.*;
6786b5e1   姜超   feature(*): 绩效组配置修改
8
  import cn.fw.morax.domain.dto.kpi.*;
eb829e71   姜超   feature(*): 绩效组重复...
9
10
  import cn.fw.morax.domain.enums.*;
  import cn.fw.morax.service.data.SettingDraftService;
4ca0aa3a   姜超   fix(*): 绩效组、薪酬组添加...
11
  import cn.fw.morax.service.data.kpi.*;
f4f1f40b   姜超   feature(*): 月定时器
12
  import com.alibaba.fastjson.JSON;
e01fd137   姜超   feat(*): 定时器修改、审批...
13
  import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
f4f1f40b   姜超   feature(*): 月定时器
14
15
16
17
18
19
  import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  import com.google.common.collect.Lists;
  import lombok.RequiredArgsConstructor;
  import lombok.extern.slf4j.Slf4j;
  import org.springframework.stereotype.Service;
  import org.springframework.transaction.annotation.Transactional;
5658b543   xianpengcheng   更新薪酬组sgc可能重复的问题
20
  import org.springframework.util.StringUtils;
f4f1f40b   姜超   feature(*): 月定时器
21
  
a4b02509   姜超   feature(*): 绩效组阶梯...
22
  import java.math.RoundingMode;
f4f1f40b   姜超   feature(*): 月定时器
23
  import java.time.LocalDate;
4ca0aa3a   姜超   fix(*): 绩效组、薪酬组添加...
24
  import java.util.ArrayList;
a310d67e   姜超   feature(*): 绩效薪酬 ...
25
  import java.util.Date;
f4f1f40b   姜超   feature(*): 月定时器
26
  import java.util.List;
f4f1f40b   姜超   feature(*): 月定时器
27
28
  import java.util.stream.Collectors;
  
f4f1f40b   姜超   feature(*): 月定时器
29
30
31
32
33
34
35
  @RequiredArgsConstructor
  @Service
  @Slf4j
  public class KpiGroupDataService {
  
      private final KpiGroupIndicatorLaddersService kpiGroupIndicatorLaddersService;
      private final KpiGroupIndicatorService kpiGroupIndicatorService;
f4f1f40b   姜超   feature(*): 月定时器
36
      private final KpiStarLaddersService kpiStarLaddersService;
eb829e71   姜超   feature(*): 绩效组重复...
37
      private final SettingDraftService settingDraftService;
f4f1f40b   姜超   feature(*): 月定时器
38
      private final KpiGroupService kpiGroupService;
4ca0aa3a   姜超   fix(*): 绩效组、薪酬组添加...
39
40
      private final KpiGroupUserService kpiGroupUserService;
      private final KpiPoolService kpiPoolService;
718f8378   张志伟   feature(*): 修改类名
41
      private final KpiGroupIndicatorPreconditionService kpiGroupIndicatorPreconditionService;
6786b5e1   姜超   feature(*): 绩效组配置修改
42
      private final KpiGroupIndicatorParamService kpiGroupIndicatorParamService;
caf55039   姜超   feature(*): 实体类修改
43
      private final KpiGroupIndicatorPreconditionLaddersService kpiGroupIndicatorCondLaddersService;
278ef9ef   姜超   feature(bug): 修改目...
44
      private final IndicatorsService indicatorsService;
f4f1f40b   姜超   feature(*): 月定时器
45
  
f4f1f40b   姜超   feature(*): 月定时器
46
47
      /**
       * 保存绩效组
b8b6eb02   姜超   feature(*): 接口注释修改
48
       *
f4f1f40b   姜超   feature(*): 月定时器
49
50
51
       * @param dto
       */
      public KpiGroup saveKpiGroup(KpiGroupDTO dto) {
6d89f27c   姜超   feature(*): 计算排名修改
52
53
54
          if (PublicUtil.isNotEmpty(dto.getRevokedScoreRatio())) {
              dto.setRevokedScoreRatio(dto.getRevokedScoreRatio().divide(Constant.ONE_HUNDRED, 2, RoundingMode.HALF_UP));
          }
f4f1f40b   姜超   feature(*): 月定时器
55
          KpiGroup kpiGroup = PublicUtil.copy(dto, KpiGroup.class);
dc2eb3fa   姜超   feature(*): 绩效组人员查看
56
          kpiGroup.setIndicatorNum(dto.getIndicators().size());
13166424   姜超   feature(*): 参数校验修改
57
58
          if (PublicUtil.isNotEmpty(dto.getId())) {
              kpiGroup.setPreId(dto.getId());
4ca0aa3a   姜超   fix(*): 绩效组、薪酬组添加...
59
60
61
              kpiGroup.setKgc(dto.getKgc());
          } else {
              kpiGroup.setKgc(PublicUtil.getUUID());
f4f1f40b   姜超   feature(*): 月定时器
62
          }
e5b3d2c9   姜超   feature(*): 绩效组参数校验
63
          kpiGroup.setId(null);
38313e77   姜超   feature(*): 草稿审批修改
64
          kpiGroup.setStatus(SettingStatusEnum.EFFECTIVE);
a7262215   姜超   feature(*): 薪酬组阶梯校验
65
          kpiGroup.setCreateBy(dto.getUserId());
f4f1f40b   姜超   feature(*): 月定时器
66
67
68
69
70
71
          kpiGroupService.save(kpiGroup);
          return kpiGroup;
      }
  
      /**
       * 保存绩效指标、阶梯
b8b6eb02   姜超   feature(*): 接口注释修改
72
       *
f4f1f40b   姜超   feature(*): 月定时器
73
74
75
76
77
78
       * @param indicators
       * @param kpiGroup
       * @return
       */
      @Transactional(rollbackFor = Exception.class)
      public void saveKpiIndicators(List<KpiGroupIndicatorDTO> indicators, KpiGroup kpiGroup) {
6786b5e1   姜超   feature(*): 绩效组配置修改
79
  
f4f1f40b   姜超   feature(*): 月定时器
80
          List<KpiGroupIndicatorLadders> indicatorLadders = Lists.newArrayListWithCapacity(30);
e5b3d2c9   姜超   feature(*): 绩效组参数校验
81
82
83
          List<KpiGroupIndicatorParam> params = Lists.newArrayListWithCapacity(30);
          List<KpiGroupIndicatorPreconditionLadders> preconditionLadders = Lists.newArrayListWithCapacity(30);
  
6786b5e1   姜超   feature(*): 绩效组配置修改
84
          Long kpiGroupId = kpiGroup.getId();
f4f1f40b   姜超   feature(*): 月定时器
85
86
87
88
89
          Long indicatorId = null;
          KpiGroupIndicator indicator = null;
          KpiGroupIndicatorLadders indicatorLadder = null;
          for (KpiGroupIndicatorDTO indicatorDto : indicators) {
              indicator = PublicUtil.copy(indicatorDto, KpiGroupIndicator.class);
6786b5e1   姜超   feature(*): 绩效组配置修改
90
91
              indicator.setKpiGroupId(kpiGroupId);
  
f4f1f40b   姜超   feature(*): 月定时器
92
93
              kpiGroupIndicatorService.save(indicator);
              indicatorId = indicator.getId();
6786b5e1   姜超   feature(*): 绩效组配置修改
94
95
  
              //提成参数
f78e65b3   姜超   feature(*): 绩效组参数校验
96
97
98
99
100
101
              if (PublicUtil.isNotEmpty(indicatorDto.getCommissionParams())) {
                  for (KpiGroupIndicatorParamDTO commissionParam : indicatorDto.getCommissionParams()) {
                      KpiGroupIndicatorParam param = PublicUtil.copy(commissionParam, KpiGroupIndicatorParam.class);
                      param.setKpiGroupId(kpiGroupId);
                      param.setKpiGroupIndicatorId(indicatorId);
                      param.setParamType(ParamTypeEnum.COMMISSION);
f4b9a6ec   姜超   feature(*): 修改绩效组保存
102
                      param.setProportion(param.getProportion().divide(Constant.ONE_HUNDRED, 4, RoundingMode.HALF_UP));
3042c640   张志伟   :fire:
103
                      if (PublicUtil.isNotEmpty(param.getTargetType()) && TargetTypeEnum.RATIO.equals(param.getTargetType())) {
f78e65b3   姜超   feature(*): 绩效组参数校验
104
105
                          param.setTargetValue(param.getTargetValue().divide(Constant.ONE_HUNDRED, 4, RoundingMode.HALF_UP));
                      }
e5b3d2c9   姜超   feature(*): 绩效组参数校验
106
                      params.add(param);
6786b5e1   姜超   feature(*): 绩效组配置修改
107
                  }
6786b5e1   姜超   feature(*): 绩效组配置修改
108
109
110
              }
  
              //条件
f78e65b3   姜超   feature(*): 绩效组参数校验
111
112
              if (PublicUtil.isNotEmpty(indicatorDto.getConds())) {
                  for (KpiGroupIndicatorPreconditionDTO condDto : indicatorDto.getConds()) {
278ef9ef   姜超   feature(bug): 修改目...
113
                      Indicators indicators1 = indicatorsService.queryByCode(condDto.getIndicatorCode(), Boolean.FALSE);
f78e65b3   姜超   feature(*): 绩效组参数校验
114
115
116
                      KpiGroupIndicatorPrecondition cond = PublicUtil.copy(condDto, KpiGroupIndicatorPrecondition.class);
                      cond.setKpiGroupId(kpiGroupId);
                      cond.setKpiGroupIndicatorId(indicatorId);
3042c640   张志伟   :fire:
117
                      if (PublicUtil.isNotEmpty(cond.getTargetType()) && TargetTypeEnum.RATIO.equals(cond.getTargetType())) {
6786b5e1   姜超   feature(*): 绩效组配置修改
118
119
                          cond.setTargetValue(cond.getTargetValue().divide(Constant.ONE_HUNDRED, 4, RoundingMode.HALF_UP));
                      }
718f8378   张志伟   feature(*): 修改类名
120
                      kpiGroupIndicatorPreconditionService.save(cond);
f78e65b3   姜超   feature(*): 绩效组参数校验
121
122
123
124
125
  
                      Long kpiGroupIndicatorCondId = cond.getId();
                      for (KpiGroupIndicatorPreconditionLaddersDTO condLaddersDto : condDto.getCondLadders()) {
                          KpiGroupIndicatorPreconditionLadders condLadder = PublicUtil.copy(condLaddersDto, KpiGroupIndicatorPreconditionLadders.class);
                          condLadder.setPreconditionId(kpiGroupIndicatorCondId);
69f59d7a   姜超   feature(bug): 修改目...
126
                          condLadder.dividePercent(cond.getTargetType(), indicators1.getDataType());
3042c640   张志伟   :fire:
127
                          if (PublicUtil.isNotEmpty(cond.getTargetType()) && TargetTypeEnum.RATIO.equals(cond.getTargetType())) {
f78e65b3   姜超   feature(*): 绩效组参数校验
128
129
                              cond.setTargetValue(cond.getTargetValue().divide(Constant.ONE_HUNDRED, 4, RoundingMode.HALF_UP));
                          }
e5b3d2c9   姜超   feature(*): 绩效组参数校验
130
                          preconditionLadders.add(condLadder);
f78e65b3   姜超   feature(*): 绩效组参数校验
131
                      }
6786b5e1   姜超   feature(*): 绩效组配置修改
132
133
134
                  }
              }
  
6786b5e1   姜超   feature(*): 绩效组配置修改
135
              //普通得分没有台阶条件
8464701b   姜超   feature(*): 绩效组变动通知
136
137
138
              if (ScoreWayEnum.NORMAL.equals(indicator.getScoreWay())) {
                  continue;
              }
e5b3d2c9   姜超   feature(*): 绩效组参数校验
139
140
141
              if (PublicUtil.isEmpty(indicatorDto.getLadderParams()) || PublicUtil.isEmpty(indicatorDto.getIndicatorLadders())) {
                  throw new BusinessException("台阶参数、台阶不能为空");
              }
6786b5e1   姜超   feature(*): 绩效组配置修改
142
143
144
145
146
147
148
  
              //台阶参数
              for (KpiGroupIndicatorParamDTO commissionParam : indicatorDto.getLadderParams()) {
                  KpiGroupIndicatorParam param = PublicUtil.copy(commissionParam, KpiGroupIndicatorParam.class);
                  param.setKpiGroupId(kpiGroupId);
                  param.setKpiGroupIndicatorId(indicatorId);
                  param.setParamType(ParamTypeEnum.LADDER);
8f08359b   姜超   feature(*): 薪酬项新增字段
149
                  param.setProportion(param.getProportion().divide(Constant.ONE_HUNDRED, 4, RoundingMode.HALF_UP));
3042c640   张志伟   :fire:
150
                  if (PublicUtil.isNotEmpty(param.getTargetType()) && TargetTypeEnum.RATIO.equals(param.getTargetType())) {
6786b5e1   姜超   feature(*): 绩效组配置修改
151
152
                      param.setTargetValue(param.getTargetValue().divide(Constant.ONE_HUNDRED, 4, RoundingMode.HALF_UP));
                  }
e5b3d2c9   姜超   feature(*): 绩效组参数校验
153
                  params.add(param);
6786b5e1   姜超   feature(*): 绩效组配置修改
154
155
156
              }
  
              //台阶
718f8378   张志伟   feature(*): 修改类名
157
              for (KpiGroupIndicatorLaddersDTO laddersDto : indicatorDto.getIndicatorLadders()) {
f4f1f40b   姜超   feature(*): 月定时器
158
                  indicatorLadder = PublicUtil.copy(laddersDto, KpiGroupIndicatorLadders.class);
278ef9ef   姜超   feature(bug): 修改目...
159
160
161
162
                  if (PublicUtil.isNotEmpty(indicator.getLaddersType()) && DataTypeEnum.RATIO.equals(indicator.getLaddersType())) {
                      indicatorLadder.setUpper(indicatorLadder.getUpper().divide(Constant.ONE_HUNDRED, 4, RoundingMode.HALF_UP));
                      indicatorLadder.setLower(indicatorLadder.getLower().divide(Constant.ONE_HUNDRED, 4, RoundingMode.HALF_UP));
                  }
f4f1f40b   姜超   feature(*): 月定时器
163
164
165
166
                  indicatorLadder.setKpiGroupIndicatorId(indicatorId);
                  indicatorLadders.add(indicatorLadder);
              }
          }
6786b5e1   姜超   feature(*): 绩效组配置修改
167
  
e5b3d2c9   姜超   feature(*): 绩效组参数校验
168
169
170
171
172
173
174
175
176
          if (PublicUtil.isNotEmpty(indicatorLadders)) {
              kpiGroupIndicatorLaddersService.saveBatch(indicatorLadders);
          }
          if (PublicUtil.isNotEmpty(params)) {
              kpiGroupIndicatorParamService.saveBatch(params);
          }
          if (PublicUtil.isNotEmpty(preconditionLadders)) {
              kpiGroupIndicatorCondLaddersService.saveBatch(preconditionLadders);
          }
6786b5e1   姜超   feature(*): 绩效组配置修改
177
  
f4f1f40b   姜超   feature(*): 月定时器
178
179
      }
  
6786b5e1   姜超   feature(*): 绩效组配置修改
180
  
f4f1f40b   姜超   feature(*): 月定时器
181
182
      /**
       * 保存绩效星级评定阶梯
b8b6eb02   姜超   feature(*): 接口注释修改
183
       *
f4f1f40b   姜超   feature(*): 月定时器
184
185
186
187
188
189
190
191
192
193
194
       * @param starLaddersDtos
       * @param kpiGroup
       * @return
       */
      @Transactional(rollbackFor = Exception.class)
      public KpiGroup saveKpiStarLadders(List<KpiStarLaddersDTO> starLaddersDtos, KpiGroup kpiGroup) {
          List<KpiStarLadders> starLadders = Lists.newArrayListWithCapacity(starLaddersDtos.size());
          Long kpiGroupId = kpiGroup.getId();
          KpiStarLadders starLadder = null;
          for (KpiStarLaddersDTO starLaddersDto : starLaddersDtos) {
              starLadder = PublicUtil.copy(starLaddersDto, KpiStarLadders.class);
a4b02509   姜超   feature(*): 绩效组阶梯...
195
196
              starLadder.setUpper(starLadder.getUpper().divide(Constant.ONE_HUNDRED, 2, RoundingMode.HALF_UP));
              starLadder.setLower(starLadder.getLower().divide(Constant.ONE_HUNDRED, 2, RoundingMode.HALF_UP));
f4f1f40b   姜超   feature(*): 月定时器
197
198
199
200
201
202
203
204
              starLadder.setKpiGroupId(kpiGroupId);
              starLadders.add(starLadder);
          }
          kpiStarLaddersService.saveBatch(starLadders);
          return kpiGroup;
      }
  
      /**
b5f3bfd0   姜超   feature(*): 处理重复绩...
205
       * 删除绩效组配置(根本没有被使用的绩效组配置会被逻辑删除,如为次月添加3次配置,之前两次根本没有被用,直接删除)
b8b6eb02   姜超   feature(*): 接口注释修改
206
       *
b5f3bfd0   姜超   feature(*): 处理重复绩...
207
208
209
       * @param kpiGroups
       */
      @Transactional(rollbackFor = Exception.class)
a310d67e   姜超   feature(*): 绩效薪酬 ...
210
      public void delInEffective(List<KpiGroup> kpiGroups) {
b5f3bfd0   姜超   feature(*): 处理重复绩...
211
212
213
          if (PublicUtil.isEmpty(kpiGroups)) {
              return;
          }
718f8378   张志伟   feature(*): 修改类名
214
          List<Long> kpiIds = kpiGroups.stream().map(KpiGroup::getId).collect(Collectors.toList());
98f0b2aa   姜超   feature(*): 添加yn判断
215
216
217
  //        kpiGroupService.removeByIds(kpiIds);
          kpiGroupService.update(Wrappers.<KpiGroup>lambdaUpdate()
                  .set(KpiGroup::getYn, Boolean.FALSE)
a310d67e   姜超   feature(*): 绩效薪酬 ...
218
                  .set(KpiGroup::getUpdateTime, new Date())
98f0b2aa   姜超   feature(*): 添加yn判断
219
220
                  .in(KpiGroup::getId, kpiIds)
          );
b5f3bfd0   姜超   feature(*): 处理重复绩...
221
222
223
      }
  
      /**
f4f1f40b   姜超   feature(*): 月定时器
224
       * 修改多个绩效组状态
b8b6eb02   姜超   feature(*): 接口注释修改
225
       *
f4f1f40b   姜超   feature(*): 月定时器
226
227
228
229
230
231
232
233
       * @param kpiGroups
       * @param status
       */
      @Transactional(rollbackFor = Exception.class)
      public void modifyStatusByKpis(List<KpiGroup> kpiGroups, SettingStatusEnum status) {
          if (PublicUtil.isEmpty(kpiGroups)) {
              return;
          }
718f8378   张志伟   feature(*): 修改类名
234
          List<Long> kpiIds = kpiGroups.stream().map(KpiGroup::getId).collect(Collectors.toList());
e01fd137   姜超   feat(*): 定时器修改、审批...
235
          this.modifyStatusByIds(kpiIds, status);
f4f1f40b   姜超   feature(*): 月定时器
236
237
238
      }
  
      /**
eb829e71   姜超   feature(*): 绩效组重复...
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
       * 将绩效组对应的草稿设置为未发布
       *
       * @param kpiGroups
       */
      @Transactional(rollbackFor = Exception.class)
      public void modifyDraftNoRelease(List<KpiGroup> kpiGroups) {
          if (PublicUtil.isEmpty(kpiGroups)) {
              return;
          }
          List<Long> kpiIds = kpiGroups.stream().map(KpiGroup::getId).collect(Collectors.toList());
  
          settingDraftService.update(Wrappers.<SettingDraft>lambdaUpdate()
                  .set(SettingDraft::getUpdateTime, new Date())
                  .set(SettingDraft::getStatus, SettingDraftStatusEnum.NO_RELEASE)
                  .in(SettingDraft::getUnionId, kpiIds)
                  .eq(SettingDraft::getType, SettingDraftTypeEnum.KPI)
                  .eq(SettingDraft::getYn, Boolean.TRUE)
          );
      }
  
      /**
f4f1f40b   姜超   feature(*): 月定时器
260
       * 修改多个绩效组状态
b8b6eb02   姜超   feature(*): 接口注释修改
261
       *
f4f1f40b   姜超   feature(*): 月定时器
262
263
264
265
266
267
268
269
270
       * @param kpiIds
       * @param status
       */
      @Transactional(rollbackFor = Exception.class)
      public void modifyStatusByIds(List<Long> kpiIds, SettingStatusEnum status) {
          if (PublicUtil.isEmpty(kpiIds)) {
              return;
          }
          log.info("修改绩效组配置状态:{},{}", JSON.toJSONString(kpiIds), status.getName());
e01fd137   姜超   feat(*): 定时器修改、审批...
271
272
273
          LocalDate localDate = LocalDate.now();
          LambdaUpdateWrapper<KpiGroup> updateWrapper = Wrappers.<KpiGroup>lambdaUpdate()
                  .set(KpiGroup::getStatus, status)
427d5114   姜超   feature(*): 定时任务日志修改
274
                  .in(KpiGroup::getId, kpiIds);
e01fd137   姜超   feat(*): 定时器修改、审批...
275
          switch (status) {
718f8378   张志伟   feature(*): 修改类名
276
              case EFFECTIVE: {
e01fd137   姜超   feat(*): 定时器修改、审批...
277
278
279
                  updateWrapper.set(KpiGroup::getBeginTime, localDate);
                  break;
              }
718f8378   张志伟   feature(*): 修改类名
280
              case INEFFECTIVE: {
e01fd137   姜超   feat(*): 定时器修改、审批...
281
282
283
284
                  updateWrapper.set(KpiGroup::getOverTime, PublicUtil.getPreviousDay(localDate));
                  break;
              }
          }
f643dda5   姜超   feature(*): 模糊查询绩...
285
          kpiGroupService.update(updateWrapper);
f4f1f40b   姜超   feature(*): 月定时器
286
287
288
289
      }
  
      /**
       * 修改绩效组状态
b8b6eb02   姜超   feature(*): 接口注释修改
290
       *
43817799   姜超   feature(*): 星级考核审批
291
       * @param kpiGroup
f4f1f40b   姜超   feature(*): 月定时器
292
293
294
       * @param status
       */
      @Transactional(rollbackFor = Exception.class)
43817799   姜超   feature(*): 星级考核审批
295
296
      public void modifyStatusById(KpiGroup kpiGroup, SettingStatusEnum status) {
          log.info("修改绩效组配置状态:{},{}", kpiGroup.getId(), status.getName());
e01fd137   姜超   feat(*): 定时器修改、审批...
297
298
          LocalDate localDate = LocalDate.now();
          LambdaUpdateWrapper<KpiGroup> updateWrapper = Wrappers.<KpiGroup>lambdaUpdate()
f4f1f40b   姜超   feature(*): 月定时器
299
                  .set(KpiGroup::getStatus, status)
43817799   姜超   feature(*): 星级考核审批
300
                  .eq(KpiGroup::getId, kpiGroup.getId());
5658b543   xianpengcheng   更新薪酬组sgc可能重复的问题
301
          updateWrapper.set(!StringUtils.isEmpty(kpiGroup.getKgc()),KpiGroup::getKgc, kpiGroup.getKgc());
e01fd137   姜超   feat(*): 定时器修改、审批...
302
303
304
305
306
307
          switch (status) {
  //            case BE_EFFECTIVE : {
  //                KpiGroup kpiGroup = kpiGroupService.getById(kpiId);
  //                updateWrapper.set(KpiGroup::getBeginTime, kpiGroup.getBeginTime());
  //                break;
  //            }
718f8378   张志伟   feature(*): 修改类名
308
              case EFFECTIVE: {
e01fd137   姜超   feat(*): 定时器修改、审批...
309
310
311
                  updateWrapper.set(KpiGroup::getBeginTime, localDate);
                  break;
              }
718f8378   张志伟   feature(*): 修改类名
312
              case INEFFECTIVE: {
43817799   姜超   feature(*): 星级考核审批
313
314
315
316
                  //之前生效过得配置需要 设置结束时间
                  if (SettingStatusEnum.EFFECTIVE.equals(kpiGroup.getStatus())) {
                      updateWrapper.set(KpiGroup::getOverTime, PublicUtil.getPreviousDay(localDate));
                  }
e01fd137   姜超   feat(*): 定时器修改、审批...
317
318
319
                  break;
              }
          }
87a04a20   姜超   fix(*): rpc实体类修改
320
          kpiGroupService.update(updateWrapper);
f4f1f40b   姜超   feature(*): 月定时器
321
322
      }
  
4ca0aa3a   姜超   fix(*): 绩效组、薪酬组添加...
323
324
325
326
327
      /**
       * 初始化kgc
       */
      @Transactional(rollbackFor = Exception.class)
      public void initKgc() {
718f8378   张志伟   feature(*): 修改类名
328
          List<SettingStatusEnum> status = new ArrayList<SettingStatusEnum>() {{
4ca0aa3a   姜超   fix(*): 绩效组、薪酬组添加...
329
330
331
              add(SettingStatusEnum.EFFECTIVE);
          }};
          List<KpiGroup> kpiGroups = kpiGroupService.list(Wrappers.<KpiGroup>lambdaQuery()
503d9f0d   姜超   feature(*): 绩效、薪酬...
332
                  .in(KpiGroup::getStatus, status)
4ca0aa3a   姜超   fix(*): 绩效组、薪酬组添加...
333
334
                  .eq(KpiGroup::getYn, Boolean.TRUE)
          );
f4f1f40b   姜超   feature(*): 月定时器
335
  
4ca0aa3a   姜超   fix(*): 绩效组、薪酬组添加...
336
337
338
339
340
341
342
343
344
345
346
347
          for (KpiGroup kpiGroup : kpiGroups) {
              final Long kpiGroupId = kpiGroup.getId();
              final String kgc = PublicUtil.getUUID();
  
              kpiGroupService.update(Wrappers.<KpiGroup>lambdaUpdate()
                      .set(KpiGroup::getKgc, kgc)
                      .set(KpiGroup::getUpdateTime, new Date())
                      .eq(KpiGroup::getId, kpiGroupId)
              );
              kpiGroupUserService.update(Wrappers.<KpiGroupUser>lambdaUpdate()
                      .set(KpiGroupUser::getKgc, kgc)
                      .set(KpiGroupUser::getUpdateTime, new Date())
503d9f0d   姜超   feature(*): 绩效、薪酬...
348
                      .eq(KpiGroupUser::getKpiGroupId, kpiGroupId)
4ca0aa3a   姜超   fix(*): 绩效组、薪酬组添加...
349
350
              );
              kpiPoolService.update(Wrappers.<KpiPool>lambdaUpdate()
a92022b7   姜超   feature(*): 绩效不再使...
351
  //                    .set(KpiPool::getKgc, kgc)
4ca0aa3a   姜超   fix(*): 绩效组、薪酬组添加...
352
                      .set(KpiPool::getUpdateTime, new Date())
503d9f0d   姜超   feature(*): 绩效、薪酬...
353
                      .eq(KpiPool::getKpiGroupId, kpiGroupId)
4ca0aa3a   姜超   fix(*): 绩效组、薪酬组添加...
354
355
356
357
              );
  
          }
      }
f4f1f40b   姜超   feature(*): 月定时器
358
359
  
  }