add 收入分类统计查询增加年份条件

This commit is contained in:
lijiarao
2023-02-21 15:57:58 +08:00
parent 09a936355a
commit 984c4c149f
2 changed files with 10 additions and 10 deletions
@@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
@@ -68,15 +67,16 @@ public class IndexController {
@ApiOperation(value = "收入分类统计")
@GetMapping(value = "/incomeClassificationStatistics")
public Result<List<PieChartVO>> incomeClassificationStatistics(@RequestParam(name="type", defaultValue = "1")Integer type,
@RequestParam(name="departCode",required = false)String departCode) {
@RequestParam(name="departCode",required = false)String departCode,
@RequestParam(name="year",required = false)String year) {
if (Objects.equals(type,1)){
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("allMoney", type,departCode);
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("allMoney", type,departCode,year);
return Result.OK(pieChartVOS);
}else if (Objects.equals(type,2)){
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("no_tax_amount", type, departCode);
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("no_tax_amount", type, departCode, year);
return Result.OK(pieChartVOS);
}else if (Objects.equals(type,3)){
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("allMoney", type, departCode);
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("allMoney", type, departCode, year);
return Result.OK(pieChartVOS);
}else {
return Result.OK();
@@ -12,7 +12,7 @@ import com.jero.index.vo.*;
import com.jero.project.mapper.PayWorkingGroupMapper;
import com.jero.project.service.IPayWorkingGroupService;
import com.jero.statistics.entity.*;
import org.apache.ibatis.ognl.DynamicSubscript;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -24,8 +24,6 @@ import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import static org.apache.ibatis.ognl.DynamicSubscript.all;
/**
* @author liJiaRao
* @date 2022-09-01 16:32
@@ -256,8 +254,10 @@ public class IndexService {
}
public List<PieChartVO> totalAmountClassificationStatistics(String column, Integer type, String departCode) {
String year = String.valueOf(DateUtil.year(new DateTime()));
public List<PieChartVO> totalAmountClassificationStatistics(String column, Integer type, String departCode, String year) {
if (StringUtils.isBlank(year)){
year = String.valueOf(DateUtil.year(new DateTime()));
}
List<AmountClassDTO> amountClassDTOS;
if (Objects.equals(type,3)){
amountClassDTOS = payWorkingGroupMapper.amountClass1(year,column,departCode);