Commit 58b7591d15f3416375a1ec59a983373e6974ff2d
Merge branch 'test' into eval-detail
Showing
22 changed files
with
146 additions
and
94 deletions
fw-morax-dao/src/main/java/cn/fw/morax/dao/eval/EvalGroupIndicatorDao.java
@@ -5,6 +5,7 @@ import cn.fw.morax.domain.bo.StageIndicatorBO; | @@ -5,6 +5,7 @@ import cn.fw.morax.domain.bo.StageIndicatorBO; | ||
5 | import cn.fw.morax.domain.bo.eval.EvalGroupIndicatorBO; | 5 | import cn.fw.morax.domain.bo.eval.EvalGroupIndicatorBO; |
6 | import cn.fw.morax.domain.db.eval.EvalGroupIndicator; | 6 | import cn.fw.morax.domain.db.eval.EvalGroupIndicator; |
7 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 7 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
8 | +import org.apache.ibatis.annotations.Param; | ||
8 | 9 | ||
9 | import java.time.LocalDate; | 10 | import java.time.LocalDate; |
10 | import java.util.List; | 11 | import java.util.List; |
@@ -36,5 +37,6 @@ public interface EvalGroupIndicatorDao extends BaseMapper<EvalGroupIndicator> { | @@ -36,5 +37,6 @@ public interface EvalGroupIndicatorDao extends BaseMapper<EvalGroupIndicator> { | ||
36 | * @param codeType | 37 | * @param codeType |
37 | * @return | 38 | * @return |
38 | */ | 39 | */ |
39 | - List<StageIndicatorBO> getStageIndicators(LocalDate dataDate, Integer codeType); | 40 | + List<StageIndicatorBO> getStageIndicators(@Param("dataDate") LocalDate dataDate, |
41 | + @Param("codeType") Integer codeType); | ||
40 | } | 42 | } |
fw-morax-dao/src/main/java/cn/fw/morax/dao/kpi/KpiGroupUserDao.java
@@ -19,21 +19,19 @@ public interface KpiGroupUserDao extends BaseMapper<KpiGroupUser> { | @@ -19,21 +19,19 @@ public interface KpiGroupUserDao extends BaseMapper<KpiGroupUser> { | ||
19 | /** | 19 | /** |
20 | * 获取某月最近的绩效组人员数据 | 20 | * 获取某月最近的绩效组人员数据 |
21 | * | 21 | * |
22 | - * @param kgc | ||
23 | * @param yearMonth | 22 | * @param yearMonth |
24 | * @return | 23 | * @return |
25 | */ | 24 | */ |
26 | - KpiGroupUser getMonthLastData(@Param("kgc") String kgc, | 25 | + KpiGroupUser getMonthLastData(@Param("kpiGroupId") Long kpiGroupId, |
27 | @Param("userId") Long userId, | 26 | @Param("userId") Long userId, |
28 | @Param("yearMonth") YearMonth yearMonth); | 27 | @Param("yearMonth") YearMonth yearMonth); |
29 | /** | 28 | /** |
30 | * 获取某月第一天的绩效组人员数据 | 29 | * 获取某月第一天的绩效组人员数据 |
31 | * | 30 | * |
32 | - * @param kgc | ||
33 | * @param yearMonth | 31 | * @param yearMonth |
34 | * @return | 32 | * @return |
35 | */ | 33 | */ |
36 | - KpiGroupUser getMonthFirstData(@Param("kgc") String kgc, | 34 | + KpiGroupUser getMonthFirstData(@Param("kpiGroupId") Long kpiGroupId, |
37 | @Param("userId") Long userId, | 35 | @Param("userId") Long userId, |
38 | @Param("yearMonth") YearMonth yearMonth); | 36 | @Param("yearMonth") YearMonth yearMonth); |
39 | } | 37 | } |
fw-morax-dao/src/main/resources/mapper/kpi/KpiGroupUserMapper.xml
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | FROM | 14 | FROM |
15 | kpi_group_user | 15 | kpi_group_user |
16 | WHERE | 16 | WHERE |
17 | - kgc = #{kgc} | 17 | + kpi_group_id = #{kpiGroupId} |
18 | AND user_id = #{userId} | 18 | AND user_id = #{userId} |
19 | AND DATE_FORMAT(data_date, '%Y-%m') = #{yearMonth} | 19 | AND DATE_FORMAT(data_date, '%Y-%m') = #{yearMonth} |
20 | AND yn = 1 | 20 | AND yn = 1 |
@@ -29,7 +29,7 @@ | @@ -29,7 +29,7 @@ | ||
29 | FROM | 29 | FROM |
30 | kpi_group_user | 30 | kpi_group_user |
31 | WHERE | 31 | WHERE |
32 | - kgc = #{kgc} | 32 | + kpi_group_id = #{kpiGroupId} |
33 | AND user_id = #{userId} | 33 | AND user_id = #{userId} |
34 | AND DATE_FORMAT(data_date, '%Y-%m') = #{yearMonth} | 34 | AND DATE_FORMAT(data_date, '%Y-%m') = #{yearMonth} |
35 | AND yn = 1 | 35 | AND yn = 1 |
fw-morax-domain/src/main/java/cn/fw/morax/domain/db/kpi/KpiStageMqLog.java
@@ -30,7 +30,7 @@ import java.util.List; | @@ -30,7 +30,7 @@ import java.util.List; | ||
30 | public class KpiStageMqLog extends Model<KpiStageMqLog> { | 30 | public class KpiStageMqLog extends Model<KpiStageMqLog> { |
31 | 31 | ||
32 | private static final long serialVersionUID = 1L; | 32 | private static final long serialVersionUID = 1L; |
33 | - @TableId(type = IdType.ASSIGN_ID) | 33 | + @TableId(type = IdType.AUTO) |
34 | private Long id; | 34 | private Long id; |
35 | 35 | ||
36 | /** | 36 | /** |
fw-morax-server/src/main/java/cn/fw/morax/server/controller/erp/EvalTaskController.java
@@ -113,12 +113,12 @@ public class EvalTaskController { | @@ -113,12 +113,12 @@ public class EvalTaskController { | ||
113 | return success(); | 113 | return success(); |
114 | } | 114 | } |
115 | 115 | ||
116 | -// @GetMapping("/check-report") | ||
117 | -// @ControllerMethod("当天薪酬组人员定时器") | ||
118 | -// public Message<Void> checkTodoCompletion() { | ||
119 | -// evalCalcTask.checkTodoCompletion(); | ||
120 | -// return success(); | ||
121 | -// } | 116 | + @GetMapping("/send-notice") |
117 | + @ControllerMethod("发送业务上报mq通知") | ||
118 | + public Message<Void> sendNotice() { | ||
119 | + evalGroupTask.sendNotice(); | ||
120 | + return success(); | ||
121 | + } | ||
122 | 122 | ||
123 | // @GetMapping("/eval-group") | 123 | // @GetMapping("/eval-group") |
124 | // @ControllerMethod("处理考评组") | 124 | // @ControllerMethod("处理考评组") |
fw-morax-server/src/main/java/cn/fw/morax/server/controller/erp/KpiDebugController.java
@@ -217,4 +217,32 @@ public class KpiDebugController { | @@ -217,4 +217,32 @@ public class KpiDebugController { | ||
217 | return success(); | 217 | return success(); |
218 | } | 218 | } |
219 | 219 | ||
220 | + @GetMapping("/process-kpi-user") | ||
221 | + @ControllerMethod("处理绩效用户老数据") | ||
222 | + public Message<Void> processKpiUserInclusion() { | ||
223 | + //纳入绩效考核人员 | ||
224 | + List<KpiGroupUser> groupUsers = kpiGroupUserService.list(Wrappers.<KpiGroupUser>lambdaQuery() | ||
225 | + .eq(KpiGroupUser::getDataDate, LocalDate.now().minusDays(1)) | ||
226 | + .eq(KpiGroupUser::getIgnored, Boolean.FALSE) | ||
227 | + .eq(KpiGroupUser::getYn, Boolean.TRUE) | ||
228 | + ); | ||
229 | + | ||
230 | + for (KpiGroupUser groupUser : groupUsers) { | ||
231 | + KpiPool kpiPool = kpiPoolService.getOne(Wrappers.<KpiPool>lambdaQuery() | ||
232 | + .eq(KpiPool::getKpiGroupId, groupUser.getKpiGroupId()) | ||
233 | + .eq(KpiPool::getUserId, groupUser.getUserId()) | ||
234 | + .eq(KpiPool::getMonthly, YearMonth.from(groupUser.getDataDate())) | ||
235 | + .eq(KpiPool::getYn, Boolean.TRUE) | ||
236 | + , Boolean.FALSE); | ||
237 | + if (PublicUtil.isNotEmpty(kpiPool)) { | ||
238 | + //纳入绩效计算 绩效池不参与 | ||
239 | + if (! kpiPool.getInclusion()) { | ||
240 | + kpiPool.setInclusion(Boolean.TRUE); | ||
241 | + kpiPoolService.updateById(kpiPool); | ||
242 | + } | ||
243 | + } | ||
244 | + } | ||
245 | + return success(); | ||
246 | + } | ||
247 | + | ||
220 | } | 248 | } |
fw-morax-server/src/main/java/cn/fw/morax/server/task/EvalGroupTask.java
@@ -7,6 +7,7 @@ import cn.fw.morax.common.utils.PublicUtil; | @@ -7,6 +7,7 @@ import cn.fw.morax.common.utils.PublicUtil; | ||
7 | import cn.fw.morax.domain.bo.StageIndicatorBO; | 7 | import cn.fw.morax.domain.bo.StageIndicatorBO; |
8 | import cn.fw.morax.domain.db.eval.*; | 8 | import cn.fw.morax.domain.db.eval.*; |
9 | import cn.fw.morax.domain.db.kpi.KpiStageMqLog; | 9 | import cn.fw.morax.domain.db.kpi.KpiStageMqLog; |
10 | +import cn.fw.morax.domain.enums.EvalScopeEnum; | ||
10 | import cn.fw.morax.domain.enums.SettingStatusEnum; | 11 | import cn.fw.morax.domain.enums.SettingStatusEnum; |
11 | import cn.fw.morax.sdk.dto.kpi.KpiStageReportNoticeMQ; | 12 | import cn.fw.morax.sdk.dto.kpi.KpiStageReportNoticeMQ; |
12 | import cn.fw.morax.service.component.KpiStageIndicatorReportProducer; | 13 | import cn.fw.morax.service.component.KpiStageIndicatorReportProducer; |
@@ -44,6 +45,7 @@ public class EvalGroupTask { | @@ -44,6 +45,7 @@ public class EvalGroupTask { | ||
44 | private final EvalGroupIndicatorService evalGroupIndicatorService; | 45 | private final EvalGroupIndicatorService evalGroupIndicatorService; |
45 | private final EvalGroupRankStageService evalGroupRankStageService; | 46 | private final EvalGroupRankStageService evalGroupRankStageService; |
46 | private final EvalShopPoolService evalShopPoolService; | 47 | private final EvalShopPoolService evalShopPoolService; |
48 | + private final EvalGroupRewardDimService evalGroupRewardDimService; | ||
47 | private final EvalGroupUserService evalGroupUserService; | 49 | private final EvalGroupUserService evalGroupUserService; |
48 | private final KpiStageMqLogService kpiStageMqLogService; | 50 | private final KpiStageMqLogService kpiStageMqLogService; |
49 | private final EvalGroupRankService evalGroupRankService; | 51 | private final EvalGroupRankService evalGroupRankService; |
@@ -102,8 +104,14 @@ public class EvalGroupTask { | @@ -102,8 +104,14 @@ public class EvalGroupTask { | ||
102 | .eq(EvalGroupUser::getYn, Boolean.TRUE) | 104 | .eq(EvalGroupUser::getYn, Boolean.TRUE) |
103 | ); | 105 | ); |
104 | List<Long> userIds = users.stream().map(EvalGroupUser::getUserId).distinct().collect(Collectors.toList()); | 106 | List<Long> userIds = users.stream().map(EvalGroupUser::getUserId).distinct().collect(Collectors.toList()); |
105 | - List<Long> shopIds = users.stream().map(EvalGroupUser::getShopId).distinct().collect(Collectors.toList()); | ||
106 | - if (PublicUtil.isEmpty(userIds)) { | 107 | + |
108 | + List<EvalGroupRewardDim> rewardDims = evalGroupRewardDimService.list(Wrappers.<EvalGroupRewardDim>lambdaQuery() | ||
109 | + .eq(EvalGroupRewardDim::getEvalGroupId, stageIndicator.getEvalGroupId()) | ||
110 | + .eq(EvalGroupRewardDim::getType, EvalScopeEnum.SHOP) | ||
111 | + .eq(EvalGroupRewardDim::getYn, Boolean.TRUE) | ||
112 | + ); | ||
113 | + List<Long> shopIds = rewardDims.stream().flatMap(dim -> dim.getShopIds().stream()).distinct().collect(Collectors.toList()); | ||
114 | + if (PublicUtil.isEmpty(userIds) && PublicUtil.isEmpty(shopIds)) { | ||
107 | return; | 115 | return; |
108 | } | 116 | } |
109 | mqLog.setShopIds(shopIds); | 117 | mqLog.setShopIds(shopIds); |
fw-morax-server/src/main/java/cn/fw/morax/server/task/EvalUserReportTask.java
@@ -76,7 +76,7 @@ public class EvalUserReportTask { | @@ -76,7 +76,7 @@ public class EvalUserReportTask { | ||
76 | @Scheduled(cron = TimeTaskConstant.EVAL_REPORT) | 76 | @Scheduled(cron = TimeTaskConstant.EVAL_REPORT) |
77 | @Transactional(rollbackFor = Exception.class) | 77 | @Transactional(rollbackFor = Exception.class) |
78 | public void evalUserReportTask() { | 78 | public void evalUserReportTask() { |
79 | - this.evalUserReport(LocalDate.now().minusDays(1)); | 79 | +// this.evalUserReport(LocalDate.now().minusDays(1)); |
80 | } | 80 | } |
81 | 81 | ||
82 | /** | 82 | /** |
fw-morax-server/src/main/java/cn/fw/morax/server/task/KpiReportRatioTask.java
@@ -368,10 +368,10 @@ public class KpiReportRatioTask { | @@ -368,10 +368,10 @@ public class KpiReportRatioTask { | ||
368 | List<KpiGroup> kpiGroups = calDto.getKpiGroups(); | 368 | List<KpiGroup> kpiGroups = calDto.getKpiGroups(); |
369 | 369 | ||
370 | for (KpiGroupRank rank : calDto.getKpiGroupRanks()) { | 370 | for (KpiGroupRank rank : calDto.getKpiGroupRanks()) { |
371 | - List<String> kgcs = rank.getKgcs(); | 371 | + List<Long> kpiGroupIds = rank.getKpiGroupIds(); |
372 | //绩效排名组下对应的绩效组集合 | 372 | //绩效排名组下对应的绩效组集合 |
373 | List<KpiGroup> rankKpiGroups = kpiGroups.stream() | 373 | List<KpiGroup> rankKpiGroups = kpiGroups.stream() |
374 | - .filter(kpiGroup -> kgcs.contains(kpiGroup.getKgc())) | 374 | + .filter(kpiGroup -> kpiGroupIds.contains(kpiGroup.getId())) |
375 | .collect(Collectors.toList()); | 375 | .collect(Collectors.toList()); |
376 | Set<Long> createShopIds = rankKpiGroups.stream().flatMap(kpiGroup -> kpiGroup.getShopIds().stream()).collect(Collectors.toSet()); | 376 | Set<Long> createShopIds = rankKpiGroups.stream().flatMap(kpiGroup -> kpiGroup.getShopIds().stream()).collect(Collectors.toSet()); |
377 | 377 | ||
@@ -380,7 +380,7 @@ public class KpiReportRatioTask { | @@ -380,7 +380,7 @@ public class KpiReportRatioTask { | ||
380 | 380 | ||
381 | Long shopId = shop.getId(); | 381 | Long shopId = shop.getId(); |
382 | Predicate<KpiPool> predicate = pool -> { | 382 | Predicate<KpiPool> predicate = pool -> { |
383 | - return shopId.equals(pool.getShopId()) && kgcs.contains(pool.getKgc()) && Boolean.TRUE.equals(pool.getInclusion()); | 383 | + return shopId.equals(pool.getShopId()) && kpiGroupIds.contains(pool.getKpiGroupId()) && Boolean.TRUE.equals(pool.getInclusion()); |
384 | }; | 384 | }; |
385 | kpiRatio.setS5(rank.getName()); | 385 | kpiRatio.setS5(rank.getName()); |
386 | kpiRatio.setL5(rank.getId()); | 386 | kpiRatio.setL5(rank.getId()); |
@@ -396,7 +396,7 @@ public class KpiReportRatioTask { | @@ -396,7 +396,7 @@ public class KpiReportRatioTask { | ||
396 | 396 | ||
397 | KpiRatio kpiRatio = new KpiRatio(ReportDimensionEnum.KPI_RANK, calDto.getGroupId());; | 397 | KpiRatio kpiRatio = new KpiRatio(ReportDimensionEnum.KPI_RANK, calDto.getGroupId());; |
398 | Predicate<KpiPool> predicate = pool -> { | 398 | Predicate<KpiPool> predicate = pool -> { |
399 | - return kgcs.contains(pool.getKgc()) && Boolean.TRUE.equals(pool.getInclusion()); | 399 | + return kpiGroupIds.contains(pool.getKpiGroupId()) && Boolean.TRUE.equals(pool.getInclusion()); |
400 | }; | 400 | }; |
401 | kpiRatio.setS5(rank.getName()); | 401 | kpiRatio.setS5(rank.getName()); |
402 | kpiRatio.setL5(rank.getId()); | 402 | kpiRatio.setL5(rank.getId()); |
@@ -488,10 +488,10 @@ public class KpiReportRatioTask { | @@ -488,10 +488,10 @@ public class KpiReportRatioTask { | ||
488 | List<KpiGroupRank> kpiGroupRanks = calDto.getKpiGroupRanks(); | 488 | List<KpiGroupRank> kpiGroupRanks = calDto.getKpiGroupRanks(); |
489 | 489 | ||
490 | Map<Long, String> kpiGroupNameMap = kpiGroups.stream().collect(Collectors.toMap(KpiGroup::getId, KpiGroup::getName, (v1, v2) -> v1)); | 490 | Map<Long, String> kpiGroupNameMap = kpiGroups.stream().collect(Collectors.toMap(KpiGroup::getId, KpiGroup::getName, (v1, v2) -> v1)); |
491 | - Map<String, KpiGroupRank> kgcRankMap = new HashMap<>(); | 491 | + Map<Long, KpiGroupRank> kpiGroupRankMap = new HashMap<>(); |
492 | for (KpiGroupRank rank : kpiGroupRanks) { | 492 | for (KpiGroupRank rank : kpiGroupRanks) { |
493 | - for (String kgc : rank.getKgcs()) { | ||
494 | - kgcRankMap.put(kgc, rank); | 493 | + for (Long kpiGroupId : rank.getKpiGroupIds()) { |
494 | + kpiGroupRankMap.put(kpiGroupId, rank); | ||
495 | } | 495 | } |
496 | } | 496 | } |
497 | 497 | ||
@@ -512,8 +512,8 @@ public class KpiReportRatioTask { | @@ -512,8 +512,8 @@ public class KpiReportRatioTask { | ||
512 | kpiRatio.setL4(pool.getKpiGroupId()); | 512 | kpiRatio.setL4(pool.getKpiGroupId()); |
513 | kpiRatio.setS4(kpiGroupNameMap.getOrDefault(pool.getKpiGroupId(), " ")); | 513 | kpiRatio.setS4(kpiGroupNameMap.getOrDefault(pool.getKpiGroupId(), " ")); |
514 | 514 | ||
515 | - if (kgcRankMap.containsKey(pool.getKgc())) { | ||
516 | - KpiGroupRank rank = kgcRankMap.get(pool.getKgc()); | 515 | + if (kpiGroupRankMap.containsKey(pool.getKpiGroupId())) { |
516 | + KpiGroupRank rank = kpiGroupRankMap.get(pool.getKpiGroupId()); | ||
517 | kpiRatio.setL5(rank.getId()); | 517 | kpiRatio.setL5(rank.getId()); |
518 | kpiRatio.setS5(rank.getName()); | 518 | kpiRatio.setS5(rank.getName()); |
519 | } | 519 | } |
fw-morax-server/src/main/java/cn/fw/morax/server/task/KpiReportTask.java
@@ -144,7 +144,7 @@ public class KpiReportTask { | @@ -144,7 +144,7 @@ public class KpiReportTask { | ||
144 | */ | 144 | */ |
145 | private void createRankReport(KpiGroupRank kpiGroupRank, Long groupId, LocalDate date) { | 145 | private void createRankReport(KpiGroupRank kpiGroupRank, Long groupId, LocalDate date) { |
146 | //获取绩效排名组下的所有绩效组信息 | 146 | //获取绩效排名组下的所有绩效组信息 |
147 | - List<KpiGroup> kpiGroups = this.getKpiGroups(kpiGroupRank.getKgcs(), date); | 147 | + List<KpiGroup> kpiGroups = this.getKpiGroups(kpiGroupRank.getKpiGroupIds(), date); |
148 | if (CollectionUtils.isEmpty(kpiGroups)){ | 148 | if (CollectionUtils.isEmpty(kpiGroups)){ |
149 | log.error("绩效排名组id [{}] 下不存在有效的绩效组信息",kpiGroupRank.getId()); | 149 | log.error("绩效排名组id [{}] 下不存在有效的绩效组信息",kpiGroupRank.getId()); |
150 | return; | 150 | return; |
@@ -643,13 +643,16 @@ public class KpiReportTask { | @@ -643,13 +643,16 @@ public class KpiReportTask { | ||
643 | 643 | ||
644 | 644 | ||
645 | 645 | ||
646 | - public List<KpiGroup> getKpiGroups(List<String> egcs, LocalDate date) { | 646 | + public List<KpiGroup> getKpiGroups(List<Long> kpiGroupIds, LocalDate date) { |
647 | + if (PublicUtil.isEmpty(kpiGroupIds)) { | ||
648 | + return new ArrayList<>(); | ||
649 | + } | ||
647 | List<Integer> effectStatus = new ArrayList<Integer>(){{ | 650 | List<Integer> effectStatus = new ArrayList<Integer>(){{ |
648 | add(SettingStatusEnum.EFFECTIVE.getValue()); | 651 | add(SettingStatusEnum.EFFECTIVE.getValue()); |
649 | add(SettingStatusEnum.INEFFECTIVE.getValue()); | 652 | add(SettingStatusEnum.INEFFECTIVE.getValue()); |
650 | }}; | 653 | }}; |
651 | List<KpiGroup> kpiGroups = kpiGroupService.list(Wrappers.<KpiGroup>lambdaQuery() | 654 | List<KpiGroup> kpiGroups = kpiGroupService.list(Wrappers.<KpiGroup>lambdaQuery() |
652 | - .in(KpiGroup::getKgc, egcs) | 655 | + .in(KpiGroup::getId, kpiGroupIds) |
653 | .eq(KpiGroup::getYn, Boolean.TRUE) | 656 | .eq(KpiGroup::getYn, Boolean.TRUE) |
654 | .in(KpiGroup::getStatus, effectStatus) | 657 | .in(KpiGroup::getStatus, effectStatus) |
655 | .le(KpiGroup::getBeginTime, date) | 658 | .le(KpiGroup::getBeginTime, date) |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/calculator/eval/kpi/EvalKpiBaseCalculator.java
@@ -181,6 +181,9 @@ public abstract class EvalKpiBaseCalculator implements Calculator<EvalGroupUserS | @@ -181,6 +181,9 @@ public abstract class EvalKpiBaseCalculator implements Calculator<EvalGroupUserS | ||
181 | * 计算目标 | 181 | * 计算目标 |
182 | */ | 182 | */ |
183 | public BigDecimal calcTarget(TargetCalcTypeEnum targetCalcType, BigDecimal indicatorValue, BigDecimal targetValue) { | 183 | public BigDecimal calcTarget(TargetCalcTypeEnum targetCalcType, BigDecimal indicatorValue, BigDecimal targetValue) { |
184 | + if (PublicUtil.isEmpty(targetValue) || BigDecimal.ZERO.compareTo(targetValue) == 0) { | ||
185 | + return BigDecimal.ZERO; | ||
186 | + } | ||
184 | if (TargetCalcTypeEnum.MINIMUM.equals(targetCalcType)) { | 187 | if (TargetCalcTypeEnum.MINIMUM.equals(targetCalcType)) { |
185 | BigDecimal difference = BigDecimal.ONE.subtract(targetValue); | 188 | BigDecimal difference = BigDecimal.ONE.subtract(targetValue); |
186 | if (BigDecimal.ZERO.compareTo(difference) == 0) { | 189 | if (BigDecimal.ZERO.compareTo(difference) == 0) { |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/eval/EvalCalculateService.java
@@ -289,9 +289,12 @@ public class EvalCalculateService { | @@ -289,9 +289,12 @@ public class EvalCalculateService { | ||
289 | return userShops; | 289 | return userShops; |
290 | } | 290 | } |
291 | 291 | ||
292 | - List<Long> shopIds = evalGroup.getShopIds(); | ||
293 | - Map<Long, EvalShopPool> shopPoolBOMap = evalPoolCommonService.inspectionShopPools(evalGroup, localDate); | ||
294 | - for (Long shopId : shopIds) { | 292 | + List<Long> distShopIds = this.getEvalDistShopIds(evalGroup); |
293 | + if (PublicUtil.isEmpty(distShopIds)) { | ||
294 | + return new ArrayList<>(); | ||
295 | + } | ||
296 | + Map<Long, EvalShopPool> shopPoolBOMap = evalPoolCommonService.inspectionShopPools(evalGroup, localDate, distShopIds); | ||
297 | + for (Long shopId : distShopIds) { | ||
295 | EvalShopPool shopPool = shopPoolBOMap.get(shopId); | 298 | EvalShopPool shopPool = shopPoolBOMap.get(shopId); |
296 | userShops.add(convertBO(shopPool, evalGroup, beginDate, localDate)); | 299 | userShops.add(convertBO(shopPool, evalGroup, beginDate, localDate)); |
297 | } | 300 | } |
@@ -299,7 +302,17 @@ public class EvalCalculateService { | @@ -299,7 +302,17 @@ public class EvalCalculateService { | ||
299 | } | 302 | } |
300 | 303 | ||
301 | 304 | ||
302 | - | 305 | + public List<Long> getEvalDistShopIds(EvalGroup evalGroup) { |
306 | + List<EvalGroupRewardDim> rewardDims = evalGroupRewardDimService.list(Wrappers.<EvalGroupRewardDim>lambdaQuery() | ||
307 | + .eq(EvalGroupRewardDim::getEvalGroupId, evalGroup.getId()) | ||
308 | + .eq(EvalGroupRewardDim::getType, EvalScopeEnum.SHOP) | ||
309 | + .eq(EvalGroupRewardDim::getYn, Boolean.TRUE) | ||
310 | + ); | ||
311 | + if (PublicUtil.isEmpty(rewardDims)) { | ||
312 | + return new ArrayList<>(); | ||
313 | + } | ||
314 | + return rewardDims.stream().flatMap(dim -> dim.getShopIds().stream()).distinct().collect(Collectors.toList()); | ||
315 | + } | ||
303 | 316 | ||
304 | 317 | ||
305 | 318 |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/eval/EvalGroupRankBizService.java
@@ -78,10 +78,14 @@ public class EvalGroupRankBizService { | @@ -78,10 +78,14 @@ public class EvalGroupRankBizService { | ||
78 | epiGroupRankVO.setShopIds(new ArrayList<>()); | 78 | epiGroupRankVO.setShopIds(new ArrayList<>()); |
79 | epiGroupRankVO.setShopNames(new HashSet<>()); | 79 | epiGroupRankVO.setShopNames(new HashSet<>()); |
80 | for (EvalGroup evalGroup : egcGroupMap.getOrDefault(epiGroupRankVO.getId(), new ArrayList<>())) { | 80 | for (EvalGroup evalGroup : egcGroupMap.getOrDefault(epiGroupRankVO.getId(), new ArrayList<>())) { |
81 | - epiGroupRankVO.getPostIds().addAll(evalGroup.getPostIds()); | ||
82 | - epiGroupRankVO.getPostNames().addAll(evalGroup.getPostNames()); | ||
83 | - epiGroupRankVO.getShopIds().addAll(evalGroup.getShopIds()); | ||
84 | - epiGroupRankVO.getShopNames().addAll(evalGroup.getShopNames()); | 81 | + if (PublicUtil.isNotEmpty(evalGroup.getPostIds())) { |
82 | + epiGroupRankVO.getPostIds().addAll(evalGroup.getPostIds()); | ||
83 | + epiGroupRankVO.getPostNames().addAll(evalGroup.getPostNames()); | ||
84 | + } | ||
85 | + if (PublicUtil.isNotEmpty(evalGroup.getShopIds())) { | ||
86 | + epiGroupRankVO.getShopIds().addAll(evalGroup.getShopIds()); | ||
87 | + epiGroupRankVO.getShopNames().addAll(evalGroup.getShopNames()); | ||
88 | + } | ||
85 | } | 89 | } |
86 | } | 90 | } |
87 | page.setTotal(total); | 91 | page.setTotal(total); |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/eval/EvalPoolCommonService.java
@@ -73,7 +73,7 @@ public class EvalPoolCommonService { | @@ -73,7 +73,7 @@ public class EvalPoolCommonService { | ||
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
76 | - public Map<Long, EvalShopPool> inspectionShopPools(EvalGroup evalGroup, LocalDate localDate) { | 76 | + public Map<Long, EvalShopPool> inspectionShopPools(EvalGroup evalGroup, LocalDate localDate, List<Long> distShopIds) { |
77 | Set<Long> evalGroupShopIds = new HashSet<>(evalGroup.getShopIds()); | 77 | Set<Long> evalGroupShopIds = new HashSet<>(evalGroup.getShopIds()); |
78 | List<EvalShopPool> pools = evalShopPoolService.list(Wrappers.<EvalShopPool>lambdaQuery() | 78 | List<EvalShopPool> pools = evalShopPoolService.list(Wrappers.<EvalShopPool>lambdaQuery() |
79 | .eq(EvalShopPool::getEvalGroupId, evalGroup.getId()) | 79 | .eq(EvalShopPool::getEvalGroupId, evalGroup.getId()) |
@@ -87,20 +87,14 @@ public class EvalPoolCommonService { | @@ -87,20 +87,14 @@ public class EvalPoolCommonService { | ||
87 | return v1; | 87 | return v1; |
88 | })); | 88 | })); |
89 | 89 | ||
90 | - List<EvalGroupRewardDim> rewardDims = evalGroupRewardDimService.list(Wrappers.<EvalGroupRewardDim>lambdaQuery() | ||
91 | - .eq(EvalGroupRewardDim::getEvalGroupId, evalGroup.getId()) | ||
92 | - .eq(EvalGroupRewardDim::getType, EvalScopeEnum.SHOP) | ||
93 | - .eq(EvalGroupRewardDim::getYn, Boolean.TRUE) | ||
94 | - ); | ||
95 | - if (PublicUtil.isEmpty(rewardDims)) { | 90 | + if (PublicUtil.isEmpty(distShopIds)) { |
96 | return new HashMap<>(); | 91 | return new HashMap<>(); |
97 | } | 92 | } |
98 | - Set<Long> distRewardShopIds = rewardDims.stream().flatMap(dim -> dim.getShopIds().stream()).collect(Collectors.toSet()); | ||
99 | - for (Long shopId : distRewardShopIds) { | 93 | + for (Long shopId : distShopIds) { |
100 | if (! shopPoolMap.containsKey(shopId)) { | 94 | if (! shopPoolMap.containsKey(shopId)) { |
101 | - EvalShopPoolStatusEnum status = (distRewardShopIds.contains(shopId)) | ||
102 | - ? EvalShopPoolStatusEnum.CALC_REWARD : EvalShopPoolStatusEnum.NO_REWARD; | ||
103 | - EvalShopPool shopPool = this.inspectionShopPool(shopId, evalGroup, localDate, status); | 95 | +// EvalShopPoolStatusEnum status = (distShopIds.contains(shopId)) |
96 | +// ? EvalShopPoolStatusEnum.CALC_REWARD : EvalShopPoolStatusEnum.NO_REWARD; | ||
97 | + EvalShopPool shopPool = this.inspectionShopPool(shopId, evalGroup, localDate, EvalShopPoolStatusEnum.CALC_REWARD); | ||
104 | shopPoolMap.put(shopId, shopPool); | 98 | shopPoolMap.put(shopId, shopPool); |
105 | } | 99 | } |
106 | } | 100 | } |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/kpi/KpiGroupBizService.java
@@ -548,7 +548,11 @@ public class KpiGroupBizService { | @@ -548,7 +548,11 @@ public class KpiGroupBizService { | ||
548 | .eq(KpiGroup::getYn, Boolean.TRUE) | 548 | .eq(KpiGroup::getYn, Boolean.TRUE) |
549 | .eq(KpiGroup::getStatus, SettingStatusEnum.EFFECTIVE) | 549 | .eq(KpiGroup::getStatus, SettingStatusEnum.EFFECTIVE) |
550 | ); | 550 | ); |
551 | - BV.isTrue(count <= 0, "绩效组名称重复,请重新输入"); | 551 | +// BV.isTrue(count <= 0, "绩效组名称重复,请重新输入"); |
552 | + if (count > 0) { | ||
553 | + log.info("绩效组名称重复,name:{},id:{}: ", name, Optional.ofNullable(id).orElse(0L).toString()); | ||
554 | + throw new BusinessException("绩效组名称重复,请重新输入"); | ||
555 | + } | ||
552 | 556 | ||
553 | List<SettingDraft> drafts = commonService.getEditDraftByName(name, SettingDraftTypeEnum.KPI, draftId); | 557 | List<SettingDraft> drafts = commonService.getEditDraftByName(name, SettingDraftTypeEnum.KPI, draftId); |
554 | BV.isTrue(drafts.size() <= 0, "绩效组名称在草稿中存在,请重新输入"); | 558 | BV.isTrue(drafts.size() <= 0, "绩效组名称在草稿中存在,请重新输入"); |
@@ -1092,7 +1096,7 @@ public class KpiGroupBizService { | @@ -1092,7 +1096,7 @@ public class KpiGroupBizService { | ||
1092 | kpiPoolService.update(Wrappers.<KpiPool>lambdaUpdate() | 1096 | kpiPoolService.update(Wrappers.<KpiPool>lambdaUpdate() |
1093 | .set(KpiPool::getYn, Boolean.FALSE) | 1097 | .set(KpiPool::getYn, Boolean.FALSE) |
1094 | .set(KpiPool::getUpdateTime, new Date()) | 1098 | .set(KpiPool::getUpdateTime, new Date()) |
1095 | - .eq(KpiPool::getKgc, kpiGroup.getKgc()) | 1099 | + .eq(KpiPool::getKpiGroupId, kpiGroup.getId()) |
1096 | .eq(KpiPool::getYn, Boolean.TRUE) | 1100 | .eq(KpiPool::getYn, Boolean.TRUE) |
1097 | .eq(KpiPool::getMonthly, YearMonth.now()) | 1101 | .eq(KpiPool::getMonthly, YearMonth.now()) |
1098 | ); | 1102 | ); |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/kpi/KpiGroupDataService.java
@@ -348,7 +348,7 @@ public class KpiGroupDataService { | @@ -348,7 +348,7 @@ public class KpiGroupDataService { | ||
348 | .eq(KpiGroupUser::getKpiGroupId, kpiGroupId) | 348 | .eq(KpiGroupUser::getKpiGroupId, kpiGroupId) |
349 | ); | 349 | ); |
350 | kpiPoolService.update(Wrappers.<KpiPool>lambdaUpdate() | 350 | kpiPoolService.update(Wrappers.<KpiPool>lambdaUpdate() |
351 | - .set(KpiPool::getKgc, kgc) | 351 | +// .set(KpiPool::getKgc, kgc) |
352 | .set(KpiPool::getUpdateTime, new Date()) | 352 | .set(KpiPool::getUpdateTime, new Date()) |
353 | .eq(KpiPool::getKpiGroupId, kpiGroupId) | 353 | .eq(KpiPool::getKpiGroupId, kpiGroupId) |
354 | ); | 354 | ); |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/kpi/KpiGroupIndicatorBizService.java
@@ -148,7 +148,7 @@ public class KpiGroupIndicatorBizService { | @@ -148,7 +148,7 @@ public class KpiGroupIndicatorBizService { | ||
148 | * @return | 148 | * @return |
149 | */ | 149 | */ |
150 | public LocalDate getPoolLastData(KpiPool kpiPool) { | 150 | public LocalDate getPoolLastData(KpiPool kpiPool) { |
151 | - KpiGroupUser kpiGroupUser = kpiGroupUserService.getMonthLastData(kpiPool.getKgc(), kpiPool.getUserId(), kpiPool.getMonthly()); | 151 | + KpiGroupUser kpiGroupUser = kpiGroupUserService.getMonthLastData(kpiPool.getKpiGroupId(), kpiPool.getUserId(), kpiPool.getMonthly()); |
152 | if (PublicUtil.isEmpty(kpiGroupUser)) { | 152 | if (PublicUtil.isEmpty(kpiGroupUser)) { |
153 | log.error("员工绩效池:{},不存在绩效组人员", JSON.toJSONString(kpiPool)); | 153 | log.error("员工绩效池:{},不存在绩效组人员", JSON.toJSONString(kpiPool)); |
154 | return PublicUtil.getYesterdayOrEndOfMonthDay(kpiPool.getMonthly()); | 154 | return PublicUtil.getYesterdayOrEndOfMonthDay(kpiPool.getMonthly()); |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/kpi/KpiPoolBizService.java
@@ -13,10 +13,7 @@ import cn.fw.morax.domain.bo.kpi.KpiRankCalculableBO; | @@ -13,10 +13,7 @@ import cn.fw.morax.domain.bo.kpi.KpiRankCalculableBO; | ||
13 | import cn.fw.morax.domain.bo.kpi.KpiStarLadderBO; | 13 | import cn.fw.morax.domain.bo.kpi.KpiStarLadderBO; |
14 | import cn.fw.morax.domain.db.kpi.*; | 14 | import cn.fw.morax.domain.db.kpi.*; |
15 | import cn.fw.morax.domain.dto.kpi.KpiGroupRankConfigQueryDTO; | 15 | import cn.fw.morax.domain.dto.kpi.KpiGroupRankConfigQueryDTO; |
16 | -import cn.fw.morax.domain.enums.KpiAssessTypeEnum; | ||
17 | -import cn.fw.morax.domain.enums.KpiIgnoreCauseEnum; | ||
18 | -import cn.fw.morax.domain.enums.StarEvaluationEnum; | ||
19 | -import cn.fw.morax.domain.enums.StarLevelEnum; | 16 | +import cn.fw.morax.domain.enums.*; |
20 | import cn.fw.morax.domain.vo.kpi.*; | 17 | import cn.fw.morax.domain.vo.kpi.*; |
21 | import cn.fw.morax.service.data.kpi.*; | 18 | import cn.fw.morax.service.data.kpi.*; |
22 | import com.alibaba.fastjson.JSON; | 19 | import com.alibaba.fastjson.JSON; |
@@ -640,7 +637,10 @@ public class KpiPoolBizService { | @@ -640,7 +637,10 @@ public class KpiPoolBizService { | ||
640 | } | 637 | } |
641 | } | 638 | } |
642 | //奖励分正数、惩罚分负数,减去奖惩分数,得到原始分数 | 639 | //奖励分正数、惩罚分负数,减去奖惩分数,得到原始分数 |
643 | - BigDecimal originKpiScore = kpiPoolDetailVO.getOriginKpiScore().subtract(rewardScore).subtract(punishScore); | 640 | + BigDecimal originKpiScore = pool.getKpiScore().subtract(rewardScore).subtract(punishScore); |
641 | + if (BigDecimal.ZERO.compareTo(originKpiScore) > 0) { | ||
642 | + originKpiScore = BigDecimal.ZERO; | ||
643 | + } | ||
644 | kpiPoolDetailVO.setRewardScore(rewardScore); | 644 | kpiPoolDetailVO.setRewardScore(rewardScore); |
645 | kpiPoolDetailVO.setPunishScore(punishScore.abs()); | 645 | kpiPoolDetailVO.setPunishScore(punishScore.abs()); |
646 | kpiPoolDetailVO.setRealKpiScore(pool.getKpiScore()); | 646 | kpiPoolDetailVO.setRealKpiScore(pool.getKpiScore()); |
@@ -761,7 +761,7 @@ public class KpiPoolBizService { | @@ -761,7 +761,7 @@ public class KpiPoolBizService { | ||
761 | * @return | 761 | * @return |
762 | */ | 762 | */ |
763 | public void buildPoolData(KpiPool kpiPool, KpiPoolDetailVO kpiPoolDetailVo) { | 763 | public void buildPoolData(KpiPool kpiPool, KpiPoolDetailVO kpiPoolDetailVo) { |
764 | - KpiGroupUser kpiGroupUser = kpiGroupUserService.getMonthLastData(kpiPool.getKgc(), kpiPool.getUserId(), kpiPool.getMonthly()); | 764 | + KpiGroupUser kpiGroupUser = kpiGroupUserService.getMonthLastData(kpiPool.getKpiGroupId(), kpiPool.getUserId(), kpiPool.getMonthly()); |
765 | if (PublicUtil.isEmpty(kpiGroupUser)) { | 765 | if (PublicUtil.isEmpty(kpiGroupUser)) { |
766 | log.error("员工绩效池:{},不存在绩效组人员", JSON.toJSONString(kpiPool)); | 766 | log.error("员工绩效池:{},不存在绩效组人员", JSON.toJSONString(kpiPool)); |
767 | kpiPoolDetailVo.setEndTime(PublicUtil.getYesterdayOrEndOfMonthDay(kpiPool.getMonthly()).atTime(23, 59, 59)); | 767 | kpiPoolDetailVo.setEndTime(PublicUtil.getYesterdayOrEndOfMonthDay(kpiPool.getMonthly()).atTime(23, 59, 59)); |
@@ -774,7 +774,7 @@ public class KpiPoolBizService { | @@ -774,7 +774,7 @@ public class KpiPoolBizService { | ||
774 | kpiPoolDetailVo.setIgnoreCauseDesc(kpiGroupUser.getIgnoreCauseDesc()); | 774 | kpiPoolDetailVo.setIgnoreCauseDesc(kpiGroupUser.getIgnoreCauseDesc()); |
775 | } | 775 | } |
776 | kpiPoolDetailVo.setEndTime(kpiGroupUser.getDataDate().atTime(23, 59, 59)); | 776 | kpiPoolDetailVo.setEndTime(kpiGroupUser.getDataDate().atTime(23, 59, 59)); |
777 | - KpiGroupUser firstKpiGroupUser = kpiGroupUserService.getMonthFirstData(kpiPool.getKgc(), kpiPool.getUserId(), kpiPool.getMonthly()); | 777 | + KpiGroupUser firstKpiGroupUser = kpiGroupUserService.getMonthFirstData(kpiPool.getKpiGroupId(), kpiPool.getUserId(), kpiPool.getMonthly()); |
778 | kpiPoolDetailVo.setStartTime(firstKpiGroupUser.getDataDate().atTime(00, 00, 00)); | 778 | kpiPoolDetailVo.setStartTime(firstKpiGroupUser.getDataDate().atTime(00, 00, 00)); |
779 | } | 779 | } |
780 | 780 | ||
@@ -899,34 +899,21 @@ public class KpiPoolBizService { | @@ -899,34 +899,21 @@ public class KpiPoolBizService { | ||
899 | * @param localDate | 899 | * @param localDate |
900 | */ | 900 | */ |
901 | public void cacheCalculableKpiGroupRank(LocalDate localDate) { | 901 | public void cacheCalculableKpiGroupRank(LocalDate localDate) { |
902 | - List<KpiGroup> kpiGroups = kpiGroupService.queryKgiGroupsByDay(localDate); | ||
903 | - if (CollectionUtils.isEmpty(kpiGroups)) { | ||
904 | - log.info("没有需要计算排名的绩效组,日期:{}", localDate); | ||
905 | - return; | ||
906 | - } | ||
907 | - Set<Long> calculateSeparatelyIds = kpiGroups.stream().map(KpiGroup::getId).collect(Collectors.toSet()); | ||
908 | - Map<String, Long> kgcIdMap = kpiGroups.stream().collect(Collectors.toMap(KpiGroup::getKgc, KpiGroup::getId, (v1, v2) -> v1)); | ||
909 | List<String> rankBOS = new ArrayList<>(); | 902 | List<String> rankBOS = new ArrayList<>(); |
910 | - List<KpiGroupRank> kpiGroupRanks = kpiGroupRankService.list(Wrappers.<KpiGroupRank>lambdaQuery().eq(KpiGroupRank::getYn, Boolean.TRUE)); | 903 | + List<KpiGroupRank> kpiGroupRanks = kpiGroupRankService.list(Wrappers.<KpiGroupRank>lambdaQuery() |
904 | + .eq(KpiGroupRank::getStatus, SettingStatusEnum.EFFECTIVE) | ||
905 | + .eq(KpiGroupRank::getYn, Boolean.TRUE) | ||
906 | + ); | ||
911 | for (KpiGroupRank kpiGroupRank : kpiGroupRanks) { | 907 | for (KpiGroupRank kpiGroupRank : kpiGroupRanks) { |
912 | - Set<Long> kpiGroupIds = new HashSet<>(); | ||
913 | - for (String kgc : kpiGroupRank.getKgcs()) { | ||
914 | - Long kpiGroupId = kgcIdMap.getOrDefault(kgc, 0L); | ||
915 | - if (kpiGroupId > 0) { | ||
916 | - kpiGroupIds.add(kpiGroupId); | ||
917 | - calculateSeparatelyIds.remove(kpiGroupId); | ||
918 | - } | ||
919 | - } | ||
920 | - //@todo 缓存绩效排名组 | ||
921 | - if (PublicUtil.isNotEmpty(kpiGroupIds)) { | ||
922 | - rankBOS.add(JSONObject.toJSONString(cacheCalculableKpiGroupRank(kpiGroupRank, kpiGroupIds, localDate))); | 908 | + if (PublicUtil.isNotEmpty(kpiGroupRank.getKpiGroupIds())) { |
909 | + rankBOS.add(JSONObject.toJSONString(cacheCalculableKpiGroupRank(kpiGroupRank, | ||
910 | + new HashSet<>(kpiGroupRank.getKpiGroupIds()), localDate))); | ||
923 | } | 911 | } |
924 | } | 912 | } |
925 | - kpiGroups.stream().filter(kpiGroup -> calculateSeparatelyIds.contains(kpiGroup.getId())).forEach(kpiGroup -> { | ||
926 | - rankBOS.add(JSONObject.toJSONString(cacheCalculableKpiGroupRank(kpiGroup, localDate))); | ||
927 | - }); | ||
928 | - ListOperations<String, String> listOps = stringRedisTemplate.opsForList(); | ||
929 | - listOps.rightPushAll(getCalcuStarKey(), rankBOS); | 913 | + if (PublicUtil.isNotEmpty(rankBOS)) { |
914 | + ListOperations<String, String> listOps = stringRedisTemplate.opsForList(); | ||
915 | + listOps.rightPushAll(getCalcuStarKey(), rankBOS); | ||
916 | + } | ||
930 | } | 917 | } |
931 | 918 | ||
932 | /** | 919 | /** |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/kpi/KpiPoolCommonService.java
@@ -116,7 +116,7 @@ public class KpiPoolCommonService { | @@ -116,7 +116,7 @@ public class KpiPoolCommonService { | ||
116 | */ | 116 | */ |
117 | public KpiPool inspectionPool(KpiGroupUser user) { | 117 | public KpiPool inspectionPool(KpiGroupUser user) { |
118 | KpiPool kpiPool = kpiPoolService.getOne(Wrappers.<KpiPool>lambdaQuery() | 118 | KpiPool kpiPool = kpiPoolService.getOne(Wrappers.<KpiPool>lambdaQuery() |
119 | - .eq(KpiPool::getKgc, user.getKgc()) | 119 | + .eq(KpiPool::getKpiGroupId, user.getKpiGroupId()) |
120 | .eq(KpiPool::getUserId, user.getUserId()) | 120 | .eq(KpiPool::getUserId, user.getUserId()) |
121 | .eq(KpiPool::getMonthly, YearMonth.from(user.getDataDate())) | 121 | .eq(KpiPool::getMonthly, YearMonth.from(user.getDataDate())) |
122 | .eq(KpiPool::getYn, Boolean.TRUE) | 122 | .eq(KpiPool::getYn, Boolean.TRUE) |
fw-morax-service/src/main/java/cn/fw/morax/service/biz/salary/SalaryReportService.java
@@ -2,6 +2,7 @@ package cn.fw.morax.service.biz.salary; | @@ -2,6 +2,7 @@ package cn.fw.morax.service.biz.salary; | ||
2 | 2 | ||
3 | import cn.fw.common.exception.BusinessException; | 3 | import cn.fw.common.exception.BusinessException; |
4 | import cn.fw.ehr.sdk.api.enums.StaffShopTypeEnum; | 4 | import cn.fw.ehr.sdk.api.enums.StaffShopTypeEnum; |
5 | +import cn.fw.morax.common.constant.Constant; | ||
5 | import cn.fw.morax.common.utils.DateUtil; | 6 | import cn.fw.morax.common.utils.DateUtil; |
6 | import cn.fw.morax.common.utils.PublicUtil; | 7 | import cn.fw.morax.common.utils.PublicUtil; |
7 | import cn.fw.morax.domain.db.PayrollRecord; | 8 | import cn.fw.morax.domain.db.PayrollRecord; |
@@ -37,7 +38,6 @@ import org.springframework.util.CollectionUtils; | @@ -37,7 +38,6 @@ import org.springframework.util.CollectionUtils; | ||
37 | 38 | ||
38 | import java.text.SimpleDateFormat; | 39 | import java.text.SimpleDateFormat; |
39 | import java.time.LocalDate; | 40 | import java.time.LocalDate; |
40 | -import java.time.LocalDateTime; | ||
41 | import java.time.YearMonth; | 41 | import java.time.YearMonth; |
42 | import java.time.temporal.TemporalAdjusters; | 42 | import java.time.temporal.TemporalAdjusters; |
43 | import java.util.*; | 43 | import java.util.*; |
@@ -272,11 +272,15 @@ public class SalaryReportService { | @@ -272,11 +272,15 @@ public class SalaryReportService { | ||
272 | if (! ExtraSalaryTypeEnum.SUBSIDY.equals(extraDTO.getSalaryType())) { | 272 | if (! ExtraSalaryTypeEnum.SUBSIDY.equals(extraDTO.getSalaryType())) { |
273 | return; | 273 | return; |
274 | } | 274 | } |
275 | + LocalDate dataDate = DateUtil.date2LocalDate(extraDTO.getDataDate()); | ||
275 | LocalDate firstDay = DateUtil.date2LocalDate(extraDTO.getDataDate()).with(TemporalAdjusters.firstDayOfMonth()); | 276 | LocalDate firstDay = DateUtil.date2LocalDate(extraDTO.getDataDate()).with(TemporalAdjusters.firstDayOfMonth()); |
277 | + //如果是第一天 清除结束日期也是第一天, 否则是前一天 | ||
278 | + LocalDate cleanEndDay = (firstDay.compareTo(dataDate) == 0) ? firstDay : dataDate.minusDays(1); | ||
276 | salaryExtraProjectService.remove(Wrappers.<SalaryExtraProject>lambdaQuery() | 279 | salaryExtraProjectService.remove(Wrappers.<SalaryExtraProject>lambdaQuery() |
277 | .eq(SalaryExtraProject::getUserId, extraDTO.getUserId()) | 280 | .eq(SalaryExtraProject::getUserId, extraDTO.getUserId()) |
278 | .eq(SalaryExtraProject::getSalaryType, ExtraSalaryTypeEnum.SUBSIDY) | 281 | .eq(SalaryExtraProject::getSalaryType, ExtraSalaryTypeEnum.SUBSIDY) |
279 | .ge(SalaryExtraProject::getDataDate, firstDay) | 282 | .ge(SalaryExtraProject::getDataDate, firstDay) |
283 | + .le(SalaryExtraProject::getDataDate, cleanEndDay) | ||
280 | ); | 284 | ); |
281 | } | 285 | } |
282 | 286 | ||
@@ -351,6 +355,12 @@ public class SalaryReportService { | @@ -351,6 +355,12 @@ public class SalaryReportService { | ||
351 | if (PublicUtil.isNotEmpty(dto.getTypeId())) { | 355 | if (PublicUtil.isNotEmpty(dto.getTypeId())) { |
352 | dto.setTypeId(dto.getTypeId()); | 356 | dto.setTypeId(dto.getTypeId()); |
353 | } | 357 | } |
358 | + if (PublicUtil.isEmpty(dto.getDataId())) { | ||
359 | + salaryExtraProject.setDataId(""); | ||
360 | + } | ||
361 | + if (PublicUtil.isEmpty(dto.getDataName())) { | ||
362 | + salaryExtraProject.setDataName(""); | ||
363 | + } | ||
354 | if (PublicUtil.isNotEmpty(dto.getTypeName())) { | 364 | if (PublicUtil.isNotEmpty(dto.getTypeName())) { |
355 | dto.setTypeName(dto.getTypeName()); | 365 | dto.setTypeName(dto.getTypeName()); |
356 | } | 366 | } |
fw-morax-service/src/main/java/cn/fw/morax/service/data/kpi/KpiGroupUserService.java
@@ -11,18 +11,16 @@ public interface KpiGroupUserService extends IService<KpiGroupUser> { | @@ -11,18 +11,16 @@ public interface KpiGroupUserService extends IService<KpiGroupUser> { | ||
11 | /** | 11 | /** |
12 | * 获取某月最近的绩效组人员数据 | 12 | * 获取某月最近的绩效组人员数据 |
13 | * | 13 | * |
14 | - * @param kgc | ||
15 | * @param yearMonth | 14 | * @param yearMonth |
16 | * @return | 15 | * @return |
17 | */ | 16 | */ |
18 | - KpiGroupUser getMonthLastData(String kgc, Long userId, YearMonth yearMonth); | 17 | + KpiGroupUser getMonthLastData(Long kpiGroupId, Long userId, YearMonth yearMonth); |
19 | 18 | ||
20 | /** | 19 | /** |
21 | * 获取某月第一天的绩效组人员数据 | 20 | * 获取某月第一天的绩效组人员数据 |
22 | * | 21 | * |
23 | - * @param kgc | ||
24 | * @param yearMonth | 22 | * @param yearMonth |
25 | * @return | 23 | * @return |
26 | */ | 24 | */ |
27 | - KpiGroupUser getMonthFirstData(String kgc, Long userId, YearMonth yearMonth); | 25 | + KpiGroupUser getMonthFirstData(Long kpiGroupId, Long userId, YearMonth yearMonth); |
28 | } | 26 | } |
fw-morax-service/src/main/java/cn/fw/morax/service/data/kpi/impl/KpiGroupUserServiceImpl.java
@@ -16,11 +16,11 @@ import java.time.YearMonth; | @@ -16,11 +16,11 @@ import java.time.YearMonth; | ||
16 | public class KpiGroupUserServiceImpl extends ServiceImpl<KpiGroupUserDao, KpiGroupUser> implements KpiGroupUserService { | 16 | public class KpiGroupUserServiceImpl extends ServiceImpl<KpiGroupUserDao, KpiGroupUser> implements KpiGroupUserService { |
17 | 17 | ||
18 | @Override | 18 | @Override |
19 | - public KpiGroupUser getMonthLastData(String kgc, Long userId, YearMonth yearMonth) { | ||
20 | - return this.baseMapper.getMonthLastData(kgc, userId, yearMonth); | 19 | + public KpiGroupUser getMonthLastData(Long kpiGroupId, Long userId, YearMonth yearMonth) { |
20 | + return this.baseMapper.getMonthLastData(kpiGroupId, userId, yearMonth); | ||
21 | } | 21 | } |
22 | @Override | 22 | @Override |
23 | - public KpiGroupUser getMonthFirstData(String kgc, Long userId, YearMonth yearMonth) { | ||
24 | - return this.baseMapper.getMonthFirstData(kgc, userId, yearMonth); | 23 | + public KpiGroupUser getMonthFirstData(Long kpiGroupId, Long userId, YearMonth yearMonth) { |
24 | + return this.baseMapper.getMonthFirstData(kpiGroupId, userId, yearMonth); | ||
25 | } | 25 | } |
26 | } | 26 | } |