| | |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | Map<String,Integer> map = new HashMap<>(); |
| | | int year = Calendar.getInstance().get(Calendar.YEAR); |
| | | List<BattdischargePlan> planList = mapper.getPlanCount(userId,year); |
| | | List<BattdischargePlan> planList = mapper.getPlanCount(userId, year); |
| | | //总数,已完成数量 |
| | | int total = planList.size(); |
| | | int finishNum = planList.stream().filter(plan -> plan.getDischargeState() == 2).collect(Collectors.toList()).size(); |
| | | map.put("total",total); |
| | | map.put("finishNum",finishNum); |
| | | return new Response().set(1,map); |
| | | map.put("total", total); |
| | | map.put("finishNum", finishNum); |
| | | return new Response().set(1, map); |
| | | } |
| | | |
| | | public Map<String,Map<String,Integer>> getPlanCount() { |
| | | int userId = ActionUtil.getUser().getUId().intValue(); |
| | | Map<String,Map<String,Integer>> resMap = new HashMap<>(); |
| | | Map<String,Integer> map = new HashMap<>(); |
| | | public Map<String, Map<String, Integer>> getPlanCount(int userId) { |
| | | //int userId = ActionUtil.getUser().getUId().intValue(); |
| | | Map<String, Map<String, Integer>> resMap = new HashMap<>(); |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | int year = Calendar.getInstance().get(Calendar.YEAR); |
| | | List<BattdischargePlan> planList = mapper.getPlanCount(userId,year); |
| | | List<BattdischargePlan> planList = mapper.getPlanCount(userId, year); |
| | | //班组,总数,已完成数量 |
| | | Map<String, List<BattdischargePlan>> groupNameListMap = planList.stream().collect(Collectors.groupingBy(BattdischargePlan::getBaojiGroupName)); |
| | | Set<String> groupNameSet = groupNameListMap.keySet(); |
| | |
| | | List<BattdischargePlan> plans = groupNameListMap.get(groupName); |
| | | int total = plans.size(); |
| | | int finishNum = plans.stream().filter(plan -> plan.getDischargeState() == 2).collect(Collectors.toList()).size(); |
| | | map.put("total",total); |
| | | map.put("finishNum",finishNum); |
| | | map.put("total", total); |
| | | map.put("finishNum", finishNum); |
| | | |
| | | resMap.put(groupName,map); |
| | | resMap.put(groupName, map); |
| | | } |
| | | return resMap; |
| | | |
| | | } |
| | | |
| | | public Response getPlanCountWithTotal() { |
| | | Map<String,Integer> resMap = new HashMap<>(); |
| | | resMap.put("放电任务总数",0); |
| | | public Response getPlanCountWithTotal(int userId) { |
| | | Map<String, Integer> resMap = new HashMap<>(); |
| | | resMap.put("放电任务总数", 0); |
| | | int total = 0; |
| | | Map<String, Map<String, Integer>> planCount = getPlanCount(); |
| | | Map<String, Map<String, Integer>> planCount = getPlanCount(userId); |
| | | Set<String> groupNameSet = planCount.keySet(); |
| | | for (String groupName : groupNameSet) { |
| | | //resMap.put(groupName,planCount.get(groupName).get("finishNum")); |
| | | total = total + planCount.get(groupName).get("total"); |
| | | } |
| | | resMap.put("放电任务总数",total); |
| | | return new Response().setII(1,resMap,planCount,null); |
| | | resMap.put("放电任务总数", total); |
| | | return new Response().setII(1, resMap, planCount, null); |
| | | |
| | | } |
| | | } |