修正案件统计值#573
parent
73fc33f5b9
commit
23f4636aee
|
|
@ -218,36 +218,46 @@ public class SzCaseController extends AbstractCommonFileController{
|
|||
public R<List<SzCaseStatisticsVo>> statisticsNum(@Schema(name = "年份") @PathVariable("year") Integer year) {
|
||||
LambdaQueryChainWrapper<SzCase> query = service.lambdaQuery();
|
||||
|
||||
query.ge(SzCase::getCreateTime, DateUtil.beginOfYearToDate(year));
|
||||
query.ge(SzCase::getCaseDate, DateUtil.beginOfYearToDate(year));
|
||||
|
||||
query.le(SzCase::getCreateTime, DateUtil.endOfYearToDate(year));
|
||||
query.le(SzCase::getCaseDate, DateUtil.endOfYearToDate(year));
|
||||
|
||||
List<SzCaseStatisticsVo> vos = Lists.newArrayList();
|
||||
|
||||
List<SzCase> list = query.list();
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int currYear = calendar.get(Calendar.YEAR);
|
||||
int month = calendar.get(Calendar.MONTH) + 1;
|
||||
if(year.intValue() != currYear){
|
||||
calendar.set(Calendar.YEAR,year);
|
||||
month = 12;
|
||||
}
|
||||
final int finalMonth = month;
|
||||
for (int i = 1; i <= finalMonth; i++) {
|
||||
int finalI = i;
|
||||
long count = 0;
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
count = list.stream()
|
||||
.filter(item ->
|
||||
{
|
||||
for (int i = 0; i < 12; i++) {
|
||||
int month = i;
|
||||
long cnt = list.stream().filter(item -> {
|
||||
calendar.setTime(item.getCaseDate());
|
||||
return finalMonth == finalI;
|
||||
})
|
||||
.count();
|
||||
}
|
||||
vos.add(new SzCaseStatisticsVo(i,null,Integer.valueOf(String.valueOf(count))));
|
||||
return month == calendar.get(Calendar.MONTH);
|
||||
}).count();
|
||||
vos.add(new SzCaseStatisticsVo(month + 1,null,Integer.valueOf(String.valueOf(cnt))));
|
||||
}
|
||||
//
|
||||
// Calendar calendar = Calendar.getInstance();
|
||||
// int currYear = calendar.get(Calendar.YEAR);
|
||||
// int month = calendar.get(Calendar.MONTH) + 1;
|
||||
// if(year.intValue() != currYear){
|
||||
// calendar.set(Calendar.YEAR,year);
|
||||
// month = 12;
|
||||
// }
|
||||
// final int finalMonth = month;
|
||||
// for (int i = 1; i <= finalMonth; i++) {
|
||||
// int finalI = i;
|
||||
// long count = 0;
|
||||
// if(CollectionUtils.isNotEmpty(list)){
|
||||
// count = list.stream()
|
||||
// .filter(item ->
|
||||
// {
|
||||
// calendar.setTime(item.getCaseDate());
|
||||
// return finalMonth == finalI;
|
||||
// })
|
||||
// .count();
|
||||
// }
|
||||
// vos.add(new SzCaseStatisticsVo(i,null,Integer.valueOf(String.valueOf(count))));
|
||||
// }
|
||||
|
||||
return R.ok(vos);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue