修正案件统计值#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) {
|
public R<List<SzCaseStatisticsVo>> statisticsNum(@Schema(name = "年份") @PathVariable("year") Integer year) {
|
||||||
LambdaQueryChainWrapper<SzCase> query = service.lambdaQuery();
|
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<SzCaseStatisticsVo> vos = Lists.newArrayList();
|
||||||
|
|
||||||
List<SzCase> list = query.list();
|
List<SzCase> list = query.list();
|
||||||
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
int currYear = calendar.get(Calendar.YEAR);
|
for (int i = 0; i < 12; i++) {
|
||||||
int month = calendar.get(Calendar.MONTH) + 1;
|
int month = i;
|
||||||
if(year.intValue() != currYear){
|
long cnt = list.stream().filter(item -> {
|
||||||
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());
|
calendar.setTime(item.getCaseDate());
|
||||||
return finalMonth == finalI;
|
return month == calendar.get(Calendar.MONTH);
|
||||||
})
|
}).count();
|
||||||
.count();
|
vos.add(new SzCaseStatisticsVo(month + 1,null,Integer.valueOf(String.valueOf(cnt))));
|
||||||
}
|
|
||||||
vos.add(new SzCaseStatisticsVo(i,null,Integer.valueOf(String.valueOf(count))));
|
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// 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);
|
return R.ok(vos);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue