| | |
| | | package com.whyc.service; |
| | | |
| | | import com.whyc.constant.Com; |
| | | import com.whyc.dto.KPIDetail; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.BaoJiGroup; |
| | | import com.whyc.pojo.BaoJiGroupUser; |
| | | import com.whyc.pojo.FaultUpload; |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.util.MathUtil; |
| | |
| | | private BaoJiGroupUserService baoJiGroupUserService; |
| | | |
| | | |
| | | public List<KPIDetail> getAnnualPersonalDetail() { |
| | | public List<KPIDetail> getAnnualPersonalDetail(int userId) { |
| | | //放电任务,班组 |
| | | Map<String, Map<String, Integer>> planCount = planService.getPlanCount(); |
| | | Map<String, Map<String, Integer>> planCount = planService.getPlanCount(userId); |
| | | |
| | | //隐患故障上报,个人 |
| | | Map<String, FaultUpload> uploadWithGroupName = uploadService.getUploadWithGroupName(); |
| | | Map<String, FaultUpload> uploadWithGroupName = uploadService.getUploadWithGroupName(userId); |
| | | |
| | | //整理最终需要统计的所有用户及所属的包机组 |
| | | List<BaoJiGroup> baoJiGroupUserList = baoJiGroupUserService.getGroupAndUserListWithDischargeFlag(); |
| | |
| | | return kpiDetails; |
| | | } |
| | | |
| | | public Response getAnnualDetail(Integer limitN) { |
| | | List<KPIDetail> details = getAnnualPersonalDetail(); |
| | | public Response getAnnualDetail(Integer limitN, int userId) { |
| | | List<KPIDetail> details = getAnnualPersonalDetail(userId); |
| | | if(limitN !=null){ |
| | | details = details.stream().sorted((a,b)->b.getPersonalScore().compareTo(a.getPersonalScore())).limit(limitN).collect(Collectors.toList()); |
| | | } |
| | | return new Response().set(1,details); |
| | | } |
| | | |
| | | public Response getAnnualStatisticByGroupName(Integer limitN) { |
| | | public Response getAnnualStatisticByGroupName(Integer limitN, int userId) { |
| | | List<KPIDetail> groupDetails = new LinkedList<>(); |
| | | List<KPIDetail> details = getAnnualPersonalDetail(); |
| | | List<KPIDetail> details = getAnnualPersonalDetail(userId); |
| | | //班组得分 |
| | | Map<String, List<KPIDetail>> groupNameListMap = details.stream().collect(Collectors.groupingBy(KPIDetail::getGroupName)); |
| | | Set<String> groupNameSet = groupNameListMap.keySet(); |
| | |
| | | return new Response().set(1,groupDetails); |
| | | } |
| | | |
| | | public Response getAnnualStatisticByGroupNameAndUser() { |
| | | public Response getAnnualStatisticByGroupNameAndUser(int userId) { |
| | | List<KPIDetail> groupDetails = new LinkedList<>(); |
| | | List<KPIDetail> details = getAnnualPersonalDetail(); |
| | | List<KPIDetail> details = getAnnualPersonalDetail(userId); |
| | | //班组得分 |
| | | Map<String, List<KPIDetail>> groupNameListMap = details.stream().collect(Collectors.groupingBy(KPIDetail::getGroupName)); |
| | | Set<String> groupNameSet = groupNameListMap.keySet(); |