update 首页收入分类统计,增加部门筛选

This commit is contained in:
lijiarao
2022-09-26 16:28:19 +08:00
parent a8dff572a1
commit 13a9683489
4 changed files with 16 additions and 9 deletions
@@ -69,15 +69,16 @@ public class IndexController {
@DictPoint
@ApiOperation(value = "收入分类统计")
@GetMapping(value = "/incomeClassificationStatistics")
public Result<List<PieChartVO>> incomeClassificationStatistics(@RequestParam(name="type", defaultValue = "1")Integer type) {
public Result<List<PieChartVO>> incomeClassificationStatistics(@RequestParam(name="type", defaultValue = "1")Integer type,
@RequestParam(name="departCode",required = false)String departCode) {
if (Objects.equals(type,1)){
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("allMoney", type);
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("allMoney", type,departCode);
return Result.OK(pieChartVOS);
}else if (Objects.equals(type,2)){
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("confirmNoTaxAmount", type);
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("confirmNoTaxAmount", type, departCode);
return Result.OK(pieChartVOS);
}else if (Objects.equals(type,3)){
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("allMoney", type);
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("allMoney", type, departCode);
return Result.OK(pieChartVOS);
}else {
return Result.OK();
@@ -212,13 +212,13 @@ public class IndexService {
}
public List<PieChartVO> totalAmountClassificationStatistics(String column, Integer type) {
public List<PieChartVO> totalAmountClassificationStatistics(String column, Integer type, String departCode) {
String year = String.valueOf(DateUtil.year(new DateTime()));
List<AmountClassDTO> amountClassDTOS;
if (!Objects.equals(type,3)){
amountClassDTOS = payWorkingGroupMapper.amountClass(year,column);
amountClassDTOS = payWorkingGroupMapper.amountClass(year,column,departCode);
}else {
amountClassDTOS = payWorkingGroupMapper.amountClass1(year,column);
amountClassDTOS = payWorkingGroupMapper.amountClass1(year,column,departCode);
}
BigDecimal all = amountClassDTOS.stream().map(AmountClassDTO::getMoney).reduce(BigDecimal.ZERO,BigDecimal::add);
List<PieChartVO> pieChartVOS = new ArrayList<>();
@@ -227,9 +227,9 @@ public interface PayWorkingGroupMapper extends BaseMapper<PayWorkingGroup> {
List<AllProjectStatistics> cumulativeListAllMoney();
List<AmountClassDTO> amountClass(@Param("year") String year, @Param("column") String column);
List<AmountClassDTO> amountClass(@Param("year") String year, @Param("column") String column, @Param("departCode") String departCode);
List<AmountClassDTO> amountClass1(@Param("year") String year, @Param("column") String column);
List<AmountClassDTO> amountClass1(@Param("year") String year, @Param("column") String column, @Param("departCode") String departCode);
List<YearMoneyDTO> getYearMoneyDTO();
@@ -2402,6 +2402,9 @@
FROM v_statistical v
<where>
confirmDate like concat('%',#{year},'%')
<if test="departCode != null and departCode != ''">
and departCode = #{departCode}
</if>
</where>
GROUP BY chargeUse
</select>
@@ -2675,6 +2678,9 @@
order by pp.createTime) v
<where>
confirmDate like concat('%',#{year},'%')
<if test="departCode != null and departCode != ''">
and departCode = #{departCode}
</if>
</where>
GROUP BY chargeUse
</select>