add 首页 三年内应收
This commit is contained in:
@@ -90,4 +90,12 @@ public class IndexController {
|
|||||||
List<HistogramVO> histogramVOS = indexService.top10Statistics();
|
List<HistogramVO> histogramVOS = indexService.top10Statistics();
|
||||||
return Result.OK(histogramVOS);
|
return Result.OK(histogramVOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "三年内应收")
|
||||||
|
@GetMapping(value = "/threeYear")
|
||||||
|
public Result<?> withinThreeYears() {
|
||||||
|
List<HistogramVO> histogramVOS = indexService.withinThreeYears();
|
||||||
|
return Result.OK(histogramVOS);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.jero.index.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author liJiaRao
|
||||||
|
* @date 2022-09-15 15:47
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class YearMoneyDTO {
|
||||||
|
private String year;
|
||||||
|
private String allMoney;
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import com.google.common.collect.Lists;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.jero.index.dto.YearMoneyDTO;
|
||||||
import com.jero.index.vo.*;
|
import com.jero.index.vo.*;
|
||||||
import com.jero.project.mapper.PayWorkingGroupMapper;
|
import com.jero.project.mapper.PayWorkingGroupMapper;
|
||||||
import com.jero.project.service.IPayWorkingGroupService;
|
import com.jero.project.service.IPayWorkingGroupService;
|
||||||
@@ -16,6 +17,7 @@ import java.math.BigDecimal;
|
|||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -233,4 +235,20 @@ public class IndexService {
|
|||||||
}
|
}
|
||||||
return pieChartVOS;
|
return pieChartVOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<HistogramVO> withinThreeYears() {
|
||||||
|
int yearInt = DateUtil.year(new DateTime());
|
||||||
|
List<YearMoneyDTO> yearMoneyDTOList = payWorkingGroupMapper.getYearMoneyDTO();
|
||||||
|
Map<String, String> map = yearMoneyDTOList.stream()
|
||||||
|
.collect(Collectors.toMap(YearMoneyDTO::getYear, YearMoneyDTO::getAllMoney, (key1, key2) -> key2));
|
||||||
|
List<HistogramVO> histogramVOList = new ArrayList<>();
|
||||||
|
for (int i = 2; i >= 0 ; i--) {
|
||||||
|
HistogramVO histogramVO = new HistogramVO();
|
||||||
|
String year = String.valueOf(yearInt - i);
|
||||||
|
histogramVO.setName(year);
|
||||||
|
histogramVO.setAllMoney(map.getOrDefault(year, "0"));
|
||||||
|
histogramVOList.add(histogramVO);
|
||||||
|
}
|
||||||
|
return histogramVOList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -2,6 +2,7 @@ package com.jero.project.mapper;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.jero.index.dto.YearMoneyDTO;
|
||||||
import com.jero.index.vo.AmountClassDTO;
|
import com.jero.index.vo.AmountClassDTO;
|
||||||
import com.jero.project.entity.PayWorkingGroupSearch;
|
import com.jero.project.entity.PayWorkingGroupSearch;
|
||||||
import com.jero.project.entity.PayWorkingGroupStatistics;
|
import com.jero.project.entity.PayWorkingGroupStatistics;
|
||||||
@@ -232,4 +233,6 @@ public interface PayWorkingGroupMapper extends BaseMapper<PayWorkingGroup> {
|
|||||||
List<AmountClassDTO> amountClass(@Param("year") String year, @Param("column") String column);
|
List<AmountClassDTO> amountClass(@Param("year") String year, @Param("column") String column);
|
||||||
|
|
||||||
List<AmountClassDTO> amountClass1(@Param("year") String year, @Param("column") String column);
|
List<AmountClassDTO> amountClass1(@Param("year") String year, @Param("column") String column);
|
||||||
|
|
||||||
|
List<YearMoneyDTO> getYearMoneyDTO();
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -2575,4 +2575,10 @@
|
|||||||
</where>
|
</where>
|
||||||
GROUP BY chargeUse
|
GROUP BY chargeUse
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getYearMoneyDTO" resultType="com.jero.index.dto.YearMoneyDTO">
|
||||||
|
select sum(allMoney) as allMoney, year
|
||||||
|
from v_statistical v
|
||||||
|
group by year
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user