Jelajahi Sumber

月度工分汇总-样式优化

wanglt 3 bulan lalu
induk
melakukan
0a8c73e220

+ 13 - 15
ygtx-gxt/src/main/java/com/ygtx/gxt/controller/GxtUserScoreController.java

@@ -235,23 +235,21 @@ public class GxtUserScoreController extends BaseController
         monthScore.setDeptId(deptId);
         List<GxtMonthScore> monthScoreList = gxtMonthScoreService.selectGxtMonthScoreList(monthScore);
         if (!monthScoreList.isEmpty()) {
+            Collections.sort(monthScoreList, new Comparator<GxtMonthScore>() {
+                @Override
+                public int compare(GxtMonthScore o1, GxtMonthScore o2) {
+                    return o2.getMonthPeriod().compareTo(o1.getMonthPeriod());
+                }
+            });
+            dictList.clear();
             for (GxtMonthScore monthScore1:monthScoreList) {
                 String monthValue = monthScore1.getMonthPeriod();
-                boolean isOld = false;
-                for (Map<String, String> dict:dictList) {
-                    if (dict.get("value").equals(monthValue)) {
-                        isOld = true;
-                        break;
-                    }
-                }
-                if (!isOld) {
-                    String[] months = monthValue.split("-");
-                    String monthLabel = months[0] + "年" + months[1] + "月";
-                    dictList.add(new HashMap<String, String>() {{
-                        put("value", monthValue);
-                        put("label", monthLabel);
-                    }});
-                }
+                String[] months = monthValue.split("-");
+                String monthLabel = months[0] + "年" + months[1] + "月";
+                dictList.add(new HashMap<String, String>() {{
+                    put("value", monthValue);
+                    put("label", monthLabel);
+                }});
             }
         }
         AjaxResult ajax = AjaxResult.success();