| | |
| | | Map<String,Long> map = new HashMap<>(); |
| | | if (analysisType == 1) { |
| | | // 年份 |
| | | int year = LocalDateTime.now().getYear(); |
| | | String year = LocalDateTime.now().getYear()+"年"; |
| | | long count = this.count(Wrappers.lambdaQuery(AnalysisRecycleData.class).eq(AnalysisRecycleData::getAnalysisValue, year)); |
| | | map.put(String.valueOf(year),count); |
| | | year = LocalDateTime.now().minusYears(1).getYear(); |
| | | map.put(year,count); |
| | | year = LocalDateTime.now().minusYears(1).getYear()+"年"; |
| | | count = this.count(Wrappers.lambdaQuery(AnalysisRecycleData.class).eq(AnalysisRecycleData::getAnalysisValue, year)); |
| | | map.put(String.valueOf(year),count); |
| | | year = LocalDateTime.now().minusYears(2).getYear(); |
| | | map.put(year,count); |
| | | year = LocalDateTime.now().minusYears(2).getYear()+"年"; |
| | | count = this.count(Wrappers.lambdaQuery(AnalysisRecycleData.class).eq(AnalysisRecycleData::getAnalysisValue, year)); |
| | | map.put(String.valueOf(year),count); |
| | | year = LocalDateTime.now().minusYears(3).getYear(); |
| | | map.put(year,count); |
| | | year = LocalDateTime.now().minusYears(3).getYear()+"年"; |
| | | count = this.count(Wrappers.lambdaQuery(AnalysisRecycleData.class).eq(AnalysisRecycleData::getAnalysisValue, year)); |
| | | map.put(String.valueOf(year),count); |
| | | year = LocalDateTime.now().minusYears(4).getYear(); |
| | | map.put(year,count); |
| | | year = LocalDateTime.now().minusYears(4).getYear()+"年"; |
| | | count = this.count(Wrappers.lambdaQuery(AnalysisRecycleData.class).eq(AnalysisRecycleData::getAnalysisValue, year)); |
| | | map.put(String.valueOf(year),count); |
| | | year = LocalDateTime.now().minusYears(5).getYear(); |
| | | map.put(year,count); |
| | | year = LocalDateTime.now().minusYears(5).getYear()+"年"; |
| | | count = this.count(Wrappers.lambdaQuery(AnalysisRecycleData.class).eq(AnalysisRecycleData::getAnalysisValue, year)); |
| | | map.put(String.valueOf(year),count); |
| | | map.put(year,count); |
| | | return map; |
| | | } else{ |
| | | // 月份 |
| | | String month = new SimpleDateFormat("yyyy-MM").format(new Date()); |
| | | String month = new SimpleDateFormat("yyyy年MM月").format(new Date()); |
| | | long count = this.count(Wrappers.lambdaQuery(AnalysisRecycleData.class).eq(AnalysisRecycleData::getAnalysisValue, month)); |
| | | map.put(month,count); |
| | | month = new SimpleDateFormat("yyyy-MM").format(DateUtils.localDateTimeToDate(LocalDateTime.now().minusMonths(1))); |
| | | month = new SimpleDateFormat("yyyy年MM月").format(DateUtils.localDateTimeToDate(LocalDateTime.now().minusMonths(1))); |
| | | count = this.count(Wrappers.lambdaQuery(AnalysisRecycleData.class).eq(AnalysisRecycleData::getAnalysisValue, month)); |
| | | map.put(month,count); |
| | | month = new SimpleDateFormat("yyyy-MM").format(DateUtils.localDateTimeToDate(LocalDateTime.now().minusMonths(2))); |
| | | month = new SimpleDateFormat("yyyy年MM月").format(DateUtils.localDateTimeToDate(LocalDateTime.now().minusMonths(2))); |
| | | count = this.count(Wrappers.lambdaQuery(AnalysisRecycleData.class).eq(AnalysisRecycleData::getAnalysisValue, month)); |
| | | map.put(month,count); |
| | | month = new SimpleDateFormat("yyyy-MM").format(DateUtils.localDateTimeToDate(LocalDateTime.now().minusMonths(3))); |
| | | month = new SimpleDateFormat("yyyy年MM月").format(DateUtils.localDateTimeToDate(LocalDateTime.now().minusMonths(3))); |
| | | count = this.count(Wrappers.lambdaQuery(AnalysisRecycleData.class).eq(AnalysisRecycleData::getAnalysisValue, month)); |
| | | map.put(month,count); |
| | | month = new SimpleDateFormat("yyyy-MM").format(DateUtils.localDateTimeToDate(LocalDateTime.now().minusMonths(4))); |
| | | month = new SimpleDateFormat("yyyy年MM月").format(DateUtils.localDateTimeToDate(LocalDateTime.now().minusMonths(4))); |
| | | count = this.count(Wrappers.lambdaQuery(AnalysisRecycleData.class).eq(AnalysisRecycleData::getAnalysisValue, month)); |
| | | map.put(month,count); |
| | | month = new SimpleDateFormat("yyyy-MM").format(DateUtils.localDateTimeToDate(LocalDateTime.now().minusMonths(5))); |
| | | month = new SimpleDateFormat("yyyy年MM月").format(DateUtils.localDateTimeToDate(LocalDateTime.now().minusMonths(5))); |
| | | count = this.count(Wrappers.lambdaQuery(AnalysisRecycleData.class).eq(AnalysisRecycleData::getAnalysisValue, month)); |
| | | map.put(month,count); |
| | | return map; |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.err.println(LocalDateTime.now().getYear()+"年"); |
| | | } |
| | | |
| | | } |