Commit 4a0ac03ee34ca3eb4370fabb5eae006789f219dd

Authored by litao@lymsh.com
1 parent 11ebc6bebd

bbbbbb

Showing 1 changed file with 7 additions and 9 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java View file @ 4a0ac03
... ... @@ -251,8 +251,15 @@
251 251 List<BloodSugar> bloodSugars = mongoTemplate.find(Query.query(Criteria.where("pid").is(parentId)).with(new Sort(Sort.Direction.DESC, "created")), BloodSugar.class);
252 252 Set<String> dayCountSet = new HashSet<>();
253 253 Set<String> monthCountSet = new HashSet<>();
  254 + Set<String> monthCountSet2 = new TreeSet<>(new Comparator<String>() {
  255 + @Override
  256 + public int compare(String o1, String o2) {
  257 + return o1.compareTo(o2);
  258 + }
  259 + });
254 260 for (BloodSugar bloodSugar : bloodSugars) {
255 261 monthCountSet.add(DateUtil.getMonth(bloodSugar.getCreated())+"");
  262 + monthCountSet2.add(DateUtil.getyyyy_mm(bloodSugar.getCreated()));
256 263 dayCountSet.add(DateUtil.getyyyy_MM_dd(bloodSugar.getCreated()));
257 264  
258 265 if(bloodSugar.getBloodSugarType() == type) {
... ... @@ -343,15 +350,6 @@
343 350 }
344 351  
345 352 CollectionUtils.sortListByMapKeyWithDate(restList, "craeted");
346   -
347   - Set<String> monthCountSet2 = new HashSet<>();
348   - for (String s : monthCountSet) {
349   - if(s.length() == 1) {
350   - monthCountSet2.add("0" + s);
351   - } else {
352   - monthCountSet2.add(s);
353   - }
354   - }
355 353  
356 354 return RespBuilder.buildSuccess("restList", restList, "count", bloodSugars.size(), "dayCount", dayCountSet.size(), "month", monthCountSet2, "monthAvgMap", monthAvgMap, "weekAvgMap", weekAvgMap);
357 355 }