| | |
| | | List resultList = query.getResultList(); |
| | | Map<String, Integer> reMap = new HashMap<String, Integer>(); |
| | | int realAttendanceCount = getRealAttendanceCount(); |
| | | if (resultList.size() > 3) { |
| | | for (int i = 0; i < 3; i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | reMap.put(obj[0].toString(), Integer.parseInt(obj[1].toString())); |
| | | realAttendanceCount = realAttendanceCount - Integer.parseInt(obj[1].toString()); |
| | | } |
| | | reMap.put("其他", realAttendanceCount); |
| | | } else { |
| | | // if (resultList.size() > 3) { |
| | | // for (int i = 0; i < 3; i++) { |
| | | // Object[] obj = (Object[]) resultList.get(i); |
| | | // reMap.put(obj[0].toString(), Integer.parseInt(obj[1].toString())); |
| | | // realAttendanceCount = realAttendanceCount - Integer.parseInt(obj[1].toString()); |
| | | // } |
| | | // reMap.put("其他", realAttendanceCount); |
| | | // } else { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | reMap.put(obj[0].toString(), Integer.parseInt(obj[1].toString())); |
| | | } |
| | | } |
| | | // } |
| | | return reMap; |
| | | } |
| | | |
| | |
| | | rMap.add(obj[0].toString()); |
| | | reMap.add(Integer.parseInt(obj[1].toString())); |
| | | } |
| | | List<Integer> raMap = new ArrayList<Integer>(); |
| | | for (int i = resultList.size()-1; i >= 0; i--) { |
| | | raMap.add(reMap.get(i)); |
| | | } |
| | | List<Object> zong = new ArrayList<Object>(); |
| | | zong.add(rMap); |
| | | zong.add(reMap); |
| | | return zong; |
| | | } |
| | | |
| | | public List<Integer> getgongzhongnum(){ |
| | | public List<Object> getgongzhongnum(){ |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT bumen,num FROM tb_gongzhong"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<String> gongzhongk = new ArrayList<String>(); |
| | | List<Integer> gongzhong = new ArrayList<Integer>(); |
| | | for (int i = resultList.size()-1; i >= 0; i--) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | gongzhongk.add(obj[0].toString()); |
| | | gongzhong.add(Integer.parseInt(obj[1].toString())); |
| | | } |
| | | System.out.print(gongzhong); |
| | | return gongzhong; |
| | | List<Object> zong = new ArrayList<Object>(); |
| | | zong.add(gongzhongk); |
| | | zong.add(gongzhong); |
| | | return zong; |
| | | } |
| | | |
| | | public List<Integer> getgaojingnum(){ |